@unbrained/pm-cli 2026.11.21 → 2026.11.23

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 (943) hide show
  1. package/.agents/skills/pm-developer/SKILL.md +1 -1
  2. package/.claude-plugin/marketplace.json +1 -1
  3. package/dist/cli/after-command-context-usage.js +1 -1
  4. package/dist/cli/argv-utils.js +1 -1
  5. package/dist/cli/bootstrap-args.js +1 -1
  6. package/dist/cli/bundle-integrity.js +2 -2
  7. package/dist/cli/command-namespaces.js +1 -1
  8. package/dist/cli/commander-usage.js +11 -11
  9. package/dist/cli/commands/annotations/comments.js +1 -1
  10. package/dist/cli/commands/annotations/docs.js +1 -1
  11. package/dist/cli/commands/annotations/files.js +1 -1
  12. package/dist/cli/commands/annotations/learnings.js +1 -1
  13. package/dist/cli/commands/annotations/notes.js +1 -1
  14. package/dist/cli/commands/extension/describe.js +1 -1
  15. package/dist/cli/commands/extension/extension.js +1 -1
  16. package/dist/cli/commands/extension/scaffold.js +1 -1
  17. package/dist/cli/commands/extension/shared.js +1 -1
  18. package/dist/cli/commands/governance/gc.js +1 -1
  19. package/dist/cli/commands/governance/health.js +1 -1
  20. package/dist/cli/commands/governance/telemetry.js +1 -1
  21. package/dist/cli/commands/governance/validate.js +1 -1
  22. package/dist/cli/commands/history/activity.js +1 -1
  23. package/dist/cli/commands/history/history-compact.js +1 -1
  24. package/dist/cli/commands/history/history-redact.js +1 -1
  25. package/dist/cli/commands/history/history-repair.js +1 -1
  26. package/dist/cli/commands/history/history.js +1 -1
  27. package/dist/cli/commands/history/restore.js +1 -1
  28. package/dist/cli/commands/lifecycle/append.js +1 -1
  29. package/dist/cli/commands/lifecycle/claim.js +1 -1
  30. package/dist/cli/commands/lifecycle/close-many.js +1 -1
  31. package/dist/cli/commands/lifecycle/close.js +1 -1
  32. package/dist/cli/commands/lifecycle/copy.js +1 -1
  33. package/dist/cli/commands/lifecycle/create.js +1 -1
  34. package/dist/cli/commands/lifecycle/delete.js +1 -1
  35. package/dist/cli/commands/lifecycle/focus.js +1 -1
  36. package/dist/cli/commands/lifecycle/plan.js +1 -1
  37. package/dist/cli/commands/lifecycle/update-many.js +1 -1
  38. package/dist/cli/commands/lifecycle/update.js +1 -1
  39. package/dist/cli/commands/query/aggregate.js +1 -1
  40. package/dist/cli/commands/query/context.js +1 -1
  41. package/dist/cli/commands/query/deps.js +1 -1
  42. package/dist/cli/commands/query/duplicates.js +1 -1
  43. package/dist/cli/commands/query/eval.js +1 -1
  44. package/dist/cli/commands/query/get.js +1 -1
  45. package/dist/cli/commands/query/graph.js +1 -1
  46. package/dist/cli/commands/query/list.js +1 -1
  47. package/dist/cli/commands/query/next.js +1 -1
  48. package/dist/cli/commands/query/search.js +1 -1
  49. package/dist/cli/commands/query/stats.js +1 -1
  50. package/dist/cli/commands/test/test-all.js +1 -1
  51. package/dist/cli/commands/test/test-runs.js +1 -1
  52. package/dist/cli/commands/test/test.js +1 -1
  53. package/dist/cli/commands/workspace/config.js +1 -1
  54. package/dist/cli/commands/workspace/contracts.js +1 -1
  55. package/dist/cli/commands/workspace/init.js +1 -1
  56. package/dist/cli/commands/workspace/merge.js +1 -1
  57. package/dist/cli/commands/workspace/profile.js +1 -1
  58. package/dist/cli/commands/workspace/schema.js +1 -1
  59. package/dist/cli/commands/workspace/upgrade.js +1 -1
  60. package/dist/cli/context-intent-invocation.js +1 -1
  61. package/dist/cli/description-stdin.js +1 -1
  62. package/dist/cli/error-guidance.js +5 -5
  63. package/dist/cli/expected-revisions.js +1 -1
  64. package/dist/cli/extension-command-help.js +6 -6
  65. package/dist/cli/extension-recovery.js +1 -1
  66. package/dist/cli/help-content.js +5 -5
  67. package/dist/cli/help-json-payload.js +7 -7
  68. package/dist/cli/invocation-profile.js +2 -2
  69. package/dist/cli/main.js +5 -5
  70. package/dist/cli/migration-gates.js +1 -1
  71. package/dist/cli/option-values.js +1 -1
  72. package/dist/cli/preflight-warnings.js +3 -3
  73. package/dist/cli/public.js +1 -1
  74. package/dist/cli/register-annotations.js +1 -1
  75. package/dist/cli/register-assurance.js +1 -1
  76. package/dist/cli/register-files-lookup.js +1 -1
  77. package/dist/cli/register-history-activity.js +1 -1
  78. package/dist/cli/register-history-author.js +1 -1
  79. package/dist/cli/register-history-maintenance.js +2 -2
  80. package/dist/cli/register-list-query.js +10 -10
  81. package/dist/cli/register-mutation-options.js +0 -1
  82. package/dist/cli/register-mutation.js +6 -6
  83. package/dist/cli/register-operations.js +1 -1
  84. package/dist/cli/register-setup.js +1 -1
  85. package/dist/cli/register-structured-mutation.js +1 -1
  86. package/dist/cli/registration-helpers.js +1 -1
  87. package/dist/cli/runtime/activation.js +1 -1
  88. package/dist/cli/runtime/annotation-option-retry.js +1 -1
  89. package/dist/cli/runtime/close-fields-retry.js +1 -1
  90. package/dist/cli/runtime/field-route-retry.js +1 -1
  91. package/dist/cli/runtime/invocation-options.js +1 -1
  92. package/dist/cli/runtime/invocation-rewrites.js +1 -1
  93. package/dist/cli/runtime/projection-retry.js +1 -1
  94. package/dist/cli/runtime/read-output-mutation-retry.js +1 -1
  95. package/dist/cli/runtime/refusal-credential-redaction.js +1 -1
  96. package/dist/cli/runtime/selection.js +1 -1
  97. package/dist/cli/runtime/telemetry-outcome.js +1 -1
  98. package/dist/cli/runtime-compatibility-boundary.js +4 -4
  99. package/dist/cli/schema/registration.js +15 -15
  100. package/dist/cli/schema-registration-helpers.js +1 -1
  101. package/dist/cli/search-refresh.js +1 -1
  102. package/dist/cli/stats-analytics-json.js +1 -1
  103. package/dist/cli/telemetry-flush.js +1 -1
  104. package/dist/cli-bundle/bundle-manifest.json +1 -1
  105. package/dist/cli-bundle/chunks/chunk-2UQU7HRR.js +9 -0
  106. package/dist/cli-bundle/chunks/chunk-5DUP4AZA.js +2 -0
  107. package/dist/cli-bundle/chunks/chunk-5WZZ5XEN.js +3 -0
  108. package/dist/cli-bundle/chunks/chunk-6H36ZHMI.js +2 -0
  109. package/dist/cli-bundle/chunks/chunk-6MYJLOSG.js +2 -0
  110. package/dist/cli-bundle/chunks/chunk-AA52P34H.js +3 -0
  111. package/dist/cli-bundle/chunks/chunk-AEOHUSUI.js +2289 -0
  112. package/dist/cli-bundle/chunks/chunk-BSRIVYTM.js +8 -0
  113. package/dist/cli-bundle/chunks/chunk-CFWLQFJM.js +71 -0
  114. package/dist/cli-bundle/chunks/chunk-D6PDUKUG.js +9 -0
  115. package/dist/cli-bundle/chunks/chunk-ENKXRSFZ.js +31 -0
  116. package/dist/cli-bundle/chunks/chunk-F2Z6XLZB.js +3 -0
  117. package/dist/cli-bundle/chunks/chunk-FJOEL75F.js +2 -0
  118. package/dist/cli-bundle/chunks/chunk-GDXCAC52.js +2 -0
  119. package/dist/cli-bundle/chunks/chunk-H7JEXRIN.js +6 -0
  120. package/dist/cli-bundle/chunks/chunk-J2PDAVBC.js +2 -0
  121. package/dist/cli-bundle/chunks/chunk-KE7HMBEW.js +2 -0
  122. package/dist/cli-bundle/chunks/chunk-KZHIBEJL.js +33 -0
  123. package/dist/cli-bundle/chunks/chunk-NGJ5ERBF.js +115 -0
  124. package/dist/cli-bundle/chunks/chunk-NQ54T7T2.js +2 -0
  125. package/dist/cli-bundle/chunks/chunk-O7JHS64G.js +3 -0
  126. package/dist/cli-bundle/chunks/chunk-OKEZF7HU.js +2 -0
  127. package/dist/cli-bundle/chunks/chunk-OKIKF4FD.js +2 -0
  128. package/dist/cli-bundle/chunks/chunk-OPJF254V.js +9 -0
  129. package/dist/cli-bundle/chunks/chunk-PZA7QECY.js +1 -0
  130. package/dist/cli-bundle/chunks/chunk-RWA5YZ5X.js +2 -0
  131. package/dist/cli-bundle/chunks/chunk-S32NGRQM.js +2 -0
  132. package/dist/cli-bundle/chunks/chunk-SLFRSZK6.js +1 -0
  133. package/dist/cli-bundle/chunks/chunk-TZY5MVJF.js +125 -0
  134. package/dist/cli-bundle/chunks/chunk-YYT3MIRF.js +3 -0
  135. package/dist/cli-bundle/chunks/chunk-ZPS4B6SI.js +8 -0
  136. package/dist/cli-bundle/chunks/context-budget-recovery-M5RFUEFG.js +2 -0
  137. package/dist/cli-bundle/chunks/indexed-receipt-blobs-BPYKN5Q7.js +4 -0
  138. package/dist/cli-bundle/chunks/{item-revision-R5SZPJZ5.js → item-revision-FMD4KWBB.js} +2 -2
  139. package/dist/cli-bundle/chunks/item-transaction-SEHTH7N2.js +2 -0
  140. package/dist/cli-bundle/chunks/mutation-actor-SFGYIRPW.js +2 -0
  141. package/dist/cli-bundle/chunks/mutation-admission-57LBSKQI.js +2 -0
  142. package/dist/cli-bundle/chunks/{register-list-query-SPGPS3OS.js → register-list-query-L4IBU64P.js} +11 -11
  143. package/dist/cli-bundle/chunks/register-mutation-6NUOPHZ3.js +21 -0
  144. package/dist/cli-bundle/chunks/register-operations-JGYVORNN.js +2 -0
  145. package/dist/cli-bundle/chunks/register-setup-C44SIXEH.js +2 -0
  146. package/dist/cli-bundle/chunks/settlement-hook-6MR32OOC.js +7 -0
  147. package/dist/cli-bundle/chunks/stage-PQ7AB63N.js +2 -0
  148. package/dist/cli-bundle/focused-chunks/chunk-6LKTEKHS.js +6 -0
  149. package/dist/cli-bundle/focused-chunks/chunk-6LPXMFLM.js +2 -0
  150. package/dist/cli-bundle/focused-chunks/chunk-A6VEMCRR.js +3 -0
  151. package/dist/cli-bundle/focused-chunks/chunk-AIDL2ZNT.js +3 -0
  152. package/dist/cli-bundle/focused-chunks/chunk-BKPUUW5O.js +1 -0
  153. package/dist/cli-bundle/focused-chunks/chunk-BWOVFE5B.js +2 -0
  154. package/dist/cli-bundle/focused-chunks/chunk-HMDQDRV2.js +8 -0
  155. package/dist/cli-bundle/focused-chunks/chunk-I66IKYKP.js +2 -0
  156. package/dist/cli-bundle/focused-chunks/chunk-IIP6LZ5E.js +2 -0
  157. package/dist/cli-bundle/focused-chunks/chunk-IR2J3NOT.js +2 -0
  158. package/dist/cli-bundle/focused-chunks/chunk-IROZDIDX.js +3 -0
  159. package/dist/cli-bundle/focused-chunks/chunk-ITKDHSBR.js +2 -0
  160. package/dist/cli-bundle/focused-chunks/chunk-K53OIT5J.js +2 -0
  161. package/dist/cli-bundle/focused-chunks/chunk-LQYYPXUK.js +26 -0
  162. package/dist/cli-bundle/focused-chunks/chunk-NQTEE66P.js +13 -0
  163. package/dist/cli-bundle/focused-chunks/chunk-O7Z73ALG.js +2 -0
  164. package/dist/cli-bundle/focused-chunks/chunk-OTMMOKPM.js +91 -0
  165. package/dist/cli-bundle/focused-chunks/chunk-OXOCZJC6.js +2 -0
  166. package/dist/cli-bundle/focused-chunks/chunk-QLAHEDT6.js +2 -0
  167. package/dist/cli-bundle/focused-chunks/chunk-QQIIMMFU.js +2 -0
  168. package/dist/cli-bundle/focused-chunks/chunk-RIE3SJSE.js +9 -0
  169. package/dist/cli-bundle/focused-chunks/chunk-TD544C74.js +8 -0
  170. package/dist/cli-bundle/focused-chunks/chunk-UFTUNBMY.js +27 -0
  171. package/dist/cli-bundle/focused-chunks/chunk-X6CXWWNB.js +2 -0
  172. package/dist/cli-bundle/focused-chunks/chunk-XRS3VNC6.js +44 -0
  173. package/dist/cli-bundle/focused-chunks/chunk-XYPEZGTR.js +2 -0
  174. package/dist/cli-bundle/focused-chunks/chunk-Y2ESLKCF.js +8 -0
  175. package/dist/cli-bundle/focused-chunks/chunk-YSJKQLFR.js +2 -0
  176. package/dist/cli-bundle/focused-chunks/chunk-Z2X7HH3C.js +102 -0
  177. package/dist/cli-bundle/focused-chunks/chunk-ZHWPCVQL.js +78 -0
  178. package/dist/cli-bundle/focused-chunks/context-budget-recovery-CSJV3TY3.js +2 -0
  179. package/dist/cli-bundle/focused-chunks/indexed-receipt-blobs-EGEJMG3G.js +4 -0
  180. package/dist/cli-bundle/focused-chunks/{item-revision-3V3UIP5X.js → item-revision-YDACCDVY.js} +2 -2
  181. package/dist/cli-bundle/focused-chunks/item-transaction-UKEQCTKB.js +2 -0
  182. package/dist/cli-bundle/focused-chunks/mutation-actor-AS465LRX.js +2 -0
  183. package/dist/cli-bundle/focused-chunks/mutation-admission-E5UHJZFE.js +2 -0
  184. package/dist/cli-bundle/focused-chunks/settlement-hook-FMLGKG7J.js +7 -0
  185. package/dist/cli-bundle/focused-chunks/stage-36J7YLGI.js +2 -0
  186. package/dist/cli-bundle/main.js +27 -27
  187. package/dist/cli-bundle/sdk-authoring.js +1 -1
  188. package/dist/cli-bundle/sdk-contracts.js +5 -5
  189. package/dist/cli-bundle/sdk-core.js +1 -1
  190. package/dist/cli-bundle/sdk-governance.js +1 -1
  191. package/dist/cli-bundle/sdk-graph.js +1 -1
  192. package/dist/cli-bundle/sdk-merge.js +72 -60
  193. package/dist/cli-bundle/sdk-query.js +1 -1
  194. package/dist/cli-bundle/sdk-runtime.js +1 -1
  195. package/dist/cli-bundle/sdk-testing.js +1 -1
  196. package/dist/cli-bundle/sdk.js +13 -13
  197. package/dist/cli.js +1 -1
  198. package/dist/core/checkpoint/checkpoint-gc.js +1 -1
  199. package/dist/core/checkpoint/mutation-checkpoint.js +2 -2
  200. package/dist/core/checkpoint/mutation-context.js +1 -1
  201. package/dist/core/config/nested-settings.js +1 -1
  202. package/dist/core/config/positional-value.js +1 -1
  203. package/dist/core/diagnostics/remediation.js +1 -1
  204. package/dist/core/extensions/activation-summary-markdown.js +2 -2
  205. package/dist/core/extensions/activation-summary.js +1 -1
  206. package/dist/core/extensions/activation-transaction.js +1 -1
  207. package/dist/core/extensions/capability-usage.js +1 -1
  208. package/dist/core/extensions/command-hook-context.js +1 -1
  209. package/dist/core/extensions/command-metadata-contract.js +1 -1
  210. package/dist/core/extensions/command-visibility-tier.js +1 -1
  211. package/dist/core/extensions/contribution-inventory.js +1 -1
  212. package/dist/core/extensions/exporter-output-contract.js +1 -1
  213. package/dist/core/extensions/extension-candidate.js +1 -1
  214. package/dist/core/extensions/extension-capability-aliases.js +1 -1
  215. package/dist/core/extensions/extension-hook-runtime.js +1 -1
  216. package/dist/core/extensions/extension-policy.js +1 -1
  217. package/dist/core/extensions/extension-registries.js +1 -1
  218. package/dist/core/extensions/extension-runtime-helpers.js +1 -1
  219. package/dist/core/extensions/extension-types.js +1 -1
  220. package/dist/core/extensions/flag-definition-validation.js +1 -1
  221. package/dist/core/extensions/flag-value-types.js +1 -1
  222. package/dist/core/extensions/index.js +1 -1
  223. package/dist/core/extensions/item-field-types.js +1 -1
  224. package/dist/core/extensions/item-fields.js +1 -1
  225. package/dist/core/extensions/loader.js +1 -1
  226. package/dist/core/extensions/manifest-parser.js +1 -1
  227. package/dist/core/extensions/manifest-schema.js +1 -1
  228. package/dist/core/extensions/module-graph-snapshot.js +1 -1
  229. package/dist/core/extensions/mutation-actor-snapshot.js +1 -1
  230. package/dist/core/extensions/mutation-actor.js +1 -1
  231. package/dist/core/extensions/preflight-ownership.js +1 -1
  232. package/dist/core/extensions/read-output-contract.js +1 -1
  233. package/dist/core/extensions/registration-contracts.js +1 -1
  234. package/dist/core/extensions/registration-validation.js +1 -1
  235. package/dist/core/extensions/registration-values.js +1 -1
  236. package/dist/core/extensions/reserved-host-flags.js +1 -1
  237. package/dist/core/extensions/runtime-registrations.js +1 -1
  238. package/dist/core/extensions/service-ownership.js +1 -1
  239. package/dist/core/extensions/version-compat.js +1 -1
  240. package/dist/core/extensions/version-diagnostics.js +1 -1
  241. package/dist/core/fs/atomic-create.js +1 -1
  242. package/dist/core/fs/file-glob.js +1 -1
  243. package/dist/core/fs/fs-utils.js +2 -2
  244. package/dist/core/fs/host-environment-errors.js +1 -1
  245. package/dist/core/fs/index.js +1 -1
  246. package/dist/core/fs/path-utils.js +1 -1
  247. package/dist/core/governance/content-fields.js +1 -1
  248. package/dist/core/governance/issue-codes.js +1 -1
  249. package/dist/core/governance/metadata-coverage.js +1 -1
  250. package/dist/core/history/bridge.js +2 -0
  251. package/dist/core/history/digest.js +1 -1
  252. package/dist/core/history/drift-cache.js +3 -3
  253. package/dist/core/history/drift-scan.js +1 -1
  254. package/dist/core/history/event-classification.js +1 -1
  255. package/dist/core/history/event-index.js +11 -11
  256. package/dist/core/history/history-compact-bulk.js +1 -1
  257. package/dist/core/history/history-diff.js +1 -1
  258. package/dist/core/history/history-rewrite.js +1 -1
  259. package/dist/core/history/history-storage-stats.js +1 -1
  260. package/dist/core/history/history-stream-policy.js +1 -1
  261. package/dist/core/history/history.d.ts +12 -0
  262. package/dist/core/history/history.js +2 -2
  263. package/dist/core/history/identity.js +1 -1
  264. package/dist/core/history/index.js +1 -1
  265. package/dist/core/history/operation-contract.js +1 -1
  266. package/dist/core/history/projection.js +1 -1
  267. package/dist/core/history/read.d.ts +9 -0
  268. package/dist/core/history/read.js +1 -1
  269. package/dist/core/history/replay.d.ts +46 -5
  270. package/dist/core/history/replay.js +2 -2
  271. package/dist/core/history/stream-summary.js +2 -2
  272. package/dist/core/history/tombstone.js +1 -1
  273. package/dist/core/history/version-address.js +1 -1
  274. package/dist/core/history/workspace-history.js +2 -2
  275. package/dist/core/io/body-file.js +1 -1
  276. package/dist/core/io/bulk-ids-input.js +2 -2
  277. package/dist/core/item/actionability.js +1 -1
  278. package/dist/core/item/deferred-fields.js +1 -1
  279. package/dist/core/item/dependency-reference.js +1 -1
  280. package/dist/core/item/id.js +1 -1
  281. package/dist/core/item/index.js +1 -1
  282. package/dist/core/item/item-format-version.js +1 -1
  283. package/dist/core/item/item-format.js +7 -7
  284. package/dist/core/item/item-record.js +1 -1
  285. package/dist/core/item/item-type-definition.js +1 -1
  286. package/dist/core/item/literal-mutation-input.js +1 -1
  287. package/dist/core/item/parent-reference-policy.js +1 -1
  288. package/dist/core/item/parse.js +8 -8
  289. package/dist/core/item/plan-lifecycle.js +1 -1
  290. package/dist/core/item/priority.js +1 -1
  291. package/dist/core/item/sprint-release-format.js +1 -1
  292. package/dist/core/item/status-filter.js +1 -1
  293. package/dist/core/item/status.js +1 -1
  294. package/dist/core/item/toon-decode.js +1 -1
  295. package/dist/core/item/type-registry.js +1 -1
  296. package/dist/core/item/type-synonyms.js +1 -1
  297. package/dist/core/lock/index.js +1 -1
  298. package/dist/core/lock/lock-confinement.js +1 -1
  299. package/dist/core/lock/lock-gc.js +1 -1
  300. package/dist/core/lock/lock-owner.js +1 -1
  301. package/dist/core/lock/lock.js +4 -4
  302. package/dist/core/output/linked-test-projection.js +5 -5
  303. package/dist/core/output/mutation-projection.js +1 -1
  304. package/dist/core/output/output-control.js +1 -1
  305. package/dist/core/output/output.js +19 -19
  306. package/dist/core/output/query-summary.js +1 -1
  307. package/dist/core/output/tabular.js +3 -3
  308. package/dist/core/packages/manifest.js +1 -1
  309. package/dist/core/packages/root.js +1 -1
  310. package/dist/core/policy/workflow-policy-schema.js +1 -1
  311. package/dist/core/policy/workflow-policy-store.js +1 -1
  312. package/dist/core/policy/workflow-policy.js +1 -1
  313. package/dist/core/profile/profile-describe.js +1 -1
  314. package/dist/core/profile/profile-lint.d.ts +1 -1
  315. package/dist/core/profile/profile-lint.js +1 -1
  316. package/dist/core/profile/profile-plan.js +1 -1
  317. package/dist/core/profile/profile-presets.js +4 -4
  318. package/dist/core/reproducibility/context.js +1 -1
  319. package/dist/core/schema/fields-file.js +2 -2
  320. package/dist/core/schema/item-types-file.js +2 -2
  321. package/dist/core/schema/runtime-field-filters.js +1 -1
  322. package/dist/core/schema/runtime-field-values.js +1 -1
  323. package/dist/core/schema/runtime-schema.js +2 -2
  324. package/dist/core/schema/status-defs-file.js +2 -2
  325. package/dist/core/schema/status-token.js +1 -1
  326. package/dist/core/schema/type-inference.js +1 -1
  327. package/dist/core/schema/type-presets.js +1 -1
  328. package/dist/core/schema/type-workflows.js +1 -1
  329. package/dist/core/search/background-refresh.js +2 -2
  330. package/dist/core/search/bm25.js +1 -1
  331. package/dist/core/search/cache.js +2 -2
  332. package/dist/core/search/corpus.js +1 -1
  333. package/dist/core/search/embedding-batches.js +1 -1
  334. package/dist/core/search/eval-thresholds.js +1 -1
  335. package/dist/core/search/eval.js +1 -1
  336. package/dist/core/search/http-client.js +1 -1
  337. package/dist/core/search/providers.js +1 -1
  338. package/dist/core/search/relevance.js +1 -1
  339. package/dist/core/search/semantic-defaults.js +1 -1
  340. package/dist/core/search/staleness.js +1 -1
  341. package/dist/core/search/vector-stores.js +2 -2
  342. package/dist/core/search/vectorization-metadata.js +1 -1
  343. package/dist/core/sentry/helpers.js +1 -1
  344. package/dist/core/sentry/instrument.js +1 -1
  345. package/dist/core/sentry/sensitive-assignments.js +1 -1
  346. package/dist/core/session/session-state.js +1 -1
  347. package/dist/core/shared/agent-session-context.js +1 -1
  348. package/dist/core/shared/author.js +5 -5
  349. package/dist/core/shared/command-line.js +1 -1
  350. package/dist/core/shared/command-types.js +0 -1
  351. package/dist/core/shared/conflict-markers.js +1 -1
  352. package/dist/core/shared/constants.js +1 -1
  353. package/dist/core/shared/error-details.js +1 -1
  354. package/dist/core/shared/errors.js +1 -1
  355. package/dist/core/shared/html-entity-decode.js +1 -1
  356. package/dist/core/shared/index.js +1 -1
  357. package/dist/core/shared/item-metadata-contract.js +1 -1
  358. package/dist/core/shared/lazy-module.js +1 -1
  359. package/dist/core/shared/levenshtein.js +1 -1
  360. package/dist/core/shared/memo.js +1 -1
  361. package/dist/core/shared/numeric-parsers.js +1 -1
  362. package/dist/core/shared/option-alias-visibility.js +1 -1
  363. package/dist/core/shared/output-unicode.js +1 -1
  364. package/dist/core/shared/primitives.js +1 -1
  365. package/dist/core/shared/process-tree.js +2 -2
  366. package/dist/core/shared/secret-rules.js +5 -5
  367. package/dist/core/shared/serial-queue.js +1 -1
  368. package/dist/core/shared/serialization.js +1 -1
  369. package/dist/core/shared/split-comma-list.js +1 -1
  370. package/dist/core/shared/text-normalization.js +1 -1
  371. package/dist/core/shared/time.js +2 -2
  372. package/dist/core/shared/url-credentials.js +1 -1
  373. package/dist/core/store/index.js +1 -1
  374. package/dist/core/store/item-format-migration.js +1 -1
  375. package/dist/core/store/item-metadata-cache.js +1 -1
  376. package/dist/core/store/item-metadata-query-index.js +11 -11
  377. package/dist/core/store/item-metadata-read-work.js +1 -1
  378. package/dist/core/store/item-mutation-precondition.js +1 -1
  379. package/dist/core/store/item-store.js +1 -1
  380. package/dist/core/store/paths.js +1 -1
  381. package/dist/core/store/settings-concurrency.js +1 -1
  382. package/dist/core/store/settings-read-cache.js +1 -1
  383. package/dist/core/store/settings-sections.js +2 -2
  384. package/dist/core/store/settings-validator.js +1 -1
  385. package/dist/core/store/settings.d.ts +3 -1
  386. package/dist/core/store/settings.js +6 -6
  387. package/dist/core/store/sqlite-runtime.js +1 -1
  388. package/dist/core/store/tracker-preflight.js +1 -1
  389. package/dist/core/store/transaction-coordinator-scope.js +1 -1
  390. package/dist/core/telemetry/consent.js +3 -3
  391. package/dist/core/telemetry/observability.js +1 -1
  392. package/dist/core/telemetry/policy.js +1 -1
  393. package/dist/core/telemetry/read-sampling.js +2 -2
  394. package/dist/core/telemetry/runtime.js +9 -9
  395. package/dist/core/test/background-runs.js +4 -4
  396. package/dist/core/test/item-test-run-tracking.js +1 -1
  397. package/dist/core/test/run-selectors.js +1 -1
  398. package/dist/core/validate/estimate-defaults.js +1 -1
  399. package/dist/core/validate/fix-planning.js +1 -1
  400. package/dist/core/validate/linked-artifact-reference.js +1 -1
  401. package/dist/core/validate/missing-by-type.js +1 -1
  402. package/dist/core/validate/missing-link-owners.js +1 -1
  403. package/dist/core/validate/stale-file-classification.js +1 -1
  404. package/dist/mcp/http-server.js +5 -5
  405. package/dist/mcp/legacy-adapter.js +1 -1
  406. package/dist/mcp/runtime-capabilities.js +1 -1
  407. package/dist/mcp/server.js +4 -4
  408. package/dist/mcp/tool-definitions.js +1 -1
  409. package/dist/sdk/actionability.js +1 -1
  410. package/dist/sdk/agent/closed-domain-contracts.js +1 -1
  411. package/dist/sdk/agent/command-recovery.js +1 -1
  412. package/dist/sdk/agent/command-suggestions.js +1 -1
  413. package/dist/sdk/agent/create-option-policy.js +1 -1
  414. package/dist/sdk/agent/identity-config.js +1 -1
  415. package/dist/sdk/agent/item-addressing.js +1 -1
  416. package/dist/sdk/agent/linked-resource-recovery.js +1 -1
  417. package/dist/sdk/agent/refusal-closure-census.js +2 -2
  418. package/dist/sdk/agent/refusal-corpus-contracts.js +1 -1
  419. package/dist/sdk/agent/subcommand-recovery.js +1 -1
  420. package/dist/sdk/agent-capability-contracts.js +3 -3
  421. package/dist/sdk/agent-session-context.js +1 -1
  422. package/dist/sdk/annotations.js +1 -1
  423. package/dist/sdk/author-attribution.js +1 -1
  424. package/dist/sdk/cli-bootstrap.js +1 -1
  425. package/dist/sdk/cli-contracts/agent-output-contracts.js +5 -5
  426. package/dist/sdk/cli-contracts/bootstrap-command-scanner.js +1 -1
  427. package/dist/sdk/cli-contracts/command-aliases.js +1 -1
  428. package/dist/sdk/cli-contracts/command-exit-contracts.js +1 -1
  429. package/dist/sdk/cli-contracts/commander-mutation-options.js +1 -1
  430. package/dist/sdk/cli-contracts/commander-types.js +1 -1
  431. package/dist/sdk/cli-contracts/completeness.js +1 -1
  432. package/dist/sdk/cli-contracts/enum-contracts.js +1 -1
  433. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  434. package/dist/sdk/cli-contracts/flag-lexicon-contracts.js +2 -2
  435. package/dist/sdk/cli-contracts/grammar-contracts.js +1 -1
  436. package/dist/sdk/cli-contracts/registration-helpers.js +7 -7
  437. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
  438. package/dist/sdk/cli-contracts/schemas/assurance-definition.js +1 -1
  439. package/dist/sdk/cli-contracts/string-lists.js +1 -1
  440. package/dist/sdk/cli-contracts/tool-option-contracts.js +1 -1
  441. package/dist/sdk/cli-contracts/tool-parameter-tables.js +1 -1
  442. package/dist/sdk/cli-contracts/tool-schema.js +1 -1
  443. package/dist/sdk/cli-contracts/typed-action-inputs.d.ts +2 -2
  444. package/dist/sdk/cli-contracts/typed-action-inputs.js +0 -1
  445. package/dist/sdk/cli-contracts.js +1 -1
  446. package/dist/sdk/cli-program.js +1 -1
  447. package/dist/sdk/command-line.js +1 -1
  448. package/dist/sdk/comments.js +1 -1
  449. package/dist/sdk/compile-cache.js +1 -1
  450. package/dist/sdk/completion/bash.js +2 -2
  451. package/dist/sdk/completion/fish.js +74 -73
  452. package/dist/sdk/completion/shared.js +1 -1
  453. package/dist/sdk/completion/zsh.js +77 -76
  454. package/dist/sdk/completion.js +1 -1
  455. package/dist/sdk/config.js +1 -1
  456. package/dist/sdk/context/recency.js +1 -1
  457. package/dist/sdk/context/semantic-session-attribution.js +1 -1
  458. package/dist/sdk/context/usage-egress.js +1 -1
  459. package/dist/sdk/context/usage-ledger.js +6 -6
  460. package/dist/sdk/context-intent-contracts.js +1 -1
  461. package/dist/sdk/context-intent-runtime.js +1 -1
  462. package/dist/sdk/context-packing.js +1 -1
  463. package/dist/sdk/context-relevance.js +1 -1
  464. package/dist/sdk/context-signal-store.js +2 -2
  465. package/dist/sdk/context-usage.js +1 -1
  466. package/dist/sdk/dependencies/context-budget-recovery.js +1 -1
  467. package/dist/sdk/dependencies.js +1 -1
  468. package/dist/sdk/dependency-flag-validation.js +1 -1
  469. package/dist/sdk/dependency-provenance.js +1 -1
  470. package/dist/sdk/docs.js +1 -1
  471. package/dist/sdk/duplicates.js +1 -1
  472. package/dist/sdk/environment/host-environment-errors.js +1 -1
  473. package/dist/sdk/environment/project-runtime-compatibility.js +2 -2
  474. package/dist/sdk/environment/source-context.js +1 -1
  475. package/dist/sdk/environment/tracker-preflight.js +1 -1
  476. package/dist/sdk/error-code-catalog.js +1 -1
  477. package/dist/sdk/error-runtime.js +1 -1
  478. package/dist/sdk/errors.js +1 -1
  479. package/dist/sdk/eval.js +1 -1
  480. package/dist/sdk/extension/author-manifest.js +1 -1
  481. package/dist/sdk/extension/bundled-catalog.js +1 -1
  482. package/dist/sdk/extension/command-options.js +1 -1
  483. package/dist/sdk/extension/concurrency.js +1 -1
  484. package/dist/sdk/extension/copy-scope.js +1 -1
  485. package/dist/sdk/extension/custom-field-collisions.js +1 -1
  486. package/dist/sdk/extension/describe.js +3 -3
  487. package/dist/sdk/extension/doctor.js +1 -1
  488. package/dist/sdk/extension/install-plan.js +1 -1
  489. package/dist/sdk/extension/install-receipts.js +1 -1
  490. package/dist/sdk/extension/install-runtime.js +3 -3
  491. package/dist/sdk/extension/install-snapshot.js +1 -1
  492. package/dist/sdk/extension/install-sources.js +5 -5
  493. package/dist/sdk/extension/managed-state.js +2 -2
  494. package/dist/sdk/extension/managed-update-status.js +1 -1
  495. package/dist/sdk/extension/migrations.js +2 -2
  496. package/dist/sdk/extension/native-command-options.js +1 -1
  497. package/dist/sdk/extension/output-ownership.js +1 -1
  498. package/dist/sdk/extension/runtime-summary.js +1 -1
  499. package/dist/sdk/extension/scaffold.js +11 -11
  500. package/dist/sdk/extension/shared.js +1 -1
  501. package/dist/sdk/extension/source-resolution.js +1 -1
  502. package/dist/sdk/extension/static-inventory.js +1 -1
  503. package/dist/sdk/extension/update-check.js +1 -1
  504. package/dist/sdk/extension-command-context.js +2 -2
  505. package/dist/sdk/extension-contracts.js +1 -1
  506. package/dist/sdk/extension.js +1 -1
  507. package/dist/sdk/files.js +1 -1
  508. package/dist/sdk/flag-invocation-contracts.js +1 -1
  509. package/dist/sdk/generated/error-code-catalog-rows.js +1 -1
  510. package/dist/sdk/generated/generated-error-code-catalog-part-1.js +1 -1
  511. package/dist/sdk/generated/generated-error-code-catalog-part-2.js +1 -1
  512. package/dist/sdk/generated-error-code-catalog.js +1 -1
  513. package/dist/sdk/governance/assurance-action-contracts.js +0 -1
  514. package/dist/sdk/governance/assurance-action.js +1 -1
  515. package/dist/sdk/governance/assurance-limits.js +1 -1
  516. package/dist/sdk/governance/assurance-mutation-error.js +1 -1
  517. package/dist/sdk/governance/assurance-presets.js +1 -1
  518. package/dist/sdk/governance/assurance-runtime.js +1 -1
  519. package/dist/sdk/governance/assurance.js +4 -4
  520. package/dist/sdk/governance/boundary-fixtures.js +1 -1
  521. package/dist/sdk/governance/closure-timestamps.js +1 -1
  522. package/dist/sdk/governance/defect-recurrence-coverage.js +1 -1
  523. package/dist/sdk/governance/defect-recurrence-graph.js +1 -1
  524. package/dist/sdk/governance/defect-recurrence-signals.js +1 -1
  525. package/dist/sdk/governance/defect-recurrence.js +2 -2
  526. package/dist/sdk/governance/extension-host-version.js +1 -1
  527. package/dist/sdk/governance/gc.js +1 -1
  528. package/dist/sdk/governance/health/history-drift-remedies.js +2 -0
  529. package/dist/sdk/governance/health/projection.js +1 -1
  530. package/dist/sdk/governance/health-merge-evidence.js +1 -1
  531. package/dist/sdk/governance/health.js +2 -2
  532. package/dist/sdk/governance/hierarchy-validation.js +1 -1
  533. package/dist/sdk/governance/in-progress-work-health.js +1 -1
  534. package/dist/sdk/governance/lifecycle-dependency-cycles.js +1 -1
  535. package/dist/sdk/governance/linked-file-report.js +1 -1
  536. package/dist/sdk/governance/merge-receipt-history.js +1 -1
  537. package/dist/sdk/governance/provenance-health.js +4 -4
  538. package/dist/sdk/governance/reindex.js +5 -5
  539. package/dist/sdk/governance/stale-work.js +1 -1
  540. package/dist/sdk/governance/status-role-diagnostics.js +1 -1
  541. package/dist/sdk/governance/storage-integrity.js +1 -1
  542. package/dist/sdk/governance/tracked-runtime-cache.js +1 -1
  543. package/dist/sdk/governance/upgrade.js +2 -2
  544. package/dist/sdk/governance/validate-deferred-fields.js +1 -1
  545. package/dist/sdk/governance/validate-history-drift.js +1 -1
  546. package/dist/sdk/governance/validate-item-reader.js +1 -1
  547. package/dist/sdk/governance/validate-normalization.js +1 -1
  548. package/dist/sdk/governance/validate.js +1 -1
  549. package/dist/sdk/governance/workflow-completeness.js +1 -1
  550. package/dist/sdk/governance/workflow-policy.js +3 -3
  551. package/dist/sdk/governance/workspace-position.js +2 -2
  552. package/dist/sdk/graph/analytics.js +1 -1
  553. package/dist/sdk/graph/assembly.js +1 -1
  554. package/dist/sdk/graph/cache.js +1 -1
  555. package/dist/sdk/graph/cardinality-integrity.js +1 -1
  556. package/dist/sdk/graph/centrality.js +1 -1
  557. package/dist/sdk/graph/deadline-scheduling.js +1 -1
  558. package/dist/sdk/graph/durable-cache.js +1 -1
  559. package/dist/sdk/graph/governance-contracts.js +1 -1
  560. package/dist/sdk/graph/governance.js +1 -1
  561. package/dist/sdk/graph/hierarchy-integrity.js +1 -1
  562. package/dist/sdk/graph/lifecycle-coverage.js +1 -1
  563. package/dist/sdk/graph/mutation-advisory.js +1 -1
  564. package/dist/sdk/graph/query-contracts.js +1 -1
  565. package/dist/sdk/graph/remediation.js +1 -1
  566. package/dist/sdk/graph/run.js +1 -1
  567. package/dist/sdk/graph/scheduling.js +1 -1
  568. package/dist/sdk/graph/traversal.js +1 -1
  569. package/dist/sdk/graph/workspace-relationship-kind-registry.js +1 -1
  570. package/dist/sdk/guide-topics.js +1 -1
  571. package/dist/sdk/guide.js +7 -7
  572. package/dist/sdk/history/append-only-repair.d.ts +30 -0
  573. package/dist/sdk/history/append-only-repair.js +6 -0
  574. package/dist/sdk/history/attestation-command.js +2 -2
  575. package/dist/sdk/history/attestation-contract.js +1 -1
  576. package/dist/sdk/history/attestation-scan.js +1 -1
  577. package/dist/sdk/history/attestation.js +1 -1
  578. package/dist/sdk/history/maintenance.d.ts +8 -2
  579. package/dist/sdk/history/maintenance.js +1 -1
  580. package/dist/sdk/history/reanchor-refusal.js +2 -0
  581. package/dist/sdk/history/reseed.d.ts +15 -0
  582. package/dist/sdk/history/reseed.js +2 -0
  583. package/dist/sdk/history/salvage.d.ts +19 -8
  584. package/dist/sdk/history/salvage.js +5 -3
  585. package/dist/sdk/history/subject.js +1 -1
  586. package/dist/sdk/history-analytics.js +1 -1
  587. package/dist/sdk/history-compact.js +1 -1
  588. package/dist/sdk/history-mcp.js +1 -1
  589. package/dist/sdk/history-provenance.js +1 -1
  590. package/dist/sdk/history-read.js +1 -1
  591. package/dist/sdk/history-redact.js +1 -1
  592. package/dist/sdk/history-repair.d.ts +8 -2
  593. package/dist/sdk/history-repair.js +1 -1
  594. package/dist/sdk/improvement-ledger-validation.js +1 -1
  595. package/dist/sdk/improvement-ledger.js +2 -2
  596. package/dist/sdk/index.d.ts +1 -1
  597. package/dist/sdk/init-agent-guidance.js +10 -10
  598. package/dist/sdk/init.js +14 -14
  599. package/dist/sdk/invocation-author.js +1 -1
  600. package/dist/sdk/item-children.js +1 -1
  601. package/dist/sdk/item-metadata-index.js +1 -1
  602. package/dist/sdk/item-schedule.js +1 -1
  603. package/dist/sdk/item-transaction.d.ts +33 -1
  604. package/dist/sdk/item-transaction.js +1 -1
  605. package/dist/sdk/learnings.js +1 -1
  606. package/dist/sdk/lifecycle/append.js +3 -3
  607. package/dist/sdk/lifecycle/checkpoint-rollback.js +1 -1
  608. package/dist/sdk/lifecycle/claim.js +1 -1
  609. package/dist/sdk/lifecycle/cli-input.js +1 -1
  610. package/dist/sdk/lifecycle/close-many.js +1 -1
  611. package/dist/sdk/lifecycle/close.js +1 -1
  612. package/dist/sdk/lifecycle/copy.js +1 -1
  613. package/dist/sdk/lifecycle/core-field-recovery.js +1 -1
  614. package/dist/sdk/lifecycle/core-item-fields.js +1 -1
  615. package/dist/sdk/lifecycle/create-deferrals.js +1 -1
  616. package/dist/sdk/lifecycle/create.js +1 -1
  617. package/dist/sdk/lifecycle/delete.js +1 -1
  618. package/dist/sdk/lifecycle/dependency-removal.js +1 -1
  619. package/dist/sdk/lifecycle/event-validation-messages.js +1 -1
  620. package/dist/sdk/lifecycle/focus.js +1 -1
  621. package/dist/sdk/lifecycle/hierarchy-mutation-lock.js +1 -1
  622. package/dist/sdk/lifecycle/item-revision.js +1 -1
  623. package/dist/sdk/lifecycle/legacy-none-tokens.js +1 -1
  624. package/dist/sdk/lifecycle/lifecycle-transitions.js +1 -1
  625. package/dist/sdk/lifecycle/mcp-actions.js +1 -1
  626. package/dist/sdk/lifecycle/metadata-normalizers.js +1 -1
  627. package/dist/sdk/lifecycle/mutation-command-options.js +0 -1
  628. package/dist/sdk/lifecycle/mutation-facet-contracts.js +1 -1
  629. package/dist/sdk/lifecycle/mutation-option-validation.js +1 -1
  630. package/dist/sdk/lifecycle/plan-mutation-receipt.js +1 -1
  631. package/dist/sdk/lifecycle/plan.js +1 -1
  632. package/dist/sdk/lifecycle/recurrence-parsers.js +1 -1
  633. package/dist/sdk/lifecycle/release-handoff.js +1 -1
  634. package/dist/sdk/lifecycle/reopen.js +1 -1
  635. package/dist/sdk/lifecycle/repeatable-metadata-parsers.js +2 -2
  636. package/dist/sdk/lifecycle/repeated-terminal-state.js +1 -1
  637. package/dist/sdk/lifecycle/restore.js +1 -1
  638. package/dist/sdk/lifecycle/shared-unset-fields.js +1 -1
  639. package/dist/sdk/lifecycle/start-blockers.js +1 -1
  640. package/dist/sdk/lifecycle/structured-mutation-plan.js +1 -1
  641. package/dist/sdk/lifecycle/task-composition.js +1 -1
  642. package/dist/sdk/lifecycle/update-many.js +1 -1
  643. package/dist/sdk/lifecycle/update.js +2 -2
  644. package/dist/sdk/lifecycle/workflow-transition.js +1 -1
  645. package/dist/sdk/lifecycle-completion.js +1 -1
  646. package/dist/sdk/lifecycle-policy.js +1 -1
  647. package/dist/sdk/linked-artifacts.js +2 -2
  648. package/dist/sdk/mcp/apps.js +5 -5
  649. package/dist/sdk/mcp/authorization.js +1 -1
  650. package/dist/sdk/mcp/discovery.js +1 -1
  651. package/dist/sdk/mcp/executable.js +4 -4
  652. package/dist/sdk/mcp/interactions.js +1 -1
  653. package/dist/sdk/mcp/protocol.js +1 -1
  654. package/dist/sdk/mcp/skills.js +3 -3
  655. package/dist/sdk/mcp/subscriptions.js +1 -1
  656. package/dist/sdk/mcp/tasks.js +2 -2
  657. package/dist/sdk/mcp/transport.js +1 -1
  658. package/dist/sdk/merge/abandoned-receipts.js +1 -1
  659. package/dist/sdk/merge/driver.js +7 -7
  660. package/dist/sdk/merge/history-scalar-rebase.js +1 -1
  661. package/dist/sdk/merge/ignored-artifacts.js +1 -1
  662. package/dist/sdk/merge/index.js +1 -1
  663. package/dist/sdk/merge/indexed-receipt-blobs.js +2 -2
  664. package/dist/sdk/merge/install.js +6 -6
  665. package/dist/sdk/merge/receipt-file-boundary.js +1 -1
  666. package/dist/sdk/merge/receipt-operation.js +1 -1
  667. package/dist/sdk/merge/receipt-schema.js +1 -1
  668. package/dist/sdk/merge/receipts.js +4 -4
  669. package/dist/sdk/merge/reconcile.js +1 -1
  670. package/dist/sdk/merge/settlement-hook.js +4 -4
  671. package/dist/sdk/merge/stage.js +1 -1
  672. package/dist/sdk/merge/three-way.d.ts +22 -3
  673. package/dist/sdk/merge/three-way.js +9 -3
  674. package/dist/sdk/merge/worktree-config.js +2 -2
  675. package/dist/sdk/merge.js +1 -1
  676. package/dist/sdk/mutation-events.js +1 -1
  677. package/dist/sdk/mutation-guard.js +1 -1
  678. package/dist/sdk/notes.js +1 -1
  679. package/dist/sdk/output/fit-envelope.js +1 -1
  680. package/dist/sdk/output/list-envelope.js +1 -1
  681. package/dist/sdk/output/table-rows.js +1 -1
  682. package/dist/sdk/output-contracts.js +1 -1
  683. package/dist/sdk/output-projection.js +1 -1
  684. package/dist/sdk/output-token-accounting.js +1 -1
  685. package/dist/sdk/output.js +2 -2
  686. package/dist/sdk/ownership-source.js +1 -1
  687. package/dist/sdk/package-import-adapters.js +1 -1
  688. package/dist/sdk/package-migrations.js +1 -1
  689. package/dist/sdk/package-runtime-options.js +1 -1
  690. package/dist/sdk/pagination.js +1 -1
  691. package/dist/sdk/profile.js +5 -5
  692. package/dist/sdk/provenance.js +1 -1
  693. package/dist/sdk/public-surface.json +1 -1
  694. package/dist/sdk/query/activity.js +1 -1
  695. package/dist/sdk/query/aggregate.js +1 -1
  696. package/dist/sdk/query/calendar.js +4 -4
  697. package/dist/sdk/query/complete-list.js +1 -1
  698. package/dist/sdk/query/context.js +2 -2
  699. package/dist/sdk/query/declared-blockers.js +1 -1
  700. package/dist/sdk/query/duplicate-candidates.js +1 -1
  701. package/dist/sdk/query/get-facet-roots.js +1 -1
  702. package/dist/sdk/query/get.js +1 -1
  703. package/dist/sdk/query/history.js +1 -1
  704. package/dist/sdk/query/item-filter-options.js +0 -1
  705. package/dist/sdk/query/light-metadata.js +1 -1
  706. package/dist/sdk/query/list-filter-shared.js +1 -1
  707. package/dist/sdk/query/list.js +1 -1
  708. package/dist/sdk/query/multi-value-filters.js +1 -1
  709. package/dist/sdk/query/next-ranking-policy.js +1 -1
  710. package/dist/sdk/query/next-ready-budget.js +1 -1
  711. package/dist/sdk/query/next.js +2 -2
  712. package/dist/sdk/query/parsers.js +1 -1
  713. package/dist/sdk/query/projection-contracts.js +1 -1
  714. package/dist/sdk/query/search/corpus.js +2 -2
  715. package/dist/sdk/query/search/filters.js +1 -1
  716. package/dist/sdk/query/search/input.js +1 -1
  717. package/dist/sdk/query/search/lexical.js +1 -1
  718. package/dist/sdk/query/search/response.js +1 -1
  719. package/dist/sdk/query/search/semantic.js +3 -3
  720. package/dist/sdk/query/search/types.js +0 -1
  721. package/dist/sdk/query/search-contracts.js +1 -1
  722. package/dist/sdk/query/search-pagination.js +1 -1
  723. package/dist/sdk/query/search-rendering.js +1 -1
  724. package/dist/sdk/query/search.js +1 -1
  725. package/dist/sdk/query/window-pagination.js +1 -1
  726. package/dist/sdk/query/workspace-contracts.js +1 -1
  727. package/dist/sdk/read-output/continuation.js +1 -1
  728. package/dist/sdk/read-output/extension.js +1 -1
  729. package/dist/sdk/read-output/options.js +1 -1
  730. package/dist/sdk/read-output/positional-rows.js +1 -1
  731. package/dist/sdk/read-output/provenance.js +1 -1
  732. package/dist/sdk/read-output/session-result.js +0 -1
  733. package/dist/sdk/read-output/surfaces.js +1 -1
  734. package/dist/sdk/read-output/tail-retention.js +1 -1
  735. package/dist/sdk/read-output-budget.js +1 -1
  736. package/dist/sdk/read-output-contracts.js +1 -1
  737. package/dist/sdk/read-output-rows.js +1 -1
  738. package/dist/sdk/read-output-session.js +1 -1
  739. package/dist/sdk/relationship-analytics.js +1 -1
  740. package/dist/sdk/relationship-context.js +1 -1
  741. package/dist/sdk/relationship-history.js +6 -6
  742. package/dist/sdk/relationship-kinds/contract.js +1 -1
  743. package/dist/sdk/relationships.js +1 -1
  744. package/dist/sdk/reproducibility/process.js +1 -1
  745. package/dist/sdk/runtime/actions.js +1 -1
  746. package/dist/sdk/runtime/context.js +1 -1
  747. package/dist/sdk/runtime/mutation-admission.js +1 -1
  748. package/dist/sdk/runtime/mutation-value-validation.js +1 -1
  749. package/dist/sdk/runtime/schema-preview.js +1 -1
  750. package/dist/sdk/runtime/schema.js +1 -1
  751. package/dist/sdk/runtime-action-aliases.js +1 -1
  752. package/dist/sdk/runtime-extended-actions.js +1 -1
  753. package/dist/sdk/runtime-input.d.ts +8 -2
  754. package/dist/sdk/runtime-input.js +1 -1
  755. package/dist/sdk/runtime-primitives.d.ts +1 -1
  756. package/dist/sdk/runtime-primitives.js +1 -1
  757. package/dist/sdk/runtime-public-contracts.js +0 -1
  758. package/dist/sdk/runtime-stats-options.js +1 -1
  759. package/dist/sdk/runtime.d.ts +9 -0
  760. package/dist/sdk/runtime.js +1 -1
  761. package/dist/sdk/scheduling-shortcuts.js +1 -1
  762. package/dist/sdk/schema/field-option-collisions.js +2 -0
  763. package/dist/sdk/schema-migration.js +4 -4
  764. package/dist/sdk/schema.js +7 -7
  765. package/dist/sdk/search-refresh-worker.js +1 -1
  766. package/dist/sdk/similarity-scoring.js +1 -1
  767. package/dist/sdk/similarity.js +1 -1
  768. package/dist/sdk/start-task-status.js +1 -1
  769. package/dist/sdk/stats.js +1 -1
  770. package/dist/sdk/structured-mutations.d.ts +5 -5
  771. package/dist/sdk/structured-mutations.js +1 -1
  772. package/dist/sdk/telemetry-flush.js +1 -1
  773. package/dist/sdk/telemetry.js +4 -4
  774. package/dist/sdk/templates.js +3 -3
  775. package/dist/sdk/test/batch.js +2 -2
  776. package/dist/sdk/test/command-args.js +1 -1
  777. package/dist/sdk/test/command-resolution.js +2 -2
  778. package/dist/sdk/test/entry.js +2 -2
  779. package/dist/sdk/test/execution-receipts.js +2 -2
  780. package/dist/sdk/test/execution.js +5 -5
  781. package/dist/sdk/test/json-path.js +1 -1
  782. package/dist/sdk/test/linked-command-detection.js +1 -1
  783. package/dist/sdk/test/measurements.js +1 -1
  784. package/dist/sdk/test/parsers.js +1 -1
  785. package/dist/sdk/test/prerequisites.js +1 -1
  786. package/dist/sdk/test/receipt-index-snapshot.js +1 -1
  787. package/dist/sdk/test/run-phases.js +1 -1
  788. package/dist/sdk/test/runs.js +1 -1
  789. package/dist/sdk/test/trust.js +2 -2
  790. package/dist/sdk/test/update.js +1 -1
  791. package/dist/sdk/test/workspace-snapshot.js +1 -1
  792. package/dist/sdk/traceability/runtime-files-lookup.js +1 -1
  793. package/dist/sdk/traceability/source-traceability.js +2 -2
  794. package/dist/sdk/tracker-root-discovery.js +1 -1
  795. package/dist/sdk/transactions/item-finalization.js +2 -0
  796. package/dist/sdk/workspace-contracts-cache.js +1 -1
  797. package/dist/sdk/workspace-contracts.js +1 -1
  798. package/dist/sdk/workspace-memory.js +2 -2
  799. package/dist/sdk/workspace-snapshot.js +5 -5
  800. package/dist/sdk/workspace-transaction-gc.js +1 -1
  801. package/dist/sdk/workspace-transaction.js +2 -2
  802. package/dist/sdk/workspace.js +6 -6
  803. package/dist/types/index.js +1 -1
  804. package/dist/types.d.ts +20 -0
  805. package/dist/types.js +1 -1
  806. package/docs/AGENT_GUIDE.md +1 -1
  807. package/docs/AGENT_RUNTIME_PRIMITIVES.md +1 -1
  808. package/docs/COMMANDS.md +7 -3
  809. package/docs/EXTENSIONS.md +1 -1
  810. package/docs/HISTORY_RECOVERY.md +229 -5
  811. package/docs/README.md +2 -2
  812. package/docs/SDK.md +174 -5
  813. package/docs/SDK_CONTEXT_COORDINATION.md +3 -2
  814. package/marketplace.json +1 -1
  815. package/node_modules/tar/package.json +2 -3
  816. package/package.json +31 -2
  817. package/packages/pm-beads/package.json +1 -1
  818. package/packages/pm-calendar/package.json +1 -1
  819. package/packages/pm-command-kit/package.json +1 -1
  820. package/packages/pm-digital-twin/package.json +1 -1
  821. package/packages/pm-governance-audit/package.json +1 -1
  822. package/packages/pm-guide-shell/package.json +1 -1
  823. package/packages/pm-kanban/package.json +1 -1
  824. package/packages/pm-lifecycle-hooks/package.json +1 -1
  825. package/packages/pm-linked-test-adapters/package.json +1 -1
  826. package/packages/pm-search-advanced/package.json +1 -1
  827. package/packages/pm-templates/package.json +1 -1
  828. package/packages/pm-todos/package.json +1 -1
  829. package/packages/pm-vcs/package.json +1 -1
  830. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  831. package/plugins/pm-claude/package.json +1 -1
  832. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  833. package/plugins/pm-codex/package.json +1 -1
  834. package/plugins/pm-codex/plugin.json +1 -1
  835. package/runtime-dependencies.json +1 -1
  836. package/scripts/finalize-build.mjs +63 -24
  837. package/scripts/prepare-build-cache.mjs +28 -1
  838. package/dist/cli-bundle/chunks/chunk-2DXRTIC6.js +0 -21
  839. package/dist/cli-bundle/chunks/chunk-5647LU3A.js +0 -2287
  840. package/dist/cli-bundle/chunks/chunk-6QLEXRUG.js +0 -9
  841. package/dist/cli-bundle/chunks/chunk-AHQB7W2H.js +0 -3
  842. package/dist/cli-bundle/chunks/chunk-BKSVHOWI.js +0 -2
  843. package/dist/cli-bundle/chunks/chunk-CASX6SFI.js +0 -2
  844. package/dist/cli-bundle/chunks/chunk-CIKGG34F.js +0 -2
  845. package/dist/cli-bundle/chunks/chunk-D6ILFXZY.js +0 -2
  846. package/dist/cli-bundle/chunks/chunk-DEZPZOQ7.js +0 -2
  847. package/dist/cli-bundle/chunks/chunk-IB7UB5TE.js +0 -2
  848. package/dist/cli-bundle/chunks/chunk-IUIOTAF6.js +0 -9
  849. package/dist/cli-bundle/chunks/chunk-JVGRFU5H.js +0 -3
  850. package/dist/cli-bundle/chunks/chunk-KQIZ34SF.js +0 -3
  851. package/dist/cli-bundle/chunks/chunk-KVBIMFUG.js +0 -6
  852. package/dist/cli-bundle/chunks/chunk-LQBWLNZJ.js +0 -3
  853. package/dist/cli-bundle/chunks/chunk-NCFCBKIP.js +0 -2
  854. package/dist/cli-bundle/chunks/chunk-NT5AKFE5.js +0 -31
  855. package/dist/cli-bundle/chunks/chunk-PJXKA4QU.js +0 -125
  856. package/dist/cli-bundle/chunks/chunk-RMIRNYRG.js +0 -71
  857. package/dist/cli-bundle/chunks/chunk-RULHZRFN.js +0 -2
  858. package/dist/cli-bundle/chunks/chunk-S6HB3WL2.js +0 -2
  859. package/dist/cli-bundle/chunks/chunk-SA4BNP3Q.js +0 -2
  860. package/dist/cli-bundle/chunks/chunk-SPPHDVZE.js +0 -2
  861. package/dist/cli-bundle/chunks/chunk-SRVTCYAU.js +0 -2
  862. package/dist/cli-bundle/chunks/chunk-WELSVDPU.js +0 -2
  863. package/dist/cli-bundle/chunks/chunk-XHJ3H5PL.js +0 -3
  864. package/dist/cli-bundle/chunks/chunk-XWHJIRNV.js +0 -8
  865. package/dist/cli-bundle/chunks/chunk-YJEBK7HU.js +0 -8
  866. package/dist/cli-bundle/chunks/chunk-YKJKQ7DM.js +0 -115
  867. package/dist/cli-bundle/chunks/chunk-YMUSRWV4.js +0 -9
  868. package/dist/cli-bundle/chunks/chunk-YR2KEBHP.js +0 -2
  869. package/dist/cli-bundle/chunks/context-budget-recovery-L2WP5S26.js +0 -2
  870. package/dist/cli-bundle/chunks/indexed-receipt-blobs-ITTXIN4K.js +0 -4
  871. package/dist/cli-bundle/chunks/item-transaction-7DFCG73I.js +0 -2
  872. package/dist/cli-bundle/chunks/mutation-actor-3TG636XG.js +0 -2
  873. package/dist/cli-bundle/chunks/mutation-admission-LICSDNNO.js +0 -2
  874. package/dist/cli-bundle/chunks/register-mutation-WWVECKFQ.js +0 -21
  875. package/dist/cli-bundle/chunks/register-operations-L6HFJNWD.js +0 -2
  876. package/dist/cli-bundle/chunks/register-setup-K7UFG5TD.js +0 -2
  877. package/dist/cli-bundle/chunks/settlement-hook-BXN5LEQD.js +0 -7
  878. package/dist/cli-bundle/chunks/stage-57KH3KAC.js +0 -2
  879. package/dist/cli-bundle/focused-chunks/chunk-3IRCYJI5.js +0 -3
  880. package/dist/cli-bundle/focused-chunks/chunk-3V53UBHN.js +0 -9
  881. package/dist/cli-bundle/focused-chunks/chunk-532WZV65.js +0 -2
  882. package/dist/cli-bundle/focused-chunks/chunk-7A4QWNZX.js +0 -8
  883. package/dist/cli-bundle/focused-chunks/chunk-C3O6JJPO.js +0 -2
  884. package/dist/cli-bundle/focused-chunks/chunk-CR7CGEB2.js +0 -3
  885. package/dist/cli-bundle/focused-chunks/chunk-CU2BRAOX.js +0 -2
  886. package/dist/cli-bundle/focused-chunks/chunk-CWWKRI5P.js +0 -2
  887. package/dist/cli-bundle/focused-chunks/chunk-EGN2HFRU.js +0 -2
  888. package/dist/cli-bundle/focused-chunks/chunk-GHQVM6K6.js +0 -2
  889. package/dist/cli-bundle/focused-chunks/chunk-HGFNL5XI.js +0 -2
  890. package/dist/cli-bundle/focused-chunks/chunk-I5LGPUWH.js +0 -2
  891. package/dist/cli-bundle/focused-chunks/chunk-IQK5NPMG.js +0 -13
  892. package/dist/cli-bundle/focused-chunks/chunk-J63D6QST.js +0 -6
  893. package/dist/cli-bundle/focused-chunks/chunk-JMQJBZQ5.js +0 -2
  894. package/dist/cli-bundle/focused-chunks/chunk-LNHUE4VV.js +0 -2
  895. package/dist/cli-bundle/focused-chunks/chunk-MKM5NKD7.js +0 -8
  896. package/dist/cli-bundle/focused-chunks/chunk-NP72ZDXE.js +0 -2
  897. package/dist/cli-bundle/focused-chunks/chunk-OSLQD5VH.js +0 -102
  898. package/dist/cli-bundle/focused-chunks/chunk-QGKLRXP7.js +0 -2
  899. package/dist/cli-bundle/focused-chunks/chunk-QSJW6NSQ.js +0 -66
  900. package/dist/cli-bundle/focused-chunks/chunk-RPE6IX26.js +0 -2
  901. package/dist/cli-bundle/focused-chunks/chunk-SRDQSA6M.js +0 -91
  902. package/dist/cli-bundle/focused-chunks/chunk-SVOOGGAK.js +0 -2
  903. package/dist/cli-bundle/focused-chunks/chunk-UOC6257J.js +0 -26
  904. package/dist/cli-bundle/focused-chunks/chunk-URJ2E6AS.js +0 -3
  905. package/dist/cli-bundle/focused-chunks/chunk-WXMI4AV5.js +0 -8
  906. package/dist/cli-bundle/focused-chunks/chunk-XCJSHNXK.js +0 -27
  907. package/dist/cli-bundle/focused-chunks/chunk-XQQSSKJI.js +0 -44
  908. package/dist/cli-bundle/focused-chunks/chunk-YOAYY3HE.js +0 -2
  909. package/dist/cli-bundle/focused-chunks/context-budget-recovery-5MKOCGY5.js +0 -2
  910. package/dist/cli-bundle/focused-chunks/indexed-receipt-blobs-AF4U3F3D.js +0 -4
  911. package/dist/cli-bundle/focused-chunks/item-transaction-HLBW7B3J.js +0 -2
  912. package/dist/cli-bundle/focused-chunks/mutation-actor-62HKR5IO.js +0 -2
  913. package/dist/cli-bundle/focused-chunks/mutation-admission-X4PF2SG3.js +0 -2
  914. package/dist/cli-bundle/focused-chunks/settlement-hook-ARYCZQY4.js +0 -7
  915. package/dist/cli-bundle/focused-chunks/stage-O7T7CXBB.js +0 -2
  916. package/dist/sdk/agent/refusal-closure.js +0 -2
  917. package/dist/sdk/agent/refusal-reachability.js +0 -4
  918. package/dist/sdk/agent/task-transcript-contracts.js +0 -2
  919. package/dist/sdk/agent/tracker-preflight-contracts.js +0 -2
  920. package/dist/sdk/authoring.js +0 -2
  921. package/dist/sdk/compose.js +0 -2
  922. package/dist/sdk/contracts.js +0 -2
  923. package/dist/sdk/core-governance.js +0 -2
  924. package/dist/sdk/core.js +0 -2
  925. package/dist/sdk/corpus-shape.js +0 -2
  926. package/dist/sdk/define.js +0 -2
  927. package/dist/sdk/environment/agent-environment.js +0 -2
  928. package/dist/sdk/governance/artifact-ledgers.js +0 -2
  929. package/dist/sdk/governance/coverage-assurance.js +0 -2
  930. package/dist/sdk/governance/reliability.js +0 -2
  931. package/dist/sdk/governance.js +0 -2
  932. package/dist/sdk/graph/adapter.js +0 -2
  933. package/dist/sdk/graph/conformance.js +0 -2
  934. package/dist/sdk/graph/index.js +0 -2
  935. package/dist/sdk/graph.js +0 -2
  936. package/dist/sdk/index.js +0 -2
  937. package/dist/sdk/query.js +0 -2
  938. package/dist/sdk/relationship-migration.js +0 -2
  939. package/dist/sdk/testing.js +0 -8
  940. package/dist/sdk/workspace-recipe.js +0 -2
  941. package/docs/AGENT_PROVENANCE_ADR.md +0 -206
  942. package/docs/DEFECT_RECURRENCE.md +0 -257
  943. package/docs/PERFORMANCE.md +0 -204
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1b399abd-460a-55a5-9df2-db23537aac0d")}catch{}})();import{isBoxedPrimitive}from"node:util/types";import{EXIT_CODE}from"./constants.js";import{PmCliError}from"./errors.js";const LONE_SURROGATE_PATTERN=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/gu;function toWellFormedText(value){return value.replaceAll(LONE_SURROGATE_PATTERN,"\uFFFD")}function outputFieldPath(field,key,array){return array&&/^\d+$/u.test(key)?`${field}[${key}]`:/^[A-Za-z_$][\w$]*$/u.test(key)?`${field}.${key}`:`${field}[${JSON.stringify(key)}]`}function findIllFormedOutputText(value,field,seen){if(typeof value=="string"){const index=value.search(LONE_SURROGATE_PATTERN);return index<0?void 0:{field,index}}if(!(value===null||typeof value!="object"||seen.has(value))){seen.add(value);for(const[key,entry]of Object.entries(value)){const child=outputFieldPath(field,key,Array.isArray(value)),malformed=findIllFormedOutputText(key,`${child} (key)`,seen)??findIllFormedOutputText(entry,child,seen);if(malformed)return malformed}}}function snapshotOutputText(value,key,seen){if(value===null||typeof value!="object")return value;if(isBoxedPrimitive(value)||typeof value.toJSON=="function")return JSON.parse(JSON.stringify({[key]:value}))[key];if(seen.has(value))return seen.get(value);const snapshot=Array.isArray(value)?new Array(value.length):{};seen.set(value,snapshot);for(const childKey of Object.keys(value))Object.defineProperty(snapshot,childKey,{value:snapshotOutputText(value[childKey],childKey,seen),enumerable:!0,configurable:!0,writable:!0});return snapshot}function prepareWellFormedOutputText(value){const snapshot=snapshotOutputText(value,"",new WeakMap),malformed=findIllFormedOutputText(snapshot,"$",new WeakSet);return malformed&&throwIllFormedOutputText(malformed),snapshot}function throwIllFormedOutputText(malformed){throw new PmCliError(`Output field ${malformed.field} contains an unpaired surrogate code unit at index ${malformed.index}; structured output requires well-formed Unicode.`,EXIT_CODE.USAGE,{code:"text_unpaired_surrogate",field:malformed.field,required:"Well-formed UTF-16 strings and object keys in both JSON and TOON output.",nextSteps:["Repair the producer's text before returning output; use toWellFormedText from @unbrained/pm-cli/sdk when replacement is intended."]})}function assertWellFormedOutputText(value){prepareWellFormedOutputText(value)}export{assertWellFormedOutputText,prepareWellFormedOutputText,toWellFormedText};
1
+ import{isBoxedPrimitive as c}from"node:util/types";import{EXIT_CODE as p}from"./constants.js";import{PmCliError as m}from"./errors.js";const f=/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/gu;function $(t){return t.replaceAll(f,"\uFFFD")}function O(t,r,e){return e&&/^\d+$/u.test(r)?`${t}[${r}]`:/^[A-Za-z_$][\w$]*$/u.test(r)?`${t}.${r}`:`${t}[${JSON.stringify(r)}]`}function i(t,r,e){if(typeof t=="string"){const n=t.search(f);return n<0?void 0:{field:r,index:n}}if(!(t===null||typeof t!="object"||e.has(t))){e.add(t);for(const[n,o]of Object.entries(t)){const u=O(r,n,Array.isArray(t)),d=i(n,`${u} (key)`,e)??i(o,u,e);if(d)return d}}}function s(t,r,e){if(t===null||typeof t!="object")return t;if(c(t)||typeof t.toJSON=="function")return JSON.parse(JSON.stringify({[r]:t}))[r];if(e.has(t))return e.get(t);const n=Array.isArray(t)?new Array(t.length):{};e.set(t,n);for(const o of Object.keys(t))Object.defineProperty(n,o,{value:s(t[o],o,e),enumerable:!0,configurable:!0,writable:!0});return n}function a(t){const r=s(t,"",new WeakMap),e=i(r,"$",new WeakSet);return e&&F(e),r}function F(t){throw new m(`Output field ${t.field} contains an unpaired surrogate code unit at index ${t.index}; structured output requires well-formed Unicode.`,p.USAGE,{code:"text_unpaired_surrogate",field:t.field,required:"Well-formed UTF-16 strings and object keys in both JSON and TOON output.",nextSteps:["Repair the producer's text before returning output; use toWellFormedText from @unbrained/pm-cli/sdk when replacement is intended."]})}function y(t){a(t)}export{y as assertWellFormedOutputText,a as prepareWellFormedOutputText,$ as toWellFormedText};
2
2
  //# sourceMappingURL=output-unicode.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a797572f-fbc6-5e62-a9b5-5a0bd6ef22b4")}catch{}})();function toNonEmptyString(value){if(typeof value!="string")return null;const normalized=value.trim();return normalized.length>0?normalized:null}function toNonEmptyStringOrUndefined(value){return toNonEmptyString(value)??void 0}function trimTrailingSlashes(value){let end=value.length;for(;end>0&&value.charCodeAt(end-1)===47;)end-=1;return end===value.length?value:value.slice(0,end)}function isFiniteNumberArray(value){return Array.isArray(value)&&value.every(entry=>typeof entry=="number"&&Number.isFinite(entry))}function toErrorMessage(error){if(error instanceof Error){const message=error.message.trim();return message.length>0?message:error.name}return String(error)}function coerceFiniteNumber(value){const parsed=typeof value=="number"?value:typeof value=="string"&&value.trim().length>0?Number(value.trim()):Number.NaN;return Number.isFinite(parsed)?parsed:null}function coercePositiveInteger(value){const parsed=coerceFiniteNumber(value);return parsed===null||parsed<=0||!Number.isInteger(parsed)?null:parsed}function coerceNumberInRange(value,min,max){const parsed=coerceFiniteNumber(value);return parsed===null||parsed<min||parsed>max?null:parsed}function asRecordOrNull(value){return typeof value!="object"||value===null||Array.isArray(value)?null:value}function asRecordLoose(value){return typeof value!="object"||value===null?null:value}function asPropertyRecord(value){return typeof value!="object"&&typeof value!="function"||value===null?null:value}function resolveActivatablePropertyRecord(value){const moduleRecord=asPropertyRecord(value);if(!moduleRecord)return null;if(typeof moduleRecord.activate=="function")return moduleRecord;const defaultExport=asPropertyRecord(moduleRecord.default);return typeof defaultExport?.activate=="function"?defaultExport:null}function asRecordClone(value){return typeof value=="object"&&value!==null&&!Array.isArray(value)?{...value}:{}}export{asPropertyRecord,asRecordClone,asRecordLoose,asRecordOrNull,coerceFiniteNumber,coerceNumberInRange,coercePositiveInteger,isFiniteNumberArray,resolveActivatablePropertyRecord,toErrorMessage,toNonEmptyString,toNonEmptyStringOrUndefined,trimTrailingSlashes};
1
+ function u(t){if(typeof t!="string")return null;const r=t.trim();return r.length>0?r:null}function c(t){return u(t)??void 0}function f(t){let r=t.length;for(;r>0&&t.charCodeAt(r-1)===47;)r-=1;return r===t.length?t:t.slice(0,r)}function s(t){return Array.isArray(t)&&t.every(r=>typeof r=="number"&&Number.isFinite(r))}function l(t){if(t instanceof Error){const r=t.message.trim();return r.length>0?r:t.name}return String(t)}function o(t){const r=typeof t=="number"?t:typeof t=="string"&&t.trim().length>0?Number(t.trim()):Number.NaN;return Number.isFinite(r)?r:null}function p(t){const r=o(t);return r===null||r<=0||!Number.isInteger(r)?null:r}function m(t,r,n){const e=o(t);return e===null||e<r||e>n?null:e}function y(t){return typeof t!="object"||t===null||Array.isArray(t)?null:t}function d(t){return typeof t!="object"||t===null?null:t}function i(t){return typeof t!="object"&&typeof t!="function"||t===null?null:t}function g(t){const r=i(t);if(!r)return null;if(typeof r.activate=="function")return r;const n=i(r.default);return typeof n?.activate=="function"?n:null}function b(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)?{...t}:{}}export{i as asPropertyRecord,b as asRecordClone,d as asRecordLoose,y as asRecordOrNull,o as coerceFiniteNumber,m as coerceNumberInRange,p as coercePositiveInteger,s as isFiniteNumberArray,g as resolveActivatablePropertyRecord,l as toErrorMessage,u as toNonEmptyString,c as toNonEmptyStringOrUndefined,f as trimTrailingSlashes};
2
2
  //# sourceMappingURL=primitives.js.map
@@ -1,3 +1,3 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4b754f64-1bb8-54ef-a214-f1603b1711b8")}catch{}})();import{spawn}from"node:child_process";import{existsSync,readFileSync}from"node:fs";import path from"node:path";const TEARDOWN_HELPER_TIMEOUT_MS=2e3;function descendantEntriesFromProcessTable(table,root){const children=new Map;for(const line of table.split(`
2
- `)){const fields=line.trim().split(/\s+/u);if(fields.length!==2)continue;const[child,parent]=fields.map(Number);if(!Number.isSafeInteger(child)||!Number.isSafeInteger(parent)||child<=0)continue;const siblings=children.get(parent);siblings?siblings.push(child):children.set(parent,[child])}const seen=new Set([root]),descendants=[],pending=(children.get(root)??[]).map(pid=>({pid,parent:root}));for(let index=0;index<pending.length;index+=1){const next=pending[index];if(!seen.has(next.pid)){seen.add(next.pid),descendants.push(next);for(const grandchild of children.get(next.pid)??[])pending.push({pid:grandchild,parent:next.pid})}}return descendants.reverse()}function descendantsFromProcessTable(table,root){return descendantEntriesFromProcessTable(table,root).map(entry=>entry.pid)}function parentStillMatches(entry,readStat=readProcStat){const stat=readStat(`/proc/${entry.pid}/stat`);if(stat===void 0)return!existsSync("/proc/self/stat");const fields=stat.slice(stat.lastIndexOf(")")+1).trim().split(/\s+/u);return Number(fields[1])===entry.parent}function processTableSharesNamespace(readStatus=readProcStat,platform=process.platform){const status=readStatus("/proc/self/status");if(status===void 0)return platform!=="linux"&&!existsSync("/proc/self/status");const nspid=/^NSpid:\s*(.*)$/mu.exec(status)?.[1]?.trim().split(/\s+/u);return nspid?.length===1&&Number(nspid[0])===process.pid}function ancestryStillMatches(pid,root,parentOf,matches=parentStillMatches,verified=new Map){const chain=[];let outcome=!0;for(let current=pid;current!==root;){const known=verified.get(current);if(known!==void 0){outcome=known;break}chain.push(current);const parent=parentOf.get(current);if(parent===void 0||!matches({pid:current,parent})){outcome=!1;break}current=parent}for(const link of chain)verified.set(link,outcome);return outcome}function readProcStat(file){try{return readFileSync(file,"utf8")}catch{return}}const TRUSTED_PS_PATHS=["/bin/ps","/usr/bin/ps"],PS_ENV={PATH:"/usr/bin:/bin",LC_ALL:"C"};function resolveTrustedPs(exists=existsSync){return TRUSTED_PS_PATHS.find(file=>exists(file))}const DEFAULT_WINDOWS_ROOT="C:\\Windows";function resolveWindowsSystemRoot(env=process.env,exists=existsSync){const valueOf=name=>Object.entries(env).find(([key])=>key.toLowerCase()===name)?.[1];return[valueOf("systemroot"),valueOf("windir"),DEFAULT_WINDOWS_ROOT].find(candidate=>typeof candidate=="string"&&/^[A-Za-z]:[\\/]/u.test(candidate)&&exists(path.win32.join(candidate,"System32","taskkill.exe")))}function killProcess(pid){try{process.kill(pid,"SIGKILL")}catch{}}function runTeardownHelper(file,args,env,timeoutMs=TEARDOWN_HELPER_TIMEOUT_MS){return new Promise(resolve=>{let settled=!1,stdout="",helper;try{helper=spawn(file,args,{stdio:["ignore","pipe","ignore"],windowsHide:!0,...env===void 0?{}:{env}})}catch{resolve(void 0);return}const deadline=timeoutMs===null?void 0:setTimeout(()=>{settle(void 0),helper.stdout?.destroy(),helper.kill("SIGKILL"),helper.unref()},timeoutMs);function settle(result){settled||(settled=!0,clearTimeout(deadline),resolve(result))}if(helper.on("error",()=>settle(void 0)),!helper.stdout){settle(void 0);return}helper.stdout.setEncoding("utf8"),helper.stdout.on("data",chunk=>{stdout+=chunk}),helper.on("close",code=>settle({code,stdout}))})}async function killProcessTree(pid,root={kill:()=>killProcess(pid),alive:()=>!0},options={}){if(!(!Number.isInteger(pid)||pid<=0)){if(process.platform==="win32"){await killWindowsTree(pid,root,options.taskkillTimeoutMs===void 0?TEARDOWN_HELPER_TIMEOUT_MS:options.taskkillTimeoutMs);return}try{process.kill(-pid,"SIGKILL");return}catch{}await killPosixDescendants(pid,root),root.kill()}}async function killWindowsTree(pid,root,taskkillTimeoutMs){const systemRoot=resolveWindowsSystemRoot();if(systemRoot===void 0){root.alive()&&root.kill();return}const taskkill=path.win32.join(systemRoot,"System32","taskkill.exe");(await runTeardownHelper(taskkill,["/pid",String(pid),"/T","/F"],void 0,taskkillTimeoutMs))?.code!==0&&root.alive()&&root.kill()}async function killPosixDescendants(pid,root){const ps=resolveTrustedPs();if(ps===void 0||!processTableSharesNamespace())return;const table=await runTeardownHelper(ps,["-A","-o","pid=","-o","ppid="],PS_ENV);if(table?.code!==0||!root.alive())return;const descendants=descendantEntriesFromProcessTable(table.stdout,pid),parentOf=new Map(descendants.map(entry=>[entry.pid,entry.parent])),verified=new Map;for(const descendant of descendants)parentStillMatches(descendant)&&ancestryStillMatches(descendant.parent,pid,parentOf,parentStillMatches,verified)&&killProcess(descendant.pid)}export{ancestryStillMatches,descendantEntriesFromProcessTable,descendantsFromProcessTable,killProcessTree,parentStillMatches,processTableSharesNamespace,resolveTrustedPs,resolveWindowsSystemRoot,runTeardownHelper};
1
+ import{spawn as T}from"node:child_process";import{existsSync as a,readFileSync as g}from"node:fs";import p from"node:path";const m=2e3;function k(t,s){const n=new Map;for(const r of t.split(`
2
+ `)){const e=r.trim().split(/\s+/u);if(e.length!==2)continue;const[l,u]=e.map(Number);if(!Number.isSafeInteger(l)||!Number.isSafeInteger(u)||l<=0)continue;const d=n.get(u);d?d.push(l):n.set(u,[l])}const i=new Set([s]),o=[],c=(n.get(s)??[]).map(r=>({pid:r,parent:s}));for(let r=0;r<c.length;r+=1){const e=c[r];if(!i.has(e.pid)){i.add(e.pid),o.push(e);for(const l of n.get(e.pid)??[])c.push({pid:l,parent:e.pid})}}return o.reverse()}function A(t,s){return k(t,s).map(n=>n.pid)}function f(t,s=w){const n=s(`/proc/${t.pid}/stat`);if(n===void 0)return!a("/proc/self/stat");const i=n.slice(n.lastIndexOf(")")+1).trim().split(/\s+/u);return Number(i[1])===t.parent}function b(t=w,s=process.platform){const n=t("/proc/self/status");if(n===void 0)return s!=="linux"&&!a("/proc/self/status");const i=/^NSpid:\s*(.*)$/mu.exec(n)?.[1]?.trim().split(/\s+/u);return i?.length===1&&Number(i[0])===process.pid}function x(t,s,n,i=f,o=new Map){const c=[];let r=!0;for(let e=t;e!==s;){const l=o.get(e);if(l!==void 0){r=l;break}c.push(e);const u=n.get(e);if(u===void 0||!i({pid:e,parent:u})){r=!1;break}e=u}for(const e of c)o.set(e,r);return r}function w(t){try{return g(t,"utf8")}catch{return}}const y=["/bin/ps","/usr/bin/ps"],P={PATH:"/usr/bin:/bin",LC_ALL:"C"};function I(t=a){return y.find(s=>t(s))}const L="C:\\Windows";function N(t=process.env,s=a){const n=i=>Object.entries(t).find(([o])=>o.toLowerCase()===i)?.[1];return[n("systemroot"),n("windir"),L].find(i=>typeof i=="string"&&/^[A-Za-z]:[\\/]/u.test(i)&&s(p.win32.join(i,"System32","taskkill.exe")))}function S(t){try{process.kill(t,"SIGKILL")}catch{}}function h(t,s,n,i=m){return new Promise(o=>{let c=!1,r="",e;try{e=T(t,s,{stdio:["ignore","pipe","ignore"],windowsHide:!0,...n===void 0?{}:{env:n}})}catch{o(void 0);return}const l=i===null?void 0:setTimeout(()=>{u(void 0),e.stdout?.destroy(),e.kill("SIGKILL"),e.unref()},i);function u(d){c||(c=!0,clearTimeout(l),o(d))}if(e.on("error",()=>u(void 0)),!e.stdout){u(void 0);return}e.stdout.setEncoding("utf8"),e.stdout.on("data",d=>{r+=d}),e.on("close",d=>u({code:d,stdout:r}))})}async function R(t,s={kill:()=>S(t),alive:()=>!0},n={}){if(!(!Number.isInteger(t)||t<=0)){if(process.platform==="win32"){await _(t,s,n.taskkillTimeoutMs===void 0?m:n.taskkillTimeoutMs);return}try{process.kill(-t,"SIGKILL");return}catch{}await E(t,s),s.kill()}}async function _(t,s,n){const i=N();if(i===void 0){s.alive()&&s.kill();return}const o=p.win32.join(i,"System32","taskkill.exe");(await h(o,["/pid",String(t),"/T","/F"],void 0,n))?.code!==0&&s.alive()&&s.kill()}async function E(t,s){const n=I();if(n===void 0||!b())return;const i=await h(n,["-A","-o","pid=","-o","ppid="],P);if(i?.code!==0||!s.alive())return;const o=k(i.stdout,t),c=new Map(o.map(e=>[e.pid,e.parent])),r=new Map;for(const e of o)f(e)&&x(e.parent,t,c,f,r)&&S(e.pid)}export{x as ancestryStillMatches,k as descendantEntriesFromProcessTable,A as descendantsFromProcessTable,R as killProcessTree,f as parentStillMatches,b as processTableSharesNamespace,I as resolveTrustedPs,N as resolveWindowsSystemRoot,h as runTeardownHelper};
3
3
  //# sourceMappingURL=process-tree.js.map
@@ -1,6 +1,6 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a5619fc7-2547-59c9-bfff-4d4cebd14967")}catch{}})();const COMPONENT=`[^\\s/\\\\<>"'\\x60()\\[\\]{},;?=:#*]+`,SEPARATOR="[/\\\\]+",ACCOUNT="[\\p{L}\\p{N}._@-]+",ACCOUNT_PATH=ACCOUNT+"(?:"+SEPARATOR+COMPONENT+")*",ROOT_HOME="(?:(?:home|users)"+SEPARATOR+ACCOUNT_PATH+"|root"+SEPARATOR+ACCOUNT_PATH+")",UNIX_HOME="[/\\\\]"+ROOT_HOME,MULTI_ROOT_HOME="[/\\\\]{2,}"+ROOT_HOME,WINDOWS_HOME="/?[a-z]:"+SEPARATOR+"users"+SEPARATOR+ACCOUNT_PATH,SHARE_COMPONENT=COMPONENT+"(?: +"+COMPONENT+")*",SHARED_PROFILE="(?:"+SHARE_COMPONENT+SEPARATOR+")?users"+SEPARATOR+ACCOUNT_PATH,UNC_HOME="[/\\\\]{2,}"+COMPONENT+SEPARATOR+SHARED_PROFILE,DEVICE_VOLUME="(?:[a-z]:|volume\\{[a-f0-9-]+\\}|"+COMPONENT+")",DEVICE_HOME="[/\\\\]{2}[?.]"+SEPARATOR+"(?:unc"+SEPARATOR+COMPONENT+SEPARATOR+SHARED_PROFILE+"|"+DEVICE_VOLUME+SEPARATOR+"users"+SEPARATOR+ACCOUNT_PATH+")",FILE_HOME="file:(?:"+DEVICE_HOME+"|(?:[/\\\\](?![/\\\\])|[/\\\\]{3,}|[/\\\\]{2}localhost"+SEPARATOR+")(?:"+ROOT_HOME+"|[a-z]:"+SEPARATOR+"users"+SEPARATOR+ACCOUNT_PATH+")|[/\\\\]{2}(?:[a-z]:"+SEPARATOR+"users"+SEPARATOR+ACCOUNT_PATH+"|"+COMPONENT+SEPARATOR+"(?:"+ROOT_HOME+"|"+SHARED_PROFILE+")))",PRIVATE_HOME_PATH_PATTERN=new RegExp("(?:^|[^\\p{L}\\p{N}_./\\\\~])(?:"+UNIX_HOME+"|"+WINDOWS_HOME+"|"+FILE_HOME+")|(?:^|[^\\p{L}\\p{N}_:./\\\\~])(?:"+MULTI_ROOT_HOME+"|"+UNC_HOME+"|"+DEVICE_HOME+")","giu"),MAX_NORMALIZATION_PASSES=4,REMAINING_ENCODING=/%[a-f0-9]{2}|\\(?:u[a-f0-9]{4}|x[a-f0-9]{2}|\/)/iu,utf8=new TextDecoder("utf-8");function percentView(value){return value.replace(/(?:%[a-f0-9]{2})+/giu,run=>utf8.decode(Uint8Array.from(run.matchAll(/%([a-f0-9]{2})/giu),match=>Number.parseInt(match[1],16)))).replace(/%(?![a-f0-9]{2})[a-z0-9]{0,2}/giu,"\uFFFD")}function escapedView(value){return value.replace(/\\+(?:u([a-f0-9]{4})|x([a-f0-9]{2})|(\/))?/giu,(match,unicode,byte,slash)=>{const code=unicode??byte;return code===void 0?slash??match:String.fromCharCode(Number.parseInt(code,16))})}function unicodeView(value){return value.normalize("NFKC").replace(/[\p{Bidi_Control}\u200b-\u200f\u2060-\u206f\ufeff]/gu,"").replace(/[\u2215\u2044]/gu,"/").replace(/[\u043e\u041e]/gu,"o").replace(/[\u0455\u0405]/gu,"s")}function nextNormalizedView(view,steps){for(const[kind,transform]of[["percent_decode",percentView],["json_unescape",escapedView],["unicode_fold",unicodeView]]){const transformed=transform(view);transformed!==view&&!steps.includes(kind)&&steps.push(kind),view=transformed}return view}function*normalizedHomePathMatches(line,regex,detected){let view=line;const steps=[];for(let pass=0;pass<MAX_NORMALIZATION_PASSES;pass+=1){const previous=view;if(view=nextNormalizedView(view,steps),!detected){regex.lastIndex=0;for(const _match of view.matchAll(regex))detected=!0,yield{index:0,normalizations:[...steps]}}if(view===previous)break;pass===MAX_NORMALIZATION_PASSES-1&&REMAINING_ENCODING.test(view)&&(yield{index:0,normalizations:[...steps],normalization_incomplete:!0})}}function*findPrivateHomePathMatches(content,regex){let offset=0;for(const line of content.split(`
2
- `)){regex.lastIndex=0;let rawFound=!1;for(const match of line.matchAll(regex))rawFound=!0,yield{index:offset+match.index};for(const match of normalizedHomePathMatches(line,regex,rawFound))yield{...match,index:offset};offset+=line.length+1}}const PASSWORD_KEYS="password|passphrase",PASSWORD_QUOTED_PIECES=4,PASSWORD_REPEAT_BOUND=4096,maximalRun=characterClass=>`${characterClass}+(?!${characterClass})`,PASSWORD_QUOTED_SPAN=String.raw`'[^'\r\n]*'|"[^"\\\r\n]*(?:\\.[^"\\\r\n]*){0,${PASSWORD_REPEAT_BOUND}}"`,PASSWORD_REFERENCE=String.raw`\$\{(?:${maximalRun(String.raw`[^{}$'"\\\r\n]`)}|\\[^\r\n]|${PASSWORD_QUOTED_SPAN}|\$(?!\{)|\$\{[^{}\r\n]*\}){0,${PASSWORD_REPEAT_BOUND}}\}`+String.raw`|\$\((?:${maximalRun(String.raw`[^()$'"\\\r\n]`)}|\\[^\r\n]|${PASSWORD_QUOTED_SPAN}|\$(?!\()|\$\([^()\r\n]*\)){0,${PASSWORD_REPEAT_BOUND}}\)`,PASSWORD_PIECE=String.raw`${PASSWORD_REFERENCE}|<[^<>\r\n]*>|${maximalRun(String.raw`[A-Za-z0-9!@#%^&*._+\-=]`)}|\$(?![{(])`,PASSWORD_QUOTED=String.raw`"[^"]*"|'[^']*'`,PASSWORD_QUOTED_PIECE=String.raw`(?:"[^"\s]*"|'[^'\s]*')(?:${PASSWORD_PIECE}){0,${PASSWORD_REPEAT_BOUND}}`,PASSWORD_VALUE=new RegExp(String.raw`(?!config\.auth\.password\s*(?:\|\|\s*(?:''|"")|\?\s*unescape\(encodeURIComponent\(config\.auth\.password\)\)\s*:\s*(?:''|""))(?=[ \t]*(?:\/\*(?:[^*]|\*(?!\/))*\*\/[ \t]*)*(?:;|$|\/\/[^\r\n\u2028\u2029]*(?:\r\n)?$)))`+`((?:${PASSWORD_PIECE}){1,${PASSWORD_REPEAT_BOUND}}(?:${PASSWORD_QUOTED_PIECE}){0,${PASSWORD_QUOTED_PIECES}}|(?:${PASSWORD_QUOTED_PIECE}){1,${PASSWORD_QUOTED_PIECES}}|${PASSWORD_QUOTED})`),PASSWORD_MINIMUM_LITERAL_LENGTH=8,HIGH_ENTROPY_KEYS="token|secret|password|passwd|api[_-]?key",CREDENTIAL_KEYS="(?<![a-z0-9_]|[a-z0-9_]-)(?:(?:[a-z0-9]+_)+(?:password|passphrase)|(?:[a-z0-9]+[_-])*(?:secret|token|(?:api|secret|private|access)[_-]?key|client[_-]?secret|passwd|pwd))",EXCLUSION_REPEAT_BOUND=4096,CREDENTIAL_OPEN=String.raw`"(?=[^"\s]{8}[^"\s]*")|'(?=[^'\s]{8}[^'\s]*')|(?!["'])`,CREDENTIAL_PLAIN=String.raw`(?![<[$/]|~\/|\.\.?\/|[A-Za-z][\w+.-]*:\/\/|%[A-Za-z_]\w*%|[A-Za-z]:[\\/]|(?<=")(?:(?:[A-Za-z_]\w*\.){1,${EXCLUSION_REPEAT_BOUND}}[A-Za-z_]\w*|[A-Za-z]+(?:-[A-Za-z]+){0,${EXCLUSION_REPEAT_BOUND}}|(?:[\w.-]+\/){1,${EXCLUSION_REPEAT_BOUND}}[\w.-]+\.[A-Za-z][A-Za-z0-9]{0,4})"|(?<=')(?:(?:[A-Za-z_]\w*\.){1,${EXCLUSION_REPEAT_BOUND}}[A-Za-z_]\w*|[A-Za-z]+(?:-[A-Za-z]+){0,${EXCLUSION_REPEAT_BOUND}}|(?:[\w.-]+\/){1,${EXCLUSION_REPEAT_BOUND}}[\w.-]+\.[A-Za-z][A-Za-z0-9]{0,4})'|(?<!["'])[A-Za-z]+(?:-[A-Za-z]+){0,${EXCLUSION_REPEAT_BOUND}}(?![\w!@#$%^&*.+\-=/~])|(?<!["'])(?:[A-Za-z_]\w*\.){1,${EXCLUSION_REPEAT_BOUND}}[A-Za-z_]\w*(?![\w!@#$%^&*.+\-=/~])|(?<!["'])(?:[\w.-]+\/){1,${EXCLUSION_REPEAT_BOUND}}[\w.-]+\.[A-Za-z][A-Za-z0-9]{0,4}(?=[\s,;)}\]]|$)|(?<!["'])[\w$.]+\()(?:(?<=")[^\s"]{8}[^\s"]*|(?<=')[^\s']{8}[^\s']*|(?<==)[A-Za-z0-9!@#$%^&*._+\-=/~?:|]{8,}|(?<!["'=])[A-Za-z0-9!@#$%^&*._+\-=/~]{8,})`,CREDENTIAL_LITERAL_VALUE=new RegExp(`(?:${CREDENTIAL_OPEN})(${CREDENTIAL_PLAIN})`,"iy"),CREDENTIAL_MINIMUM_LITERAL_LENGTH=8,CREDENTIAL_RUN=String.raw`[A-Za-z0-9!@#%^*._+\-=/~]`,CREDENTIAL_AMPERSAND=String.raw`&(?!&)`,CREDENTIAL_LEADING_LITERAL=64,CREDENTIAL_REFERENCE_SPAN=String.raw`'[^'\s]*'|"[^"\\\s]*(?:\\\S[^"\\\s]*){0,${PASSWORD_REPEAT_BOUND}}"`,CREDENTIAL_REFERENCE=String.raw`\$\{(?:${maximalRun(String.raw`[^{}$'"\\\s]`)}|\\\S|${CREDENTIAL_REFERENCE_SPAN}|\$(?!\{)|\$\{[^{}\s]*\}){0,${PASSWORD_REPEAT_BOUND}}\}`+String.raw`|\$\((?:${maximalRun(String.raw`[^()$'"\\\s]`)}|\\\S|${CREDENTIAL_REFERENCE_SPAN}|\$(?!\()|\$\([^()\s]*\)){0,${PASSWORD_REPEAT_BOUND}}\)`+String.raw`|<[^<>\s]*>|\$[A-Za-z_]\w*(?!\w)`,credentialPiece=run=>String.raw`${CREDENTIAL_REFERENCE}|${maximalRun(run)}|${CREDENTIAL_AMPERSAND}|\$(?![{(A-Za-z_])`,credentialQuotedPiece=run=>String.raw`(?:"[^"\s]*"|'[^'\s]*')(?:${credentialPiece(run)}){0,${PASSWORD_REPEAT_BOUND}}`,credentialReferenced=run=>String.raw`(?:(?:${run}|${CREDENTIAL_AMPERSAND}){1,${CREDENTIAL_LEADING_LITERAL}}(?=[$<]))?(?:${CREDENTIAL_REFERENCE})`+String.raw`(?:${credentialPiece(run)}){0,${PASSWORD_REPEAT_BOUND}}(?:${credentialQuotedPiece(run)}){0,${PASSWORD_QUOTED_PIECES}}`,credentialConcatenated=run=>String.raw`(?:${credentialQuotedPiece(run)}){1,${PASSWORD_QUOTED_PIECES}}`,credentialUnquoted=build=>String.raw`(?<!["'])(?:${build(CREDENTIAL_RUN)})`,CREDENTIAL_CONCATENATION_CONTINUES=String.raw`(?:[\w@#~]|!(?![.+\-*/%=^!(]))`,CREDENTIAL_CONCATENATION_OPEN=String.raw`(?=(?:"[^"\s]*"|'[^'\s]*')[$<"']`+String.raw`|"(?=[^"\s]*[$<])[^"\s]*"${CREDENTIAL_CONCATENATION_CONTINUES}|'(?=[^'\s]*[$<])[^'\s]*'${CREDENTIAL_CONCATENATION_CONTINUES})`,CREDENTIAL_QUOTED_REFERENCED=String.raw`(?<=")(?=[^"\s]*[$<])[^"\s]+|(?<=')(?=[^'\s]*[$<])[^'\s]+`,CREDENTIAL_VALUE=new RegExp(`(?:${CREDENTIAL_CONCATENATION_OPEN}|${CREDENTIAL_OPEN})((?=["'])(?:${credentialUnquoted(credentialConcatenated)})|${CREDENTIAL_QUOTED_REFERENCED}|${credentialUnquoted(credentialReferenced)}|${CREDENTIAL_PLAIN})`),HIGH_ENTROPY_VALUE=/["']?([A-Za-z0-9+/=_-]{24,})/,SECRET_RULES=[{name:"private-key",mutationRule:"private_key",category:"credential",regex:/-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----/g},{name:"github-token",mutationRule:"github_token",category:"credential",regex:/\b(?:gh[opsru]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/g},{name:"npm-token",mutationRule:"npm_token",category:"credential",regex:/\bnpm_[A-Za-z0-9]{20,}\b/g},{name:"aws-access-key",mutationRule:"aws_access_key",category:"credential",regex:/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g},{name:"google-api-key",mutationRule:"google_api_key",category:"credential",regex:/\bAIza[0-9A-Za-z_-]{35}\b/g},{name:"slack-token",mutationRule:"slack_token",category:"credential",regex:/\bxox[baprs]-[A-Za-z0-9-]{10,}\b/g},{name:"anthropic-api-key",mutationRule:"anthropic_api_key",category:"credential",regex:/\bsk-ant-[A-Za-z0-9_-]{20,}\b/g},{name:"openai-api-key",mutationRule:"openai_api_key",category:"credential",regex:/\bsk-(?!ant-)[A-Za-z0-9_-]{20,}\b/g},{name:"gitlab-token",mutationRule:"gitlab_token",category:"credential",regex:/\bglpat-[A-Za-z0-9_.-]{20,}\b/g},{name:"jwt-like-token",mutationRule:"jwt_like_token",category:"credential",regex:/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g},{name:"npm-auth-token-assignment",mutationRule:"npm_auth_token_assignment",category:"credential",regex:/_authToken\s*=\s*\S+/g},{name:"sentry-user-token",mutationRule:"sentry_user_token",category:"credential",regex:/\bsntryu_[A-Za-z0-9]{20,}\b/g},{name:"sentry-org-token",mutationRule:"sentry_org_token",category:"credential",regex:/\bsntrys_[A-Za-z0-9_-]{20,}\b/g},{name:"private-ip",mutationRule:"private_ip",category:"network",regex:/\b(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g},{name:"private-ssh-target",mutationRule:"private_ssh_target",category:"network",regex:/\b(?:ssh|scp|rsync)\s+[A-Za-z0-9._-]+@(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g},{name:"sshpass-inline-password",mutationRule:"sshpass_inline_password",category:"credential",regex:/\bsshpass\s+-p\s+["'][^"']{6,}["']/g},{name:"password-assignment",mutationRule:"password_assignment",category:"credential",regex:new RegExp(String.raw`\b(?:${PASSWORD_KEYS})\s*[:=]\s*`+PASSWORD_VALUE.source,"gi"),structured:{keys:PASSWORD_KEYS,value:PASSWORD_VALUE.source,element:!0},minimumLiteralLength:PASSWORD_MINIMUM_LITERAL_LENGTH},{name:"absolute-home-path",mutationRule:"absolute_home_path",category:"path",regex:PRIVATE_HOME_PATH_PATTERN,excludeFiles:/^(?:tests\/|examples\/)/},{name:"user-at-private-host",mutationRule:"user_at_private_host",category:"network",regex:/(?<![A-Za-z0-9._-])[A-Za-z0-9._-]+@(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g,excludeFiles:/^(?:tests\/|examples\/)/},{name:"high-entropy-assignment",mutationRule:"high_entropy_assignment",category:"credential",regex:new RegExp(String.raw`\b(?:${HIGH_ENTROPY_KEYS})\s*[:=]\s*`+HIGH_ENTROPY_VALUE.source,"gi"),structured:{keys:HIGH_ENTROPY_KEYS,value:HIGH_ENTROPY_VALUE.source},mutationOnlyReason:"Generic assignments in source code are not credentials; preserve the existing mutation heuristic without treating source identifiers as secrets.",minimumEntropy:3.5},{name:"credential-key-assignment",mutationRule:"credential_key_assignment",category:"credential",regex:new RegExp(String.raw`\b(?:${CREDENTIAL_KEYS})\s*[:=]\s*`+CREDENTIAL_VALUE.source,"gi"),structured:{keys:CREDENTIAL_KEYS,value:CREDENTIAL_VALUE.source,element:!0,elementValue:!0},mutationOnlyReason:"Key-named assignments in source code and test fixtures are identifiers and synthetic data; repository scans keep the token-format rules, which recognize real credentials there.",minimumEntropy:3,minimumLiteralLength:CREDENTIAL_MINIMUM_LITERAL_LENGTH,literalValue:CREDENTIAL_LITERAL_VALUE,baseline:{regex:new RegExp(String.raw`\b(?:${CREDENTIAL_KEYS})\s*[:=]\s*`+CREDENTIAL_LITERAL_VALUE.source,"gi"),value:CREDENTIAL_LITERAL_VALUE.source},rejectValue:/^(?:[\w.-]+\/)*id_(?:rsa|dsa|ecdsa|ed25519)(?:_sk)?(?:\.pub)?$/u,rejectStatementReference:/^[A-Z]+(?:_[A-Z]+)+$/u}];function*findSecretRuleMatches(rule,content){if(rule.mutationRule==="absolute_home_path"){yield*findPrivateHomePathMatches(content,rule.regex);return}for(const reading of ruleReadings(rule))yield*flatMatches(reading,content),reading.structured&&(yield*findStructuredSpellingMatches(reading,reading.structured,content))}const baselineRules=new WeakMap;function ruleReadings(rule){const baseline=rule.baseline;if(baseline===void 0)return[rule];let judged=baselineRules.get(rule);return judged===void 0&&(judged={...rule,regex:baseline.regex,minimumLiteralLength:void 0,literalValue:void 0,baseline:void 0},rule.structured&&(judged.structured={...rule.structured,value:baseline.value}),baselineRules.set(rule,judged)),[rule,judged]}function isParameterName(content,index){const name=content[index-1]==="#"||content[index-1]==="!"?index-1:index;return content[name-1]==="{"&&content[name-2]==="$"}const INNER_SHELL_MATCHES=new WeakSet,INNER_CLOSE_AT=new WeakMap,CUT_REFERENCE_BOUND=4096;function referenceSpans(content,offset,text){const spans=[],open=[],end=offset+text.length;return walkReferences(content,offset,end,open,spans),walkReferences(content,end,Math.min(content.length,end+CUT_REFERENCE_BOUND),open),spans}function walkReferences(content,start,end,open,spans){for(let index=start;index<end&&(spans!==void 0||open.length>0);index+=1){const frame=open.at(-1);if(content[index]==="$"&&(content[index+1]==="{"||content[index+1]==="(")&&frame?.quoted!=="'"){const span={open:index,close:end,command:content[index+1]==="(",quoted:[]};spans?.push(span),open.push({span,closer:content[index+1]==="{"?"}":")"}),index+=1}else frame!==void 0&&(index=referenceStep(content,index,open))}}function referenceStep(text,index,open){const frame=open.at(-1),character=text[index];return character==="\\"&&frame.quoted!=="'"?index+1:(frame.quoted!==void 0?character===frame.quoted&&(frame.span.quoted.push([frame.quoteStart,index]),frame.quoted=void 0):character==="'"||character==='"'?(frame.quoted=character,frame.quoteStart=index):character===frame.closer&&(open.pop().span.close=index),index)}function enclosingCloser(spans){const active=[];let next=0;return position=>{for(;next<spans.length&&spans[next].open<position;next+=1){for(;active.length>0&&active.at(-1).close<spans[next].open;)active.pop();active.push(spans[next])}for(;active.length>0&&active.at(-1).close<position;)active.pop();return active.at(-1)}}function insideQuotedRange(span,position){let low=0,high=span.quoted.length-1;for(;low<=high;){const middle=low+high>>1,[start,end]=span.quoted[middle];if(position<start)high=middle-1;else if(position>end)low=middle+1;else return!0}return!1}const VALUE_REFERENCE=/\$[({A-Za-z_]|</u;function*flatMatches(rule,content){const regex=rule.regex;regex.lastIndex=0;const rescan=rescanDepth(rule);let inner;for(const match of content.matchAll(regex))acceptsSecretMatch(rule,match)?yield{index:match.index}:rescan!==void 0&&VALUE_REFERENCE.test(match[1])&&(inner??=new RegExp(regex),yield*keysInsideRejectedValue(rule,inner,content,match,rescan==="deep"))}function rescanDepth(rule){return rule.minimumLiteralLength===void 0?void 0:rule.minimumEntropy===void 0&&rule.literalValue===void 0&&rule.rejectValue===void 0?"deep":"shallow"}function*keysInsideRejectedValue(rule,inner,content,match,deep){const end=match.index+match[0].length;inner.lastIndex=end-match[1].length;let closerAt;for(let found=inner.exec(content);found!==null&&found.index<end;found=inner.exec(content)){if(isParameterName(content,found.index)){inner.lastIndex=found.index+1;continue}closerAt??=enclosingCloser(referenceSpans(content,end-match[1].length,match[1]));const span=closerAt(found.index);span!==void 0&&(INNER_CLOSE_AT.set(found,span.close),span.command&&!insideQuotedRange(span,found.index)&&INNER_SHELL_MATCHES.add(found)),acceptsSecretMatch(rule,found)?yield{index:found.index}:deep&&VALUE_REFERENCE.test(found[1])&&(inner.lastIndex=found.index+found[0].length-found[1].length)}}const compiledSpellings=new Map,LINE_BREAK=/[\r\n\u2028\u2029]/u;function compileSpelling(spelling){const cacheKey=`${spelling.keys}\0${spelling.value}\0${spelling.element===!0}`;let compiled=compiledSpellings.get(cacheKey);return compiled||(compiled={key:new RegExp(String.raw`\b(?:${spelling.keys})(["']?)\s*[:=]\s*`,"gi"),value:new RegExp(spelling.value,"iyd"),...spelling.element?{element:{open:new RegExp(String.raw`<(?:${spelling.keys})(?:\s[^<>]*)?>`,"gi"),close:new RegExp(String.raw`<\/(?:${spelling.keys})\s*>`,"iy"),span:new RegExp(String.raw`<(?!\/?(?:${spelling.keys})\b)[^<>]*>`,"iy")}}:{}},compiledSpellings.set(cacheKey,compiled)),compiled}function scanQuoted(content,start){const quote=content[start];for(let index=start+1;index<content.length;index+=1){const character=content[index];if(character==="\\")index+=1;else if(character===quote)return{end:index+1,terminated:!0}}return{end:content.length,terminated:!1}}function endOfQuoted(content,start){return scanQuoted(content,start).end}function judgeFor(closers,accepts,acceptsMember){return closers.at(-1)==="}"?acceptsMember:accepts}function walkContainer(content,start,accepts,acceptsMember=accepts){const closers=[];let expectKey=!1;for(let index=start;index<content.length;index+=1){const character=content[index];switch(character){case"[":case"{":closers.push(character==="["?"]":"}"),expectKey=character==="{";break;case"]":case"}":if(closers.pop()!==character||closers.length===0)return{found:!1,end:index+1};expectKey=!1;break;case",":expectKey=closers.at(-1)==="}";break;case":":expectKey=!1;break;case'"':case"'":if(!expectKey&&judgeFor(closers,accepts,acceptsMember)(index))return{found:!0,end:index};index=endOfQuoted(content,index)-1;break;default:break}}return{found:!1,end:content.length}}const ESCAPE_SEQUENCE=/\\(?:U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{2}|[0-7]{1,3}|[\s\S])/gu,SIMPLE_ESCAPES={n:`
3
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"};function decodeQuotedLiteral(literal,terminated){const quote=literal[0],body=literal.slice(1,terminated?-1:void 0).replaceAll(ESCAPE_SEQUENCE,sequence=>{const kind=sequence[1];if((kind==="u"||kind==="x")&&sequence.length>2)return String.fromCharCode(Number.parseInt(sequence.slice(2),16));if(/^[0-7]$/u.test(kind))return String.fromCharCode(Number.parseInt(sequence.slice(1),8));if(kind==="U"&&sequence.length===10){const codePoint=Number.parseInt(sequence.slice(2),16);return codePoint<=1114111?String.fromCodePoint(codePoint):"\uFFFD"}return SIMPLE_ESCAPES[kind]??kind}),neutral=body.replaceAll(quote,quote==='"'?"'":'"').replaceAll(/[\r\n\u2028\u2029]/gu," "),close=terminated?quote:"";return{reading:`${quote}${neutral}${close}`,...literalBody(`${quote}${body}${close}`,terminated)}}function literalBody(original,terminated){return{original,bodyStart:1,bodyEnd:original.length-(terminated?1:0)}}const MAX_KEY_PREFIX=64;function keyShape(content,index,quote){const previous=content[index-1];if(!quote)return previous!==void 0&&/[\p{L}\p{N}_.-]/u.test(previous)?"prefixed":"exact";if(previous===quote)return"exact";const floor=Math.max(0,index-MAX_KEY_PREFIX);for(let cursor=index-1;cursor>=floor;cursor-=1){const character=content[cursor];if(character===quote)return"prefixed";if(character===`
4
- `||character==="\r"||character==='"'||character==="'")return"malformed"}return"malformed"}function createValueJudge(rule,value,content,alwaysDecode=!1){const valueMatch=(text,at,decoded)=>{value.lastIndex=at;const match=value.exec(text);if(match===null||LINE_BREAK.test(match[0]))return null;const span=match.indices?.[1];return decoded!==void 0&&span!==void 0&&(match[1]=decoded.original.slice(Math.max(span[0],decoded.bodyStart),Math.min(span[1],decoded.bodyEnd)),DECODED_DATA_MATCHES.add(match)),acceptsSecretMatch(rule,match)?match:null},escapedMatches=at=>{if(content[at]!=='"'&&content[at]!=="'")return;const{end,terminated}=scanQuoted(content,at),literal=content.slice(at,end);if(!alwaysDecode&&!literal.includes("\\"))return;if(LINE_BREAK.test(literal))return[];const decoded=decodeQuotedLiteral(literal,terminated);return(content[at]==="'"?[decoded,{reading:literal,...literalBody(literal,terminated)}]:[decoded]).map(reading=>valueMatch(reading.reading,0,reading)).filter(match=>match!==null)},valuesAt=at=>{const escaped=escapedMatches(at);if(escaped!==void 0)return escaped;const match=valueMatch(content,at);return match===null?[]:[match]};return{direct:at=>valueMatch(content,at)!==null,escaped:at=>(escapedMatches(at)?.length??0)>0,accepts:compact=>at=>valuesAt(at).some(match=>!(compact&&/\s/u.test(compactReading(rule,match))))}}function compactReading(rule,match){return rule.minimumLiteralLength===void 0?match[0]:judgedLiteral(match)}const DECODED_DATA_MATCHES=new WeakSet;function judgedLiteral(match){const word=INNER_SHELL_MATCHES.has(match)&&!isQuote(captureOpener(match))?shellWordPrefix(match[1]):void 0,text=word??match[1],variables=word!==void 0||wordComplete(match);return DECODED_DATA_MATCHES.has(match)||isQuote(captureOpener(match))?expandRuntimeReferences(text,variables):literalAfterReferences(text,variables)}function shellWordPrefix(text){for(let index=0;index<text.length;index+=1){const character=text[index];if(character==="'"||character==='"')index=quotedSpanEnd(text,index);else if(character==="$"&&(text[index+1]==="{"||text[index+1]==="("))index=Math.max(index,referenceEnd(text,index)-1);else if(/[|&;<>]/u.test(character))return text.slice(0,index)}}const STRUCTURE_RUN=/^[;,)}\]]{0,64}/u;function wordComplete(match){const input=match.input,end=match.index+match[0].length,closed=isQuote(captureOpener(match))&&isQuote(input[end])?end+1:isQuote(match[0].at(-1))?end:-1,start=closed===-1?end:closed,structure=STRUCTURE_RUN.exec(input.slice(start,start+WORD_END_BOUND))[0].length,after=start+structure;if(after===input.length||/\s/u.test(input[after])||INNER_CLOSE_AT.get(match)===start||INNER_SHELL_MATCHES.has(match)&&/[|&;<>]/u.test(input[start]))return!0;if(closed===-1||structure===0)return!1;const context=structuredContext(match,closed===end+1),next=input.slice(after,after+40),closedContainer=/[}\]]/u.test(input.slice(start,after));return context!==void 0&&(NEXT_MEMBER.test(next)||(context==="element"||closedContainer)&&BARE_SCALAR_MEMBER.test(next))}function structuredContext(match,openerOutsideCapture){const input=match.input,valueStart=match.index+match[0].length-match[1].length-(openerOutsideCapture?1:0),before=input.slice(Math.max(0,valueStart-STRUCTURED_LOOK_BACK),valueStart);return ARRAY_ELEMENT_BEFORE.test(before)?"element":QUOTED_KEY_BEFORE.test(before)?"key":void 0}const STRUCTURED_LOOK_BACK=512,QUOTED_KEY_BEFORE=/[{,]\s*(["'])[^"'\r\n]{1,256}\1\s*[:=]\s*$/u,ARRAY_ELEMENT_BEFORE=/[[,]\s*$/u,NEXT_MEMBER=/^(?:["'`]|[{[](?:[\s"'`{[\]}]|$|(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)[\s,\]}]))/u,BARE_SCALAR_MEMBER=/^(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)[\s,\]}]/u,WORD_END_BOUND=64,CALL_AFTER=/^\s{0,16}\(/u,ASSIGNED_BEFORE=/(?<![=!<>])=[ \t]{0,16}$/u;function captureOpener(match){return match.input[match.index+match[0].length-match[1].length-1]}function isQuote(character){return character==='"'||character==="'"}const SPELLING_SENSITIVE=/[$<"']/u;function isCodeAfterReference(match){if(DECODED_DATA_MATCHES.has(match)||isQuote(captureOpener(match))||!/^[$<]/u.test(match[1]))return!1;const end=match.index+match[0].length,valueStart=end-match[1].length,after=match.input.slice(end,end+18);if(match[1][0]==="<"&&(isTypeAssertion(match[1])||ASSIGNED_BEFORE.test(match.input.slice(Math.max(0,valueStart-18),valueStart))||EXPRESSION_AFTER.test(after)))return!0;const lead=leadingReferencesEnd(match[1]),operator=match[1][lead]==="!"?match[1][lead+1]:match[1][lead];return CODE_OPERATOR.test(operator??"")||CALL_AFTER.test(after)}function leadingReferencesEnd(text){let index=0;for(let next=referenceEnd(text,index);next!==-1;next=referenceEnd(text,index))index=next;return index}function referenceEnd(text,start){const opener=text[start];if(opener==="<")return angleSpanEnd(text,start);if(opener!=="$")return-1;const bracket=text[start+1];if(bracket==="{"||bracket==="(")return bracketedEnd(text,start+1,bracket);VARIABLE_REFERENCE.lastIndex=start;const variable=VARIABLE_REFERENCE.exec(text)?.[0];return variable===void 0?-1:start+variable.length}function angleSpanEnd(text,start){const close=text.indexOf(">",start+1),reopen=text.indexOf("<",start+1);return close!==-1&&(reopen===-1||close<reopen)?close+1:-1}function bracketedEnd(text,start,bracket){const closer=bracket==="{"?"}":")";let depth=0;for(let index=start;index<text.length;index+=1){const character=text[index];if(character==="\\")index+=1;else if(character==="'"||character==='"')index=quotedSpanEnd(text,index);else if(character===bracket)depth+=1;else if(character===closer&&--depth===0)return index+1}return-1}function quotedSpanEnd(text,start){const quote=text[start];for(let index=start+1;index<text.length;index+=1){if(text[index]===quote)return index;quote==='"'&&text[index]==="\\"&&(index+=1)}return text.length}const TYPE_TEXT=/^[\w$.[\]|&,{}:;?]+$/u,LITERAL_TYPE=/^(?:"[^"]*"|'[^']*'|-?\d+(?:\.\d+)?)(?:\|(?:"[^"]*"|'[^']*'|-?\d+(?:\.\d+)?|[A-Za-z_$][\w$.]*))*$/u,PRIMITIVE_TYPE=/\b(?:string|number|boolean|bigint|symbol|any|unknown|object|never|void|undefined|null)\b/u;function isTypeAssertion(value){const type=value.slice(1,value.indexOf(">"));return LITERAL_TYPE.test(type)?!0:TYPE_TEXT.test(type)?PRIMITIVE_TYPE.test(type)||/[.|&[{]/u.test(type)||/^[A-Z][\w$]*$/u.test(type)&&(type.length===1||/[a-z]/u.test(type)):!1}const CODE_OPERATOR=/[.+\-*/%=^&]/u,EXPRESSION_AFTER=/^\s{0,16}(?:\?\.|\?\?|\|\||&&|[([])/u;function literalMatches(grammar,literal,code){if(code)return!1;const body=literal.replaceAll('"',"'");return grammar.lastIndex=0,grammar.exec(`"${body}"`)?.[1]===body}function structuredKeyShape(rule,name){if(!rule.structured)return;const content=`${JSON.stringify(name)}:`,key=compileSpelling(rule.structured).key;key.lastIndex=0;for(let match=key.exec(content);match;match=key.exec(content)){if(match.index+match[0].length!==content.length)continue;const shape=keyShape(content,match.index,match[1]);if(shape!=="malformed")return shape}}function acceptsStructuredValue(rule,value,compact){if(!rule.structured)return!1;const content=JSON.stringify(value).replaceAll("\u2028","\\u2028").replaceAll("\u2029","\\u2029");return ruleReadings(rule).some(reading=>createValueJudge(reading,compileSpelling(reading.structured).value,content,!0).accepts(compact)(0))}function*elementMatches(element,content,judge){const open=new RegExp(element.open);for(let match=open.exec(content);match;match=open.exec(content)){const bodyStart=match.index+match[0].length,body=elementBodyEnd(element,content,bodyStart);if(body===void 0){open.lastIndex=match.index+1;continue}judge(content.slice(bodyStart,body.start).trim())&&(yield{index:match.index}),open.lastIndex=body.end}}function elementBodyEnd(element,content,start){for(let index=content.indexOf("<",start);index!==-1;){element.close.lastIndex=index;const close=element.close.exec(content);if(close!==null)return{start:index,end:index+close[0].length};element.span.lastIndex=index;const span=element.span.exec(content);if(span===null)return;index=content.indexOf("<",index+span[0].length)}}function alreadyWalked(walkedEnd,valueStart,compact){return valueStart<walkedEnd.exact||compact&&valueStart<walkedEnd.compact}function scalarFinds(judge,accepts,quote,valueStart){return(quote||judge.escaped(valueStart)&&!judge.direct(valueStart))&&accepts(valueStart)}function*findStructuredSpellingMatches(rule,spelling,content){const compiled=compileSpelling(spelling),judge=createValueJudge(rule,compiled.value,content),key=new RegExp(compiled.key),walkedEnd={exact:0,compact:0};for(let match=key.exec(content);match;match=key.exec(content)){const quote=match[1],shape=keyShape(content,match.index,quote);if(shape==="malformed")continue;const compact=shape==="prefixed",accepts=judge.accepts(compact),valueStart=match.index+match[0].length,opener=content[valueStart];if(opener==="["||opener==="{"){if(alreadyWalked(walkedEnd,valueStart,compact))continue;const walked=walkContainer(content,valueStart,accepts,judge.accepts(!0));walkedEnd[compact?"compact":"exact"]=walked.end,walked.found&&(yield{index:match.index})}else scalarFinds(judge,accepts,quote,valueStart)&&(yield{index:match.index})}compiled.element&&(yield*elementMatches(compiled.element,content,elementValueJudge(rule,spelling,compiled)))}const DEFAULT_ELEMENT_LITERAL_LENGTH=8;function elementValueJudge(rule,spelling,compiled){if(!spelling.elementValue){const minimum=rule.minimumLiteralLength??DEFAULT_ELEMENT_LITERAL_LENGTH;return value=>expandRuntimeReferences(value).length>=minimum}return value=>{const neutral=value.replaceAll('"',"'");compiled.value.lastIndex=0;const match=compiled.value.exec(`"${neutral}"`);return match===null||match[1]!==neutral?!1:(match[1]=value,acceptsSecretMatch(rule,match))}}function isStatementReference(shape,match,value){const end=match.index+match[0].length;return/^[ \t]*;/u.test(match.input.slice(end,end+64))&&!isQuote(captureOpener(match))&&shape.test(value)}function indexOfAngleClose(text,start){for(let index=start+1;index<text.length;index+=1){if(text[index]===">")return index;if(text[index]==="<")return-1}return-1}function appendText(frame,text){frame.raw+=text,frame.literal+=text}function openReference(text,index,frames){const next=text[index+1];if(text[index]!=="$"||next!=="{"&&next!=="(")return-1;const prefix=next==="{"?text.slice(index+2,index+2+defaultedPrefixLength(text,index+2)):"",root=frames[0],opensPiece=frames.length===1&&root.quote!==void 0&&root.literal.length===root.pieceStart;return frames.push({close:next==="{"?"}":")",keep:prefix!=="",raw:`$${next}${prefix}`,literal:"",opensPiece}),index+2+prefix.length}const NAME_START=/[A-Za-z_]/u,NAME_PART=/\w/u,REFERENCE_AFTER_DOLLAR=/[{(A-Za-z_]/u,VARIABLE_REFERENCE=/\$[A-Za-z_]\w*/y,CONSTANT_NAME=/^_*[A-Z][A-Z0-9_]*$/u,BARE_VARIABLE=/^\$[A-Za-z_]\w*$/u,QUOTED_BARE_VARIABLE=/^(["'])\$[A-Za-z_]\w*\1$/u;function variableStep(text,index,frame){VARIABLE_REFERENCE.lastIndex=index;const variable=VARIABLE_REFERENCE.exec(text)?.[0];return variable===void 0?-1:(frame.literal===""&&CONSTANT_NAME.test(variable.slice(1))?frame.raw+=variable:appendText(frame,variable),index+variable.length)}function defaultedPrefixLength(text,start){if(!NAME_START.test(text[start]??""))return 0;let index=start+1;for(;index<text.length&&NAME_PART.test(text[index]);)index+=1;text[index]===":"&&(index+=1);const operator=text[index];return operator==="-"||operator==="="||operator==="+"?index+1-start:0}function closeReference(frames,character){const frame=frames.pop(),parent=frames.at(-1);parent.raw+=`${frame.raw}${character}`,frame.keep&&(parent.literal+=frame.literal)}const PLAIN_RUN=/[^$<"'\\})]+/y,DOUBLE_QUOTE_ESCAPABLE='$`"\\\n';function escapedContribution(next,quote){return next===`
5
- `?"":quote==='"'&&!DOUBLE_QUOTE_ESCAPABLE.includes(next)?`\\${next}`:next}function quotedStep(text,index,frame){const character=text[index],quote=frame.quote;if(quote==='"'&&character==="$"&&REFERENCE_AFTER_DOLLAR.test(text[index+1]??""))return-1;let length=1,contributed=character;if(character==="\\"&&quote!=="'"&&index+1<text.length)length=2,contributed=escapedContribution(text[index+1],quote);else if(quote===void 0){if(character!=='"'&&character!=="'")return-1;frame.quote=character,contributed=""}else character===quote&&(frame.quote=void 0,contributed="");return frame.raw+=text.slice(index,index+length),frame.keep&&(frame.literal+=contributed),index+length}function expandStep(text,index,frames,rootQuotesAreSyntax,variables){const innermost=frames.at(-1);PLAIN_RUN.lastIndex=index;const run=PLAIN_RUN.exec(text)?.[0];if(run!==void 0)return appendText(innermost,run),index+run.length;if(frames.length>1){const quoted=quotedStep(text,index,innermost);if(quoted!==-1)return quoted}else if(rootQuotesAreSyntax&&rootQuoteStep(text[index],innermost))return index+1;const opened=openReference(text,index,frames);if(opened!==-1)return opened;const top=frames.at(-1),character=text[index],variable=variables&&character==="$"?variableStep(text,index,top):-1;if(variable!==-1)return variable;if(frames.length>1&&character===top.close)return closeReference(frames,character),index+1;const angleClose=character==="<"?indexOfAngleClose(text,index):-1;return angleClose!==-1?(top.raw+=text.slice(index,angleClose+1),angleClose+1):(appendText(top,character),index+1)}function rootQuoteStep(character,root){return character!=='"'&&character!=="'"?!1:root.quote===void 0?(root.quote=character,root.pieceStart=root.literal.length,!0):character!==root.quote?!1:(root.quote=void 0,!0)}function expandWords(text,rootQuotesAreSyntax,variables){if(variables&&(BARE_VARIABLE.test(text)||rootQuotesAreSyntax&&QUOTED_BARE_VARIABLE.test(text)))return"";const root={close:"}",keep:!0,raw:"",literal:""},frames=[root];for(let index=0;index<text.length;)index=expandStep(text,index,frames,rootQuotesAreSyntax,variables);for(let depth=frames.length-1;depth>0;depth-=1){const frame=frames[depth],parent=frames[depth-1];parent.raw+=frame.raw,rootQuotesAreSyntax&&depth===1&&frame.opensPiece===!0||(parent.literal+=frame.raw)}return root.literal}function expandRuntimeReferences(text,variables=!0){return expandWords(text,!1,variables)}function literalAfterReferences(value,variables=!0){return expandWords(value,!0,variables)}function acceptsSecretMatch(rule,match){const value=rule.minimumLiteralLength===void 0?match[1]:judgedLiteral(match);if(rule.minimumLiteralLength!==void 0&&value.length<rule.minimumLiteralLength||rule.literalValue&&SPELLING_SENSITIVE.test(match[1])&&!literalMatches(rule.literalValue,value,isCodeAfterReference(match))||rule.rejectValue?.test(value)===!0||rule.rejectStatementReference&&isStatementReference(rule.rejectStatementReference,match,value))return!1;if(rule.minimumEntropy===void 0)return!0;const characters=[...value],counts=new Map;for(const character of characters)counts.set(character,(counts.get(character)??0)+1);let entropy=0;for(const count of counts.values()){const probability=count/characters.length;entropy-=probability*Math.log2(probability)}return entropy>=rule.minimumEntropy}const _testOnly={leadingReferencesEnd};export{PRIVATE_HOME_PATH_PATTERN,SECRET_RULES,_testOnly,acceptsSecretMatch,acceptsStructuredValue,expandRuntimeReferences,findPrivateHomePathMatches,findSecretRuleMatches,literalAfterReferences,structuredKeyShape};
1
+ const A=`[^\\s/\\\\<>"'\\x60()\\[\\]{},;?=:#*]+`,d="[/\\\\]+",Ae="[\\p{L}\\p{N}._@-]+",R=Ae+"(?:"+d+A+")*",w="(?:(?:home|users)"+d+R+"|root"+d+R+")",Re="[/\\\\]"+w,$e="[/\\\\]{2,}"+w,me="/?[a-z]:"+d+"users"+d+R,he=A+"(?: +"+A+")*",x="(?:"+he+d+")?users"+d+R,we="[/\\\\]{2,}"+A+d+x,Se="(?:[a-z]:|volume\\{[a-f0-9-]+\\}|"+A+")",P="[/\\\\]{2}[?.]"+d+"(?:unc"+d+A+d+x+"|"+Se+d+"users"+d+R+")",ye="file:(?:"+P+"|(?:[/\\\\](?![/\\\\])|[/\\\\]{3,}|[/\\\\]{2}localhost"+d+")(?:"+w+"|[a-z]:"+d+"users"+d+R+")|[/\\\\]{2}(?:[a-z]:"+d+"users"+d+R+"|"+A+d+"(?:"+w+"|"+x+")))",Ne=new RegExp("(?:^|[^\\p{L}\\p{N}_./\\\\~])(?:"+Re+"|"+me+"|"+ye+")|(?:^|[^\\p{L}\\p{N}_:./\\\\~])(?:"+$e+"|"+we+"|"+P+")","giu"),Z=4,xe=/%[a-f0-9]{2}|\\(?:u[a-f0-9]{4}|x[a-f0-9]{2}|\/)/iu,Ie=new TextDecoder("utf-8");function Le(e){return e.replace(/(?:%[a-f0-9]{2})+/giu,n=>Ie.decode(Uint8Array.from(n.matchAll(/%([a-f0-9]{2})/giu),t=>Number.parseInt(t[1],16)))).replace(/%(?![a-f0-9]{2})[a-z0-9]{0,2}/giu,"\uFFFD")}function be(e){return e.replace(/\\+(?:u([a-f0-9]{4})|x([a-f0-9]{2})|(\/))?/giu,(n,t,r,s)=>{const i=t??r;return i===void 0?s??n:String.fromCharCode(Number.parseInt(i,16))})}function Te(e){return e.normalize("NFKC").replace(/[\p{Bidi_Control}\u200b-\u200f\u2060-\u206f\ufeff]/gu,"").replace(/[\u2215\u2044]/gu,"/").replace(/[\u043e\u041e]/gu,"o").replace(/[\u0455\u0405]/gu,"s")}function Oe(e,n){for(const[t,r]of[["percent_decode",Le],["json_unescape",be],["unicode_fold",Te]]){const s=r(e);s!==e&&!n.includes(t)&&n.push(t),e=s}return e}function*ke(e,n,t){let r=e;const s=[];for(let i=0;i<Z;i+=1){const o=r;if(r=Oe(r,s),!t){n.lastIndex=0;for(const a of r.matchAll(n))t=!0,yield{index:0,normalizations:[...s]}}if(r===o)break;i===Z-1&&xe.test(r)&&(yield{index:0,normalizations:[...s],normalization_incomplete:!0})}}function*Ce(e,n){let t=0;for(const r of e.split(`
2
+ `)){n.lastIndex=0;let s=!1;for(const i of r.matchAll(n))s=!0,yield{index:t+i.index};for(const i of ke(r,n,s))yield{...i,index:t};t+=r.length+1}}const M="password|passphrase",S=4,g=4096,m=e=>`${e}+(?!${e})`,D=String.raw`'[^'\r\n]*'|"[^"\\\r\n]*(?:\\.[^"\\\r\n]*){0,${g}}"`,ze=String.raw`\$\{(?:${m(String.raw`[^{}$'"\\\r\n]`)}|\\[^\r\n]|${D}|\$(?!\{)|\$\{[^{}\r\n]*\}){0,${g}}\}`+String.raw`|\$\((?:${m(String.raw`[^()$'"\\\r\n]`)}|\\[^\r\n]|${D}|\$(?!\()|\$\([^()\r\n]*\)){0,${g}}\)`,U=String.raw`${ze}|<[^<>\r\n]*>|${m(String.raw`[A-Za-z0-9!@#%^&*._+\-=]`)}|\$(?![{(])`,Pe=String.raw`"[^"]*"|'[^']*'`,v=String.raw`(?:"[^"\s]*"|'[^'\s]*')(?:${U}){0,${g}}`,V=new RegExp(String.raw`(?!config\.auth\.password\s*(?:\|\|\s*(?:''|"")|\?\s*unescape\(encodeURIComponent\(config\.auth\.password\)\)\s*:\s*(?:''|""))(?=[ \t]*(?:\/\*(?:[^*]|\*(?!\/))*\*\/[ \t]*)*(?:;|$|\/\/[^\r\n\u2028\u2029]*(?:\r\n)?$)))`+`((?:${U}){1,${g}}(?:${v}){0,${S}}|(?:${v}){1,${S}}|${Pe})`),Ze=8,F="token|secret|password|passwd|api[_-]?key",I="(?<![a-z0-9_]|[a-z0-9_]-)(?:(?:[a-z0-9]+_)+(?:password|passphrase)|(?:[a-z0-9]+[_-])*(?:secret|token|(?:api|secret|private|access)[_-]?key|client[_-]?secret|passwd|pwd))",E=4096,H=String.raw`"(?=[^"\s]{8}[^"\s]*")|'(?=[^'\s]{8}[^'\s]*')|(?!["'])`,B=String.raw`(?![<[$/]|~\/|\.\.?\/|[A-Za-z][\w+.-]*:\/\/|%[A-Za-z_]\w*%|[A-Za-z]:[\\/]|(?<=")(?:(?:[A-Za-z_]\w*\.){1,${E}}[A-Za-z_]\w*|[A-Za-z]+(?:-[A-Za-z]+){0,${E}}|(?:[\w.-]+\/){1,${E}}[\w.-]+\.[A-Za-z][A-Za-z0-9]{0,4})"|(?<=')(?:(?:[A-Za-z_]\w*\.){1,${E}}[A-Za-z_]\w*|[A-Za-z]+(?:-[A-Za-z]+){0,${E}}|(?:[\w.-]+\/){1,${E}}[\w.-]+\.[A-Za-z][A-Za-z0-9]{0,4})'|(?<!["'])[A-Za-z]+(?:-[A-Za-z]+){0,${E}}(?![\w!@#$%^&*.+\-=/~])|(?<!["'])(?:[A-Za-z_]\w*\.){1,${E}}[A-Za-z_]\w*(?![\w!@#$%^&*.+\-=/~])|(?<!["'])(?:[\w.-]+\/){1,${E}}[\w.-]+\.[A-Za-z][A-Za-z0-9]{0,4}(?=[\s,;)}\]]|$)|(?<!["'])[\w$.]+\()(?:(?<=")[^\s"]{8}[^\s"]*|(?<=')[^\s']{8}[^\s']*|(?<==)[A-Za-z0-9!@#$%^&*._+\-=/~?:|]{8,}|(?<!["'=])[A-Za-z0-9!@#$%^&*._+\-=/~]{8,})`,L=new RegExp(`(?:${H})(${B})`,"iy"),Me=8,De=String.raw`[A-Za-z0-9!@#%^*._+\-=/~]`,q=String.raw`&(?!&)`,Ue=64,W=String.raw`'[^'\s]*'|"[^"\\\s]*(?:\\\S[^"\\\s]*){0,${g}}"`,K=String.raw`\$\{(?:${m(String.raw`[^{}$'"\\\s]`)}|\\\S|${W}|\$(?!\{)|\$\{[^{}\s]*\}){0,${g}}\}`+String.raw`|\$\((?:${m(String.raw`[^()$'"\\\s]`)}|\\\S|${W}|\$(?!\()|\$\([^()\s]*\)){0,${g}}\)`+String.raw`|<[^<>\s]*>|\$[A-Za-z_]\w*(?!\w)`,j=e=>String.raw`${K}|${m(e)}|${q}|\$(?![{(A-Za-z_])`,Q=e=>String.raw`(?:"[^"\s]*"|'[^'\s]*')(?:${j(e)}){0,${g}}`,ve=e=>String.raw`(?:(?:${e}|${q}){1,${Ue}}(?=[$<]))?(?:${K})`+String.raw`(?:${j(e)}){0,${g}}(?:${Q(e)}){0,${S}}`,Ve=e=>String.raw`(?:${Q(e)}){1,${S}}`,G=e=>String.raw`(?<!["'])(?:${e(De)})`,Y=String.raw`(?:[\w@#~]|!(?![.+\-*/%=^!(]))`,Fe=String.raw`(?=(?:"[^"\s]*"|'[^'\s]*')[$<"']`+String.raw`|"(?=[^"\s]*[$<])[^"\s]*"${Y}|'(?=[^'\s]*[$<])[^'\s]*'${Y})`,He=String.raw`(?<=")(?=[^"\s]*[$<])[^"\s]+|(?<=')(?=[^'\s]*[$<])[^'\s]+`,X=new RegExp(`(?:${Fe}|${H})((?=["'])(?:${G(Ve)})|${He}|${G(ve)}|${B})`),J=/["']?([A-Za-z0-9+/=_-]{24,})/,tt=[{name:"private-key",mutationRule:"private_key",category:"credential",regex:/-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----/g},{name:"github-token",mutationRule:"github_token",category:"credential",regex:/\b(?:gh[opsru]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/g},{name:"npm-token",mutationRule:"npm_token",category:"credential",regex:/\bnpm_[A-Za-z0-9]{20,}\b/g},{name:"aws-access-key",mutationRule:"aws_access_key",category:"credential",regex:/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g},{name:"google-api-key",mutationRule:"google_api_key",category:"credential",regex:/\bAIza[0-9A-Za-z_-]{35}\b/g},{name:"slack-token",mutationRule:"slack_token",category:"credential",regex:/\bxox[baprs]-[A-Za-z0-9-]{10,}\b/g},{name:"anthropic-api-key",mutationRule:"anthropic_api_key",category:"credential",regex:/\bsk-ant-[A-Za-z0-9_-]{20,}\b/g},{name:"openai-api-key",mutationRule:"openai_api_key",category:"credential",regex:/\bsk-(?!ant-)[A-Za-z0-9_-]{20,}\b/g},{name:"gitlab-token",mutationRule:"gitlab_token",category:"credential",regex:/\bglpat-[A-Za-z0-9_.-]{20,}\b/g},{name:"jwt-like-token",mutationRule:"jwt_like_token",category:"credential",regex:/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g},{name:"npm-auth-token-assignment",mutationRule:"npm_auth_token_assignment",category:"credential",regex:/_authToken\s*=\s*\S+/g},{name:"sentry-user-token",mutationRule:"sentry_user_token",category:"credential",regex:/\bsntryu_[A-Za-z0-9]{20,}\b/g},{name:"sentry-org-token",mutationRule:"sentry_org_token",category:"credential",regex:/\bsntrys_[A-Za-z0-9_-]{20,}\b/g},{name:"private-ip",mutationRule:"private_ip",category:"network",regex:/\b(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g},{name:"private-ssh-target",mutationRule:"private_ssh_target",category:"network",regex:/\b(?:ssh|scp|rsync)\s+[A-Za-z0-9._-]+@(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g},{name:"sshpass-inline-password",mutationRule:"sshpass_inline_password",category:"credential",regex:/\bsshpass\s+-p\s+["'][^"']{6,}["']/g},{name:"password-assignment",mutationRule:"password_assignment",category:"credential",regex:new RegExp(String.raw`\b(?:${M})\s*[:=]\s*`+V.source,"gi"),structured:{keys:M,value:V.source,element:!0},minimumLiteralLength:Ze},{name:"absolute-home-path",mutationRule:"absolute_home_path",category:"path",regex:Ne,excludeFiles:/^(?:tests\/|examples\/)/},{name:"user-at-private-host",mutationRule:"user_at_private_host",category:"network",regex:/(?<![A-Za-z0-9._-])[A-Za-z0-9._-]+@(?:10\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|172\.(?:1[6-9]|2\d|3[01])\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)|192\.168\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d))\b/g,excludeFiles:/^(?:tests\/|examples\/)/},{name:"high-entropy-assignment",mutationRule:"high_entropy_assignment",category:"credential",regex:new RegExp(String.raw`\b(?:${F})\s*[:=]\s*`+J.source,"gi"),structured:{keys:F,value:J.source},mutationOnlyReason:"Generic assignments in source code are not credentials; preserve the existing mutation heuristic without treating source identifiers as secrets.",minimumEntropy:3.5},{name:"credential-key-assignment",mutationRule:"credential_key_assignment",category:"credential",regex:new RegExp(String.raw`\b(?:${I})\s*[:=]\s*`+X.source,"gi"),structured:{keys:I,value:X.source,element:!0,elementValue:!0},mutationOnlyReason:"Key-named assignments in source code and test fixtures are identifiers and synthetic data; repository scans keep the token-format rules, which recognize real credentials there.",minimumEntropy:3,minimumLiteralLength:Me,literalValue:L,baseline:{regex:new RegExp(String.raw`\b(?:${I})\s*[:=]\s*`+L.source,"gi"),value:L.source},rejectValue:/^(?:[\w.-]+\/)*id_(?:rsa|dsa|ecdsa|ed25519)(?:_sk)?(?:\.pub)?$/u,rejectStatementReference:/^[A-Z]+(?:_[A-Z]+)+$/u}];function*rt(e,n){if(e.mutationRule==="absolute_home_path"){yield*Ce(n,e.regex);return}for(const t of ne(e))yield*Ge(t,n),t.structured&&(yield*Pn(t,t.structured,n))}const ee=new WeakMap;function ne(e){const n=e.baseline;if(n===void 0)return[e];let t=ee.get(e);return t===void 0&&(t={...e,regex:n.regex,minimumLiteralLength:void 0,literalValue:void 0,baseline:void 0},e.structured&&(t.structured={...e.structured,value:n.value}),ee.set(e,t)),[e,t]}function Be(e,n){const t=e[n-1]==="#"||e[n-1]==="!"?n-1:n;return e[t-1]==="{"&&e[t-2]==="$"}const b=new WeakSet,te=new WeakMap,qe=4096;function We(e,n,t){const r=[],s=[],i=n+t.length;return re(e,n,i,s,r),re(e,i,Math.min(e.length,i+qe),s),r}function re(e,n,t,r,s){for(let i=n;i<t&&(s!==void 0||r.length>0);i+=1){const o=r.at(-1);if(e[i]==="$"&&(e[i+1]==="{"||e[i+1]==="(")&&o?.quoted!=="'"){const a={open:i,close:t,command:e[i+1]==="(",quoted:[]};s?.push(a),r.push({span:a,closer:e[i+1]==="{"?"}":")"}),i+=1}else o!==void 0&&(i=Ke(e,i,r))}}function Ke(e,n,t){const r=t.at(-1),s=e[n];return s==="\\"&&r.quoted!=="'"?n+1:(r.quoted!==void 0?s===r.quoted&&(r.span.quoted.push([r.quoteStart,n]),r.quoted=void 0):s==="'"||s==='"'?(r.quoted=s,r.quoteStart=n):s===r.closer&&(t.pop().span.close=n),n)}function je(e){const n=[];let t=0;return r=>{for(;t<e.length&&e[t].open<r;t+=1){for(;n.length>0&&n.at(-1).close<e[t].open;)n.pop();n.push(e[t])}for(;n.length>0&&n.at(-1).close<r;)n.pop();return n.at(-1)}}function Qe(e,n){let t=0,r=e.quoted.length-1;for(;t<=r;){const s=t+r>>1,[i,o]=e.quoted[s];if(n<i)r=s-1;else if(n>o)t=s+1;else return!0}return!1}const se=/\$[({A-Za-z_]|</u;function*Ge(e,n){const t=e.regex;t.lastIndex=0;const r=Ye(e);let s;for(const i of n.matchAll(t))N(e,i)?yield{index:i.index}:r!==void 0&&se.test(i[1])&&(s??=new RegExp(t),yield*Xe(e,s,n,i,r==="deep"))}function Ye(e){return e.minimumLiteralLength===void 0?void 0:e.minimumEntropy===void 0&&e.literalValue===void 0&&e.rejectValue===void 0?"deep":"shallow"}function*Xe(e,n,t,r,s){const i=r.index+r[0].length;n.lastIndex=i-r[1].length;let o;for(let a=n.exec(t);a!==null&&a.index<i;a=n.exec(t)){if(Be(t,a.index)){n.lastIndex=a.index+1;continue}o??=je(We(t,i-r[1].length,r[1]));const u=o(a.index);u!==void 0&&(te.set(a,u.close),u.command&&!Qe(u,a.index)&&b.add(a)),N(e,a)?yield{index:a.index}:s&&se.test(a[1])&&(n.lastIndex=a.index+a[0].length-a[1].length)}}const ie=new Map,oe=/[\r\n\u2028\u2029]/u;function T(e){const n=`${e.keys}\0${e.value}\0${e.element===!0}`;let t=ie.get(n);return t||(t={key:new RegExp(String.raw`\b(?:${e.keys})(["']?)\s*[:=]\s*`,"gi"),value:new RegExp(e.value,"iyd"),...e.element?{element:{open:new RegExp(String.raw`<(?:${e.keys})(?:\s[^<>]*)?>`,"gi"),close:new RegExp(String.raw`<\/(?:${e.keys})\s*>`,"iy"),span:new RegExp(String.raw`<(?!\/?(?:${e.keys})\b)[^<>]*>`,"iy")}}:{}},ie.set(n,t)),t}function ae(e,n){const t=e[n];for(let r=n+1;r<e.length;r+=1){const s=e[r];if(s==="\\")r+=1;else if(s===t)return{end:r+1,terminated:!0}}return{end:e.length,terminated:!1}}function Je(e,n){return ae(e,n).end}function en(e,n,t){return e.at(-1)==="}"?t:n}function nn(e,n,t,r=t){const s=[];let i=!1;for(let o=n;o<e.length;o+=1){const a=e[o];switch(a){case"[":case"{":s.push(a==="["?"]":"}"),i=a==="{";break;case"]":case"}":if(s.pop()!==a||s.length===0)return{found:!1,end:o+1};i=!1;break;case",":i=s.at(-1)==="}";break;case":":i=!1;break;case'"':case"'":if(!i&&en(s,t,r)(o))return{found:!0,end:o};o=Je(e,o)-1;break;default:break}}return{found:!1,end:e.length}}const tn=/\\(?:U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{2}|[0-7]{1,3}|[\s\S])/gu,rn={n:`
3
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"};function sn(e,n){const t=e[0],r=e.slice(1,n?-1:void 0).replaceAll(tn,o=>{const a=o[1];if((a==="u"||a==="x")&&o.length>2)return String.fromCharCode(Number.parseInt(o.slice(2),16));if(/^[0-7]$/u.test(a))return String.fromCharCode(Number.parseInt(o.slice(1),8));if(a==="U"&&o.length===10){const u=Number.parseInt(o.slice(2),16);return u<=1114111?String.fromCodePoint(u):"\uFFFD"}return rn[a]??a}),s=r.replaceAll(t,t==='"'?"'":'"').replaceAll(/[\r\n\u2028\u2029]/gu," "),i=n?t:"";return{reading:`${t}${s}${i}`,...ue(`${t}${r}${i}`,n)}}function ue(e,n){return{original:e,bodyStart:1,bodyEnd:e.length-(n?1:0)}}const on=64;function ce(e,n,t){const r=e[n-1];if(!t)return r!==void 0&&/[\p{L}\p{N}_.-]/u.test(r)?"prefixed":"exact";if(r===t)return"exact";const s=Math.max(0,n-on);for(let i=n-1;i>=s;i-=1){const o=e[i];if(o===t)return"prefixed";if(o===`
4
+ `||o==="\r"||o==='"'||o==="'")return"malformed"}return"malformed"}function le(e,n,t,r=!1){const s=(a,u,c)=>{n.lastIndex=u;const l=n.exec(a);if(l===null||oe.test(l[0]))return null;const f=l.indices?.[1];return c!==void 0&&f!==void 0&&(l[1]=c.original.slice(Math.max(f[0],c.bodyStart),Math.min(f[1],c.bodyEnd)),O.add(l)),N(e,l)?l:null},i=a=>{if(t[a]!=='"'&&t[a]!=="'")return;const{end:u,terminated:c}=ae(t,a),l=t.slice(a,u);if(!r&&!l.includes("\\"))return;if(oe.test(l))return[];const f=sn(l,c);return(t[a]==="'"?[f,{reading:l,...ue(l,c)}]:[f]).map(_=>s(_.reading,0,_)).filter(_=>_!==null)},o=a=>{const u=i(a);if(u!==void 0)return u;const c=s(t,a);return c===null?[]:[c]};return{direct:a=>s(t,a)!==null,escaped:a=>(i(a)?.length??0)>0,accepts:a=>u=>o(u).some(c=>!(a&&/\s/u.test(an(e,c))))}}function an(e,n){return e.minimumLiteralLength===void 0?n[0]:de(n)}const O=new WeakSet;function de(e){const n=b.has(e)&&!$(h(e))?un(e[1]):void 0,t=n??e[1],r=n!==void 0||ln(e);return O.has(e)||$(h(e))?_e(t,r):nt(t,r)}function un(e){for(let n=0;n<e.length;n+=1){const t=e[n];if(t==="'"||t==='"')n=ge(e,n);else if(t==="$"&&(e[n+1]==="{"||e[n+1]==="("))n=Math.max(n,k(e,n)-1);else if(/[|&;<>]/u.test(t))return e.slice(0,n)}}const cn=/^[;,)}\]]{0,64}/u;function ln(e){const n=e.input,t=e.index+e[0].length,r=$(h(e))&&$(n[t])?t+1:$(e[0].at(-1))?t:-1,s=r===-1?t:r,i=cn.exec(n.slice(s,s+An))[0].length,o=s+i;if(o===n.length||/\s/u.test(n[o])||te.get(e)===s||b.has(e)&&/[|&;<>]/u.test(n[s]))return!0;if(r===-1||i===0)return!1;const a=dn(e,r===t+1),u=n.slice(o,o+40),c=/[}\]]/u.test(n.slice(s,o));return a!==void 0&&(pn.test(u)||(a==="element"||c)&&_n.test(u))}function dn(e,n){const t=e.input,r=e.index+e[0].length-e[1].length-(n?1:0),s=t.slice(Math.max(0,r-fn),r);return En.test(s)?"element":gn.test(s)?"key":void 0}const fn=512,gn=/[{,]\s*(["'])[^"'\r\n]{1,256}\1\s*[:=]\s*$/u,En=/[[,]\s*$/u,pn=/^(?:["'`]|[{[](?:[\s"'`{[\]}]|$|(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)[\s,\]}]))/u,_n=/^(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)[\s,\]}]/u,An=64,Rn=/^\s{0,16}\(/u,$n=/(?<![=!<>])=[ \t]{0,16}$/u;function h(e){return e.input[e.index+e[0].length-e[1].length-1]}function $(e){return e==='"'||e==="'"}const mn=/[$<"']/u;function hn(e){if(O.has(e)||$(h(e))||!/^[$<]/u.test(e[1]))return!1;const n=e.index+e[0].length,t=n-e[1].length,r=e.input.slice(n,n+18);if(e[1][0]==="<"&&(In(e[1])||$n.test(e.input.slice(Math.max(0,t-18),t))||bn.test(r)))return!0;const s=fe(e[1]),i=e[1][s]==="!"?e[1][s+1]:e[1][s];return Ln.test(i??"")||Rn.test(r)}function fe(e){let n=0;for(let t=k(e,n);t!==-1;t=k(e,n))n=t;return n}function k(e,n){const t=e[n];if(t==="<")return wn(e,n);if(t!=="$")return-1;const r=e[n+1];if(r==="{"||r==="(")return Sn(e,n+1,r);y.lastIndex=n;const s=y.exec(e)?.[0];return s===void 0?-1:n+s.length}function wn(e,n){const t=e.indexOf(">",n+1),r=e.indexOf("<",n+1);return t!==-1&&(r===-1||t<r)?t+1:-1}function Sn(e,n,t){const r=t==="{"?"}":")";let s=0;for(let i=n;i<e.length;i+=1){const o=e[i];if(o==="\\")i+=1;else if(o==="'"||o==='"')i=ge(e,i);else if(o===t)s+=1;else if(o===r&&--s===0)return i+1}return-1}function ge(e,n){const t=e[n];for(let r=n+1;r<e.length;r+=1){if(e[r]===t)return r;t==='"'&&e[r]==="\\"&&(r+=1)}return e.length}const yn=/^[\w$.[\]|&,{}:;?]+$/u,Nn=/^(?:"[^"]*"|'[^']*'|-?\d+(?:\.\d+)?)(?:\|(?:"[^"]*"|'[^']*'|-?\d+(?:\.\d+)?|[A-Za-z_$][\w$.]*))*$/u,xn=/\b(?:string|number|boolean|bigint|symbol|any|unknown|object|never|void|undefined|null)\b/u;function In(e){const n=e.slice(1,e.indexOf(">"));return Nn.test(n)?!0:yn.test(n)?xn.test(n)||/[.|&[{]/u.test(n)||/^[A-Z][\w$]*$/u.test(n)&&(n.length===1||/[a-z]/u.test(n)):!1}const Ln=/[.+\-*/%=^&]/u,bn=/^\s{0,16}(?:\?\.|\?\?|\|\||&&|[([])/u;function Tn(e,n,t){if(t)return!1;const r=n.replaceAll('"',"'");return e.lastIndex=0,e.exec(`"${r}"`)?.[1]===r}function st(e,n){if(!e.structured)return;const t=`${JSON.stringify(n)}:`,r=T(e.structured).key;r.lastIndex=0;for(let s=r.exec(t);s;s=r.exec(t)){if(s.index+s[0].length!==t.length)continue;const i=ce(t,s.index,s[1]);if(i!=="malformed")return i}}function it(e,n,t){if(!e.structured)return!1;const r=JSON.stringify(n).replaceAll("\u2028","\\u2028").replaceAll("\u2029","\\u2029");return ne(e).some(s=>le(s,T(s.structured).value,r,!0).accepts(t)(0))}function*On(e,n,t){const r=new RegExp(e.open);for(let s=r.exec(n);s;s=r.exec(n)){const i=s.index+s[0].length,o=kn(e,n,i);if(o===void 0){r.lastIndex=s.index+1;continue}t(n.slice(i,o.start).trim())&&(yield{index:s.index}),r.lastIndex=o.end}}function kn(e,n,t){for(let r=n.indexOf("<",t);r!==-1;){e.close.lastIndex=r;const s=e.close.exec(n);if(s!==null)return{start:r,end:r+s[0].length};e.span.lastIndex=r;const i=e.span.exec(n);if(i===null)return;r=n.indexOf("<",r+i[0].length)}}function Cn(e,n,t){return n<e.exact||t&&n<e.compact}function zn(e,n,t,r){return(t||e.escaped(r)&&!e.direct(r))&&n(r)}function*Pn(e,n,t){const r=T(n),s=le(e,r.value,t),i=new RegExp(r.key),o={exact:0,compact:0};for(let a=i.exec(t);a;a=i.exec(t)){const u=a[1],c=ce(t,a.index,u);if(c==="malformed")continue;const l=c==="prefixed",f=s.accepts(l),p=a.index+a[0].length,_=t[p];if(_==="["||_==="{"){if(Cn(o,p,l))continue;const z=nn(t,p,f,s.accepts(!0));o[l?"compact":"exact"]=z.end,z.found&&(yield{index:a.index})}else zn(s,f,u,p)&&(yield{index:a.index})}r.element&&(yield*On(r.element,t,Mn(e,n,r)))}const Zn=8;function Mn(e,n,t){if(!n.elementValue){const r=e.minimumLiteralLength??Zn;return s=>_e(s).length>=r}return r=>{const s=r.replaceAll('"',"'");t.value.lastIndex=0;const i=t.value.exec(`"${s}"`);return i===null||i[1]!==s?!1:(i[1]=r,N(e,i))}}function Dn(e,n,t){const r=n.index+n[0].length;return/^[ \t]*;/u.test(n.input.slice(r,r+64))&&!$(h(n))&&e.test(t)}function Un(e,n){for(let t=n+1;t<e.length;t+=1){if(e[t]===">")return t;if(e[t]==="<")return-1}return-1}function C(e,n){e.raw+=n,e.literal+=n}function vn(e,n,t){const r=e[n+1];if(e[n]!=="$"||r!=="{"&&r!=="(")return-1;const s=r==="{"?e.slice(n+2,n+2+jn(e,n+2)):"",i=t[0],o=t.length===1&&i.quote!==void 0&&i.literal.length===i.pieceStart;return t.push({close:r==="{"?"}":")",keep:s!=="",raw:`$${r}${s}`,literal:"",opensPiece:o}),n+2+s.length}const Vn=/[A-Za-z_]/u,Fn=/\w/u,Hn=/[{(A-Za-z_]/u,y=/\$[A-Za-z_]\w*/y,Bn=/^_*[A-Z][A-Z0-9_]*$/u,qn=/^\$[A-Za-z_]\w*$/u,Wn=/^(["'])\$[A-Za-z_]\w*\1$/u;function Kn(e,n,t){y.lastIndex=n;const r=y.exec(e)?.[0];return r===void 0?-1:(t.literal===""&&Bn.test(r.slice(1))?t.raw+=r:C(t,r),n+r.length)}function jn(e,n){if(!Vn.test(e[n]??""))return 0;let t=n+1;for(;t<e.length&&Fn.test(e[t]);)t+=1;e[t]===":"&&(t+=1);const r=e[t];return r==="-"||r==="="||r==="+"?t+1-n:0}function Qn(e,n){const t=e.pop(),r=e.at(-1);r.raw+=`${t.raw}${n}`,t.keep&&(r.literal+=t.literal)}const Ee=/[^$<"'\\})]+/y,Gn='$`"\\\n';function Yn(e,n){return e===`
5
+ `?"":n==='"'&&!Gn.includes(e)?`\\${e}`:e}function Xn(e,n,t){const r=e[n],s=t.quote;if(s==='"'&&r==="$"&&Hn.test(e[n+1]??""))return-1;let i=1,o=r;if(r==="\\"&&s!=="'"&&n+1<e.length)i=2,o=Yn(e[n+1],s);else if(s===void 0){if(r!=='"'&&r!=="'")return-1;t.quote=r,o=""}else r===s&&(t.quote=void 0,o="");return t.raw+=e.slice(n,n+i),t.keep&&(t.literal+=o),n+i}function Jn(e,n,t,r,s){const i=t.at(-1);Ee.lastIndex=n;const o=Ee.exec(e)?.[0];if(o!==void 0)return C(i,o),n+o.length;if(t.length>1){const p=Xn(e,n,i);if(p!==-1)return p}else if(r&&et(e[n],i))return n+1;const a=vn(e,n,t);if(a!==-1)return a;const u=t.at(-1),c=e[n],l=s&&c==="$"?Kn(e,n,u):-1;if(l!==-1)return l;if(t.length>1&&c===u.close)return Qn(t,c),n+1;const f=c==="<"?Un(e,n):-1;return f!==-1?(u.raw+=e.slice(n,f+1),f+1):(C(u,c),n+1)}function et(e,n){return e!=='"'&&e!=="'"?!1:n.quote===void 0?(n.quote=e,n.pieceStart=n.literal.length,!0):e!==n.quote?!1:(n.quote=void 0,!0)}function pe(e,n,t){if(t&&(qn.test(e)||n&&Wn.test(e)))return"";const r={close:"}",keep:!0,raw:"",literal:""},s=[r];for(let i=0;i<e.length;)i=Jn(e,i,s,n,t);for(let i=s.length-1;i>0;i-=1){const o=s[i],a=s[i-1];a.raw+=o.raw,n&&i===1&&o.opensPiece===!0||(a.literal+=o.raw)}return r.literal}function _e(e,n=!0){return pe(e,!1,n)}function nt(e,n=!0){return pe(e,!0,n)}function N(e,n){const t=e.minimumLiteralLength===void 0?n[1]:de(n);if(e.minimumLiteralLength!==void 0&&t.length<e.minimumLiteralLength||e.literalValue&&mn.test(n[1])&&!Tn(e.literalValue,t,hn(n))||e.rejectValue?.test(t)===!0||e.rejectStatementReference&&Dn(e.rejectStatementReference,n,t))return!1;if(e.minimumEntropy===void 0)return!0;const r=[...t],s=new Map;for(const o of r)s.set(o,(s.get(o)??0)+1);let i=0;for(const o of s.values()){const a=o/r.length;i-=a*Math.log2(a)}return i>=e.minimumEntropy}const ot={leadingReferencesEnd:fe};export{Ne as PRIVATE_HOME_PATH_PATTERN,tt as SECRET_RULES,ot as _testOnly,N as acceptsSecretMatch,it as acceptsStructuredValue,_e as expandRuntimeReferences,Ce as findPrivateHomePathMatches,rt as findSecretRuleMatches,nt as literalAfterReferences,st as structuredKeyShape};
6
6
  //# sourceMappingURL=secret-rules.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4da25248-2914-5bc5-aa42-87f677ef4ea8")}catch{}})();function createAsyncReadWriteGate(){let writerBarrier=Promise.resolve();const readers=new Set;return{async read(task){const precedingWriters=writerBarrier;let finishReader;const readerDone=new Promise(resolve=>{finishReader=resolve});readers.add(readerDone),await precedingWriters;try{return await task()}finally{readers.delete(readerDone),finishReader()}},write(task){const run=Promise.all([writerBarrier,...readers]).then(()=>task());return writerBarrier=run.then(()=>{},()=>{}),run}}}function createSerialQueue(){let tail=Promise.resolve(),pending=0;const idleWaiters=[],notifyIdle=()=>{if(pending!==0)return;const waiters=idleWaiters.splice(0);for(const resolve of waiters)resolve()};return{enqueue(task){pending++;const run=tail.then(()=>task());return tail=run.then(()=>{},()=>{}).finally(()=>{pending--,notifyIdle()}),run},idle(){return pending===0?Promise.resolve():new Promise(resolve=>idleWaiters.push(resolve))}}}export{createAsyncReadWriteGate,createSerialQueue};
1
+ function d(){let t=Promise.resolve();const r=new Set;return{async read(i){const o=t;let e;const n=new Promise(s=>{e=s});r.add(n),await o;try{return await i()}finally{r.delete(n),e()}},write(i){const e=Promise.all([t,...r]).then(()=>i());return t=e.then(()=>{},()=>{}),e}}}function a(){let t=Promise.resolve(),r=0;const i=[],o=()=>{if(r!==0)return;const e=i.splice(0);for(const n of e)n()};return{enqueue(e){r++;const n=t.then(()=>e());return t=n.then(()=>{},()=>{}).finally(()=>{r--,o()}),n},idle(){return r===0?Promise.resolve():new Promise(e=>i.push(e))}}}export{d as createAsyncReadWriteGate,a as createSerialQueue};
2
2
  //# sourceMappingURL=serial-queue.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="77f9d61e-e78b-5b6a-a769-1ad6e5b91777")}catch{}})();import crypto from"node:crypto";function sortScalarValue(value){if(value===null)return null;if(typeof value=="string"||typeof value=="number"||typeof value=="boolean")return value;if(typeof value=="bigint")return value.toString();if(value===void 0)return"undefined";if(typeof value=="symbol")return value.toString();if(typeof value=="function")return`[function:${value.name||"anonymous"}]`}function sortPlainObjectKeys(value){const sortedKeys=Object.keys(value).sort(),result={};for(const key of sortedKeys){const nested=value[key];nested!==void 0&&(result[key]=sortObjectKeys(nested))}return result}function sortObjectKeys(value){const scalarValue=sortScalarValue(value);if(scalarValue!==void 0)return scalarValue;if(Array.isArray(value))return value.map(entry=>sortObjectKeys(entry));if(value instanceof Date)return value.toISOString();const maybeJson=value;if(typeof maybeJson.toJSON=="function"){const normalized=maybeJson.toJSON();if(normalized!==value)return sortObjectKeys(normalized)}return sortPlainObjectKeys(value)}function stableStringify(value){return JSON.stringify(sortObjectKeys(value))}function hasUnmatchedEquivalent(leftValue,rightValues,matchedIndexes,equals){for(let index=0;index<rightValues.length;index+=1)if(!matchedIndexes.has(index)&&equals(leftValue,rightValues[index]))return matchedIndexes.add(index),!0;return!1}function compareRegExpValues(left,right){if(left instanceof RegExp||right instanceof RegExp)return left instanceof RegExp&&right instanceof RegExp&&left.toString()===right.toString()}function compareDateValues(left,right){if(left instanceof Date||right instanceof Date)return left instanceof Date&&right instanceof Date&&left.getTime()===right.getTime()}function compareSetValues(left,right){if(!(left instanceof Set||right instanceof Set))return;if(!(left instanceof Set&&right instanceof Set)||left.size!==right.size)return!1;const rightValues=[...right],matched=new Set;for(const leftValue of left)if(!hasUnmatchedEquivalent(leftValue,rightValues,matched,stableValueEquals))return!1;return!0}function compareMapValues(left,right){if(!(left instanceof Map||right instanceof Map))return;if(!(left instanceof Map&&right instanceof Map)||left.size!==right.size)return!1;const rightEntries=[...right.entries()],matched=new Set;for(const[leftKey,leftValue]of left.entries())if(!hasUnmatchedEquivalent([leftKey,leftValue],rightEntries,matched,([candidateKey,candidateValue],[rightKey,rightValue])=>stableValueEquals(candidateKey,rightKey)&&stableValueEquals(candidateValue,rightValue)))return!1;return!0}function compareArrayValues(left,right){if(Array.isArray(left)||Array.isArray(right))return!Array.isArray(left)||!Array.isArray(right)||left.length!==right.length?!1:left.every((value,index)=>stableValueEquals(value,right[index]))}function comparePlainObjectValues(left,right){const leftKeys=Object.keys(left).sort((a,b)=>a.localeCompare(b)),rightKeys=Object.keys(right).sort((a,b)=>a.localeCompare(b));if(leftKeys.length!==rightKeys.length)return!1;for(let index=0;index<leftKeys.length;index+=1){const leftKey=leftKeys[index];if(leftKey!==rightKeys[index]||!stableValueEquals(left[leftKey],right[leftKey]))return!1}return!0}const SPECIALIZED_STABLE_VALUE_COMPARISONS=[compareRegExpValues,compareDateValues,compareSetValues,compareMapValues,compareArrayValues];function stableValueEquals(left,right){if(Object.is(left,right))return!0;if(left===null||right===null||typeof left!="object"||typeof right!="object")return!1;for(const compare of SPECIALIZED_STABLE_VALUE_COMPARISONS){const result=compare(left,right);if(result!==void 0)return result}return comparePlainObjectValues(left,right)}function sha256Hex(value){return crypto.createHash("sha256").update(value,"utf8").digest("hex")}function orderObject(value,keyOrder){const ordered={};for(const key of keyOrder){const entry=value[key];entry!==void 0&&(ordered[key]=entry)}const unknownKeys=Object.keys(value).filter(key=>!keyOrder.includes(key)).sort((a,b)=>a.localeCompare(b));for(const key of unknownKeys){const entry=value[key];entry!==void 0&&(ordered[key]=entry)}return ordered}export{orderObject,sha256Hex,stableStringify,stableValueEquals};
1
+ import p from"node:crypto";function l(n){if(n===null)return null;if(typeof n=="string"||typeof n=="number"||typeof n=="boolean")return n;if(typeof n=="bigint")return n.toString();if(n===void 0)return"undefined";if(typeof n=="symbol")return n.toString();if(typeof n=="function")return`[function:${n.name||"anonymous"}]`}function m(n){const e=Object.keys(n).sort(),r={};for(const o of e){const t=n[o];t!==void 0&&(r[o]=i(t))}return r}function i(n){const e=l(n);if(e!==void 0)return e;if(Array.isArray(n))return n.map(o=>i(o));if(n instanceof Date)return n.toISOString();const r=n;if(typeof r.toJSON=="function"){const o=r.toJSON();if(o!==n)return i(o)}return m(n)}function g(n){return JSON.stringify(i(n))}function c(n,e,r,o){for(let t=0;t<e.length;t+=1)if(!r.has(t)&&o(n,e[t]))return r.add(t),!0;return!1}function S(n,e){if(n instanceof RegExp||e instanceof RegExp)return n instanceof RegExp&&e instanceof RegExp&&n.toString()===e.toString()}function b(n,e){if(n instanceof Date||e instanceof Date)return n instanceof Date&&e instanceof Date&&n.getTime()===e.getTime()}function A(n,e){if(!(n instanceof Set||e instanceof Set))return;if(!(n instanceof Set&&e instanceof Set)||n.size!==e.size)return!1;const r=[...e],o=new Set;for(const t of n)if(!c(t,r,o,f))return!1;return!0}function E(n,e){if(!(n instanceof Map||e instanceof Map))return;if(!(n instanceof Map&&e instanceof Map)||n.size!==e.size)return!1;const r=[...e.entries()],o=new Set;for(const[t,s]of n.entries())if(!c([t,s],r,o,([u,a],[y,d])=>f(u,y)&&f(a,d)))return!1;return!0}function O(n,e){if(Array.isArray(n)||Array.isArray(e))return!Array.isArray(n)||!Array.isArray(e)||n.length!==e.length?!1:n.every((r,o)=>f(r,e[o]))}function x(n,e){const r=Object.keys(n).sort((t,s)=>t.localeCompare(s)),o=Object.keys(e).sort((t,s)=>t.localeCompare(s));if(r.length!==o.length)return!1;for(let t=0;t<r.length;t+=1){const s=r[t];if(s!==o[t]||!f(n[s],e[s]))return!1}return!0}const V=[S,b,A,E,O];function f(n,e){if(Object.is(n,e))return!0;if(n===null||e===null||typeof n!="object"||typeof e!="object")return!1;for(const r of V){const o=r(n,e);if(o!==void 0)return o}return x(n,e)}function k(n){return p.createHash("sha256").update(n,"utf8").digest("hex")}function D(n,e){const r={};for(const t of e){const s=n[t];s!==void 0&&(r[t]=s)}const o=Object.keys(n).filter(t=>!e.includes(t)).sort((t,s)=>t.localeCompare(s));for(const t of o){const s=n[t];s!==void 0&&(r[t]=s)}return r}export{D as orderObject,k as sha256Hex,g as stableStringify,f as stableValueEquals};
2
2
  //# sourceMappingURL=serialization.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="4b566486-120f-5aed-8d92-9e62ed996210")}catch{}})();function splitCommaList(raw,options){if(raw==null)return[];const separators=options?.separators??/,/,trimmed=raw.split(separators).map(entry=>entry.trim()).filter(entry=>entry.length>0),deduped=options?.unique!==!1?Array.from(new Set(trimmed)):trimmed;return options?.sort===!0?[...deduped].sort():deduped}export{splitCommaList};
1
+ function a(t,e){if(t==null)return[];const u=e?.separators??/,/,n=t.split(u).map(r=>r.trim()).filter(r=>r.length>0),s=e?.unique!==!1?Array.from(new Set(n)):n;return e?.sort===!0?[...s].sort():s}export{a as splitCommaList};
2
2
  //# sourceMappingURL=split-comma-list.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f74cf2ed-6219-57c6-98a3-4b4c7496a17c")}catch{}})();function normalizeLowercaseWhitespace(value){return value.trim().toLowerCase().replace(/\s+/g," ")}function unicodeSafePrefix(value,end){const prefix=value.slice(0,end),last=prefix.charCodeAt(prefix.length-1),next=value.charCodeAt(prefix.length);return last>=55296&&last<=56319&&next>=56320&&next<=57343?prefix.slice(0,-1):prefix}const COMPACTED_STRING_LENGTH=240,COMPACTION_MARKER_PATTERN=/\u2026\[\+([1-9]\d*) chars\]$/u;function compactExplanatoryString(value){if(value.length<=COMPACTED_STRING_LENGTH)return value;const marker=COMPACTION_MARKER_PATTERN.exec(value);if(marker!==null&&marker.index<=COMPACTED_STRING_LENGTH)return value;const prefix=unicodeSafePrefix(value,COMPACTED_STRING_LENGTH);return`${prefix}\u2026[+${value.length-prefix.length} chars]`}function readCompactionMarker(text){const match=COMPACTION_MARKER_PATTERN.exec(text.trimEnd());return match?Number(match[1]):void 0}function isContinuationTokenKey(key){return key==="cursor"||key.endsWith("_cursor")}const TRACKER_ITEM_READ_SURFACES=new Set(["get","list","search"]);function isTrackerItemDocumentKey(surface,key){return(key==="item"||key==="items")&&surface!==void 0&&TRACKER_ITEM_READ_SURFACES.has(surface)}function isCompactedCursorArgument(value){return value.includes("\u2026")}function tokenizeAlphaNumeric(value){return normalizeLowercaseWhitespace(value).split(/[^a-z0-9]+/).filter(token=>token.length>0)}function jaccardSimilarity(leftTokens,rightTokens){if(leftTokens.length===0&&rightTokens.length===0)return 1;if(leftTokens.length===0||rightTokens.length===0)return 0;const leftSet=new Set(leftTokens),rightSet=new Set(rightTokens);let intersection=0;for(const token of leftSet)rightSet.has(token)&&(intersection+=1);const union=new Set([...leftSet,...rightSet]).size;return intersection/union}export{COMPACTED_STRING_LENGTH,compactExplanatoryString,isCompactedCursorArgument,isContinuationTokenKey,isTrackerItemDocumentKey,jaccardSimilarity,normalizeLowercaseWhitespace,readCompactionMarker,tokenizeAlphaNumeric,unicodeSafePrefix};
1
+ function a(t){return t.trim().toLowerCase().replace(/\s+/g," ")}function x(t,e){const n=t.slice(0,e),r=n.charCodeAt(n.length-1),o=t.charCodeAt(n.length);return r>=55296&&r<=56319&&o>=56320&&o<=57343?n.slice(0,-1):n}const i=240,c=/\u2026\[\+([1-9]\d*) chars\]$/u;function h(t){if(t.length<=i)return t;const e=c.exec(t);if(e!==null&&e.index<=i)return t;const n=x(t,i);return`${n}\u2026[+${t.length-n.length} chars]`}function p(t){const e=c.exec(t.trimEnd());return e?Number(e[1]):void 0}function l(t){return t==="cursor"||t.endsWith("_cursor")}const f=new Set(["get","list","search"]);function m(t,e){return(e==="item"||e==="items")&&t!==void 0&&f.has(t)}function d(t){return t.includes("\u2026")}function C(t){return a(t).split(/[^a-z0-9]+/).filter(e=>e.length>0)}function g(t,e){if(t.length===0&&e.length===0)return 1;if(t.length===0||e.length===0)return 0;const n=new Set(t),r=new Set(e);let o=0;for(const u of n)r.has(u)&&(o+=1);const s=new Set([...n,...r]).size;return o/s}export{i as COMPACTED_STRING_LENGTH,h as compactExplanatoryString,d as isCompactedCursorArgument,l as isContinuationTokenKey,m as isTrackerItemDocumentKey,g as jaccardSimilarity,a as normalizeLowercaseWhitespace,p as readCompactionMarker,C as tokenizeAlphaNumeric,x as unicodeSafePrefix};
2
2
  //# sourceMappingURL=text-normalization.js.map
@@ -1,3 +1,3 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0bf155fc-c690-5318-ba1e-275f1787858b")}catch{}})();import{PmCliError}from"./errors.js";import{evictOldestMemoEntries}from"./memo.js";import{EXIT_CODE}from"./constants.js";import{nextReproducibleTimestamp}from"../reproducibility/context.js";const RELATIVE_DEADLINE=/^([+-]?)(\d+)([hdwm])$/i,COMPOUND_RELATIVE_DEADLINE=/^[+-]?\d+[hdwm](?:[+-]\d+[hdwm])+$/i,COMPACT_DATE=/^(\d{4})(\d{2})(\d{2})$/,COMPACT_DATETIME=/^(\d{4})(\d{2})(\d{2})(?:[T\s]?)(\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,HYPHEN_TIME=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})-(\d{2})(?:-(\d{2}))?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,COMPACT_TIME=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,RFC_3339_DATE_TIME=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-](\d{2}):(\d{2}))$/i;function nowIso(){return nextReproducibleTimestamp()??new Date().toISOString()}function isTimestampLiteral(input){return Number.isFinite(Date.parse(input))}function isRfc3339DateTime(input){const match=RFC_3339_DATE_TIME.exec(input);if(!match||!Number.isFinite(Date.parse(input)))return!1;const[,yearRaw,monthRaw,dayRaw,hourRaw,minuteRaw,secondRaw,offsetHourRaw,offsetMinuteRaw]=match,[year,month,day,hour,minute,second]=[yearRaw,monthRaw,dayRaw,hourRaw,minuteRaw,secondRaw].map(Number);return month>=1&&month<=12&&day>=1&&day<=daysInUtcMonth(year,month-1)&&hour<=23&&minute<=59&&second<=59&&(offsetHourRaw===void 0||Number(offsetHourRaw)<=23)&&(offsetMinuteRaw===void 0||Number(offsetMinuteRaw)<=59)}function isMillisecondPrecisionRfc3339DateTime(input){const fraction=/\.(\d+)(?:Z|[+-]\d{2}:\d{2})$/iu.exec(input)?.[1];return isRfc3339DateTime(input)&&(fraction===void 0||/^\d{0,3}0*$/u.test(fraction))}const TIMESTAMP_PARSE_MEMO_MAX_ENTRIES=1e4,timestampParseMemo=new Map;function parseTimestampMsMemoized(value){const memoized=timestampParseMemo.get(value);if(memoized!==void 0)return memoized;const parsed=Date.parse(value);return timestampParseMemo.size>=TIMESTAMP_PARSE_MEMO_MAX_ENTRIES&&evictOldestMemoEntries(timestampParseMemo),timestampParseMemo.set(value,parsed),parsed}function compareTimestampStrings(left,right){const leftMs=parseTimestampMsMemoized(left),rightMs=parseTimestampMsMemoized(right);return Number.isFinite(leftMs)&&Number.isFinite(rightMs)&&leftMs!==rightMs?leftMs-rightMs:left.localeCompare(right)}function matchesTimestampFilters(item,filters){return!(filters.deadlineBefore&&(!item.deadline||compareTimestampStrings(item.deadline,filters.deadlineBefore)>0)||filters.deadlineAfter&&(!item.deadline||compareTimestampStrings(item.deadline,filters.deadlineAfter)<0)||filters.updatedAfter&&compareTimestampStrings(item.updated_at,filters.updatedAfter)<0||filters.updatedBefore&&compareTimestampStrings(item.updated_at,filters.updatedBefore)>0||filters.createdAfter&&compareTimestampStrings(item.created_at,filters.createdAfter)<0||filters.createdBefore&&compareTimestampStrings(item.created_at,filters.createdBefore)>0)}function normalizeFraction(raw){return raw?`.${raw.slice(1).padEnd(3,"0").slice(0,3)}`:""}function normalizeOffset(raw){if(!raw)return"";if(raw.toUpperCase()==="Z")return"Z";const compact=/^([+-]\d{2})(\d{2})$/.exec(raw);return compact?`${compact[1]}:${compact[2]}`:raw}function pushTimestampCandidate(candidates,input,value){value&&value!==input&&(candidates.includes(value)||candidates.push(value))}function normalizeTimestampCandidates(input){const candidates=[],push=value=>pushTimestampCandidate(candidates,input,value),compactDate=COMPACT_DATE.exec(input);if(compactDate){const[,year,month,day]=compactDate;push(`${year}-${month}-${day}`)}const compactDateTime=COMPACT_DATETIME.exec(input);if(compactDateTime){const[,year,month,day,hour,minute,secondRaw,fractionRaw,offsetRaw]=compactDateTime,second=secondRaw?`:${secondRaw}`:"";push(`${year}-${month}-${day}T${hour}:${minute}${second}${normalizeFraction(fractionRaw)}${normalizeOffset(offsetRaw)}`)}const hyphenTime=HYPHEN_TIME.exec(input);if(hyphenTime){const[,datePart,hour,minute,secondRaw,fractionRaw,offsetRaw]=hyphenTime,second=secondRaw?`:${secondRaw}`:"";push(`${datePart}T${hour}:${minute}${second}${normalizeFraction(fractionRaw)}${normalizeOffset(offsetRaw)}`)}const compactTime=COMPACT_TIME.exec(input);if(compactTime){const[,datePart,hour,minute,secondRaw,fractionRaw,offsetRaw]=compactTime,second=secondRaw?`:${secondRaw}`:"";push(`${datePart}T${hour}:${minute}${second}${normalizeFraction(fractionRaw)}${normalizeOffset(offsetRaw)}`)}const datePrefixLength=10,datePrefix=input.slice(0,datePrefixLength);if(isHyphenDatePrefix(datePrefix)){let index=datePrefixLength;for(;index<input.length&&isWhitespaceCharacter(input[index]);)index+=1;index<input.length&&push(`${datePrefix}T${input.slice(index)}`)}return candidates}function parseTimestampWithFallbacks(input){const direct=Date.parse(input);if(Number.isFinite(direct))return direct;for(const candidate of normalizeTimestampCandidates(input)){const parsed=Date.parse(candidate);if(Number.isFinite(parsed))return parsed}return Number.NaN}function isHyphenDatePrefix(value){if(value.length!==10)return!1;for(let index=0;index<value.length;index+=1){const character=value[index];if(index===4||index===7){if(character!=="-")return!1;continue}const code=character.charCodeAt(0);if(code<48||code>57)return!1}return!0}function isWhitespaceCharacter(character){return character?character===" "||character===" "||character===`
2
- `||character==="\r"||character==="\f"||character==="\v":!1}function daysInUtcMonth(year,monthIndex){return new Date(Date.UTC(year,monthIndex+1,0)).getUTCDate()}const MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"],LEADING_HYPHEN_DATE=/^(\d{4})-(\d{2})-(\d{2})/,LEADING_COMPACT_DATE=/^(\d{4})(\d{2})(\d{2})(?:[T ]?\d{2}|$)/;function assertRealCalendarDate(originalInput,trimmed,fieldLabel){const match=LEADING_HYPHEN_DATE.exec(trimmed)??LEADING_COMPACT_DATE.exec(trimmed);if(!match)return;const year=Number.parseInt(match[1],10),month=Number.parseInt(match[2],10),day=Number.parseInt(match[3],10),label=fieldLabel?.trim()||"deadline";if(month<1||month>12)throw new PmCliError(`Invalid ${label} value "${originalInput}". Month "${match[2]}" is out of range \u2014 use a month between 01 and 12.`,EXIT_CODE.USAGE,{field:label,value:originalInput});const maxDay=daysInUtcMonth(year,month-1);if(day<1||day>maxDay)throw new PmCliError(`Invalid ${label} value "${originalInput}". ${MONTH_NAMES[month-1]} ${year} has ${maxDay} days, so day "${match[3]}" does not exist. Use a real YYYY-MM-DD calendar date.`,EXIT_CODE.USAGE,{field:label,value:originalInput})}function addUtcMonths(now,amount){const result=new Date(now.getTime()),startDay=result.getUTCDate(),targetMonthIndex=result.getUTCMonth()+amount,targetYear=result.getUTCFullYear()+Math.floor(targetMonthIndex/12),targetMonth=(targetMonthIndex%12+12)%12,day=Math.min(startDay,daysInUtcMonth(targetYear,targetMonth));return result.setUTCFullYear(targetYear,targetMonth,day),result}function resolveIsoOrRelative(input,now=new Date,fieldLabel="deadline"){const trimmed=input.trim();if(trimmed.toLowerCase()==="now")return now.toISOString();const relative=RELATIVE_DEADLINE.exec(trimmed);if(relative){const sign=relative[1]==="-"?-1:1,amount=Number.parseInt(relative[2],10)*sign,unit=relative[3].toLowerCase();if(unit==="m")return addUtcMonths(now,amount).toISOString();const msPerUnit=unit==="h"?3600*1e3:unit==="d"?1440*60*1e3:10080*60*1e3;return new Date(now.getTime()+amount*msPerUnit).toISOString()}assertRealCalendarDate(input,trimmed,fieldLabel);const timestamp=parseTimestampWithFallbacks(trimmed);if(!Number.isFinite(timestamp)){const normalizedLabel=fieldLabel.trim().length>0?fieldLabel.trim():"deadline",guidance=COMPOUND_RELATIVE_DEADLINE.test(trimmed)?"Compound relative expressions like +3d+1h are not supported; use a single relative token (for example +3d) or an ISO/date string.":'Use ISO/date string input, "now", or relative +6h/-6h/+1d/-1d/+2w/-2w/+6m/-6m.';throw new PmCliError(`Invalid ${normalizedLabel} value "${input}". ${guidance}`,EXIT_CODE.USAGE,{field:normalizedLabel,value:input})}return new Date(timestamp).toISOString()}const _testOnly={normalizeOffset,pushTimestampCandidate,normalizeTimestampCandidates,parseTimestampWithFallbacks,isWhitespaceCharacter};export{_testOnly,compareTimestampStrings,isMillisecondPrecisionRfc3339DateTime,isRfc3339DateTime,isTimestampLiteral,matchesTimestampFilters,nowIso,resolveIsoOrRelative};
1
+ import{PmCliError as M}from"./errors.js";import{evictOldestMemoEntries as b}from"./memo.js";import{EXIT_CODE as w}from"./constants.js";import{nextReproducibleTimestamp as y}from"../reproducibility/context.js";const O=/^([+-]?)(\d+)([hdwm])$/i,S=/^[+-]?\d+[hdwm](?:[+-]\d+[hdwm])+$/i,P=/^(\d{4})(\d{2})(\d{2})$/,U=/^(\d{4})(\d{2})(\d{2})(?:[T\s]?)(\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,F=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})-(\d{2})(?:-(\d{2}))?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,v=/^(\d{4}-\d{2}-\d{2})[T\s](\d{2})(\d{2})(\d{2})?([.,]\d{1,3})?(Z|[+-]\d{2}:?\d{2})?$/i,L=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:Z|[+-](\d{2}):(\d{2}))$/i;function q(){return y()??new Date().toISOString()}function K(e){return Number.isFinite(Date.parse(e))}function Y(e){const t=L.exec(e);if(!t||!Number.isFinite(Date.parse(e)))return!1;const[,n,r,d,s,i,a,c,o]=t,[f,u,m,$,l,T]=[n,r,d,s,i,a].map(Number);return u>=1&&u<=12&&m>=1&&m<=A(f,u-1)&&$<=23&&l<=59&&T<=59&&(c===void 0||Number(c)<=23)&&(o===void 0||Number(o)<=59)}function Q(e){const t=/\.(\d+)(?:Z|[+-]\d{2}:\d{2})$/iu.exec(e)?.[1];return Y(e)&&(t===void 0||/^\d{0,3}0*$/u.test(t))}const z=1e4,h=new Map;function x(e){const t=h.get(e);if(t!==void 0)return t;const n=Date.parse(e);return h.size>=z&&b(h),h.set(e,n),n}function p(e,t){const n=x(e),r=x(t);return Number.isFinite(n)&&Number.isFinite(r)&&n!==r?n-r:e.localeCompare(t)}function ee(e,t){return!(t.deadlineBefore&&(!e.deadline||p(e.deadline,t.deadlineBefore)>0)||t.deadlineAfter&&(!e.deadline||p(e.deadline,t.deadlineAfter)<0)||t.updatedAfter&&p(e.updated_at,t.updatedAfter)<0||t.updatedBefore&&p(e.updated_at,t.updatedBefore)>0||t.createdAfter&&p(e.created_at,t.createdAfter)<0||t.createdBefore&&p(e.created_at,t.createdBefore)>0)}function E(e){return e?`.${e.slice(1).padEnd(3,"0").slice(0,3)}`:""}function D(e){if(!e)return"";if(e.toUpperCase()==="Z")return"Z";const t=/^([+-]\d{2})(\d{2})$/.exec(e);return t?`${t[1]}:${t[2]}`:e}function g(e,t,n){n&&n!==t&&(e.includes(n)||e.push(n))}function C(e){const t=[],n=o=>g(t,e,o),r=P.exec(e);if(r){const[,o,f,u]=r;n(`${o}-${f}-${u}`)}const d=U.exec(e);if(d){const[,o,f,u,m,$,l,T,R]=d,_=l?`:${l}`:"";n(`${o}-${f}-${u}T${m}:${$}${_}${E(T)}${D(R)}`)}const s=F.exec(e);if(s){const[,o,f,u,m,$,l]=s,T=m?`:${m}`:"";n(`${o}T${f}:${u}${T}${E($)}${D(l)}`)}const i=v.exec(e);if(i){const[,o,f,u,m,$,l]=i,T=m?`:${m}`:"";n(`${o}T${f}:${u}${T}${E($)}${D(l)}`)}const a=10,c=e.slice(0,a);if(H(c)){let o=a;for(;o<e.length&&N(e[o]);)o+=1;o<e.length&&n(`${c}T${e.slice(o)}`)}return t}function I(e){const t=Date.parse(e);if(Number.isFinite(t))return t;for(const n of C(e)){const r=Date.parse(n);if(Number.isFinite(r))return r}return Number.NaN}function H(e){if(e.length!==10)return!1;for(let t=0;t<e.length;t+=1){const n=e[t];if(t===4||t===7){if(n!=="-")return!1;continue}const r=n.charCodeAt(0);if(r<48||r>57)return!1}return!0}function N(e){return e?e===" "||e===" "||e===`
2
+ `||e==="\r"||e==="\f"||e==="\v":!1}function A(e,t){return new Date(Date.UTC(e,t+1,0)).getUTCDate()}const Z=["January","February","March","April","May","June","July","August","September","October","November","December"],B=/^(\d{4})-(\d{2})-(\d{2})/,G=/^(\d{4})(\d{2})(\d{2})(?:[T ]?\d{2}|$)/;function k(e,t,n){const r=B.exec(t)??G.exec(t);if(!r)return;const d=Number.parseInt(r[1],10),s=Number.parseInt(r[2],10),i=Number.parseInt(r[3],10),a=n?.trim()||"deadline";if(s<1||s>12)throw new M(`Invalid ${a} value "${e}". Month "${r[2]}" is out of range \u2014 use a month between 01 and 12.`,w.USAGE,{field:a,value:e});const c=A(d,s-1);if(i<1||i>c)throw new M(`Invalid ${a} value "${e}". ${Z[s-1]} ${d} has ${c} days, so day "${r[3]}" does not exist. Use a real YYYY-MM-DD calendar date.`,w.USAGE,{field:a,value:e})}function J(e,t){const n=new Date(e.getTime()),r=n.getUTCDate(),d=n.getUTCMonth()+t,s=n.getUTCFullYear()+Math.floor(d/12),i=(d%12+12)%12,a=Math.min(r,A(s,i));return n.setUTCFullYear(s,i,a),n}function te(e,t=new Date,n="deadline"){const r=e.trim();if(r.toLowerCase()==="now")return t.toISOString();const d=O.exec(r);if(d){const i=d[1]==="-"?-1:1,a=Number.parseInt(d[2],10)*i,c=d[3].toLowerCase();if(c==="m")return J(t,a).toISOString();const o=c==="h"?3600*1e3:c==="d"?1440*60*1e3:10080*60*1e3;return new Date(t.getTime()+a*o).toISOString()}k(e,r,n);const s=I(r);if(!Number.isFinite(s)){const i=n.trim().length>0?n.trim():"deadline",a=S.test(r)?"Compound relative expressions like +3d+1h are not supported; use a single relative token (for example +3d) or an ISO/date string.":'Use ISO/date string input, "now", or relative +6h/-6h/+1d/-1d/+2w/-2w/+6m/-6m.';throw new M(`Invalid ${i} value "${e}". ${a}`,w.USAGE,{field:i,value:e})}return new Date(s).toISOString()}const ne={normalizeOffset:D,pushTimestampCandidate:g,normalizeTimestampCandidates:C,parseTimestampWithFallbacks:I,isWhitespaceCharacter:N};export{ne as _testOnly,p as compareTimestampStrings,Q as isMillisecondPrecisionRfc3339DateTime,Y as isRfc3339DateTime,K as isTimestampLiteral,ee as matchesTimestampFilters,q as nowIso,te as resolveIsoOrRelative};
3
3
  //# sourceMappingURL=time.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a6bebd48-2722-5784-b69b-cf18321ea2c0")}catch{}})();import{AsyncLocalStorage}from"node:async_hooks";import{quoteWindowsCommandArg}from"./command-line.js";import{EXIT_CODE}from"./constants.js";import{PmCliError}from"./errors.js";const URL_CREDENTIAL_PLACEHOLDER="[redacted]";function provablyWithoutUserinfo(token,colon){if(/[\t\n\r]/u.test(token)||!/(?:^|[^A-Za-z0-9+.-])(?:https?|wss?|ftp)$/iu.test(token.slice(0,colon)))return!1;let authority=colon+1;for(;token[authority]==="/"||token[authority]==="\\";)authority+=1;const delimiter=token.indexOf("/",authority)-authority;if(delimiter<0)return!1;const authorityEnd=authority+delimiter;return!/[:@%]/u.test(token.slice(authority,authorityEnd))&&!/[:%]|[/\\][/\\]/u.test(token.slice(authorityEnd))}function userinfoBounds(token){const at=Math.max(token.lastIndexOf("@"),token.toLowerCase().lastIndexOf("%40")),colon=token.indexOf(":");if(at<0||colon<0||colon>at)return;let start=colon+1;for(;start<at&&start<colon+3&&(token[start]==="/"||token[start]==="\\");)start+=1;return start===at||provablyWithoutUserinfo(token,colon)?void 0:[start,at]}function redactUrlCredentialsInToken(token){const bounds=userinfoBounds(token);return bounds?`${token.slice(0,bounds[0])}${URL_CREDENTIAL_PLACEHOLDER}${token.slice(bounds[1])}`:token}function redactIdentityCredentials(identity){return redactUrlCredentialsInToken(identity)}const IDENTITY_FIELDS=["author","assignee","claim_principal"];function redactIdentityFields(values){const redacted={...values};for(const field of IDENTITY_FIELDS)typeof redacted[field]=="string"&&(redacted[field]=redactIdentityCredentials(redacted[field]));return redacted}function assertIdentityWithoutUrlCredentials(identity,source){if(!(typeof identity!="string"||userinfoBounds(identity.trim())===void 0))throw new PmCliError(`${source} must not carry URL credentials: an identity is a name, never a credential.`,EXIT_CODE.USAGE,{code:"invalid_argument_value",field:source,required:`Set ${source} to a plain name such as agent-a, with no URL userinfo (no user, password or token before the host).`,nextSteps:[`Rerun with ${source} set to a plain name.`],url_credentials_rejected:{source}})}function parseIdentityOption(value,source){return assertIdentityWithoutUrlCredentials(value,source),value}const NESTED_IDENTITY_PATHS=[["comments","author"],["notes","author"],["learnings","author"],["dependencies","author"],["plan_decisions","author"],["plan_discoveries","author"],["plan_steps","owner"],["tests","provenance","author"],["tests","updated_by"]],IDENTITY_VALUE_DEPTH=4;function assertIdentityValueWithoutUrlCredentials(value,source,depth=0){if(typeof value=="string"){assertIdentityWithoutUrlCredentials(value,source);return}if(!(depth>=IDENTITY_VALUE_DEPTH||typeof value!="object"||value===null))for(const entry of Object.values(value))assertIdentityValueWithoutUrlCredentials(entry,source,depth+1)}function readEntryPath(entry,path){let node=entry;for(const key of path){if(typeof node!="object"||node===null||Array.isArray(node))return;node=node[key]}return node}function assertIdentityFieldsWithoutUrlCredentials(values){const record=values;for(const field of IDENTITY_FIELDS)assertIdentityValueWithoutUrlCredentials(record[field],field);for(const[collection,...path]of NESTED_IDENTITY_PATHS){const entries=record[collection];Array.isArray(entries)&&entries.forEach((entry,index)=>{assertIdentityValueWithoutUrlCredentials(readEntryPath(entry,path),`${collection}[${index}].${path.join(".")}`)})}}function redactOptionalIdentityCredentials(value){return typeof value=="string"?redactIdentityCredentials(value):value}const MIN_FRAGMENT_LENGTH=6,MAX_REGISTERED_FRAGMENTS=65536,NO_INVOCATION={carried:!1,fragments:new Set,fragmentLength:MIN_FRAGMENT_LENGTH,shortSpellings:[]},invocations=new AsyncLocalStorage;function lowerPreservingLength(text){const lowered=text.toLowerCase();if(lowered.length===text.length)return lowered;let result="";for(const unit of text){const lower=unit.toLowerCase();result+=lower.length===unit.length?lower:unit}return result}function spanSpellings(span){return[span,span.replaceAll(/(["\\$`])/gu,"\\$1"),quoteWindowsCommandArg(`${span}@`).slice(1,-2),JSON.stringify(span).slice(1,-1)]}function userinfoSecret(userinfo){const colon=userinfo.indexOf(":");return colon>=0&&colon<userinfo.length-1?userinfo.slice(colon+1):userinfo}function describeInvocation(argv){const unique=new Set;let carried=!1;for(const token of argv){const bounds=userinfoBounds(token);if(bounds){carried=!0;for(const spelling of spanSpellings(userinfoSecret(token.slice(bounds[0],bounds[1]))))unique.add(lowerPreservingLength(spelling))}}const spellings=[...unique],positions=spellings.reduce((total,spelling)=>total+Math.max(0,spelling.length-MIN_FRAGMENT_LENGTH+1)+1,0),stride=Math.max(1,Math.ceil(positions/MAX_REGISTERED_FRAGMENTS)),fragmentLength=Math.max(MIN_FRAGMENT_LENGTH,stride),fragments=new Set,shortSpellings=new Set;for(const spelling of spellings){if(spelling.length<fragmentLength){(spelling.length>=MIN_FRAGMENT_LENGTH||/\s/u.test(spelling))&&shortSpellings.add(spelling);continue}for(let index=0;index+fragmentLength<=spelling.length;index+=stride)fragments.add(spelling.slice(index,index+fragmentLength));fragments.add(spelling.slice(-fragmentLength))}return{carried,fragments,fragmentLength,shortSpellings:[...shortSpellings]}}function removeRegisteredFragments(text,invocation){const lowered=lowerPreservingLength(text),covered=new Uint8Array(text.length);let found=!1;const width=invocation.fragmentLength;for(let index=0;index+width<=lowered.length;index+=1)invocation.fragments.has(lowered.slice(index,index+width))&&(covered.fill(1,index,index+width),found=!0);for(const spelling of invocation.shortSpellings)for(let index=lowered.indexOf(spelling);index>=0;index=lowered.indexOf(spelling,index+1))covered.fill(1,index,index+spelling.length),found=!0;if(!found)return text;let result="";for(let index=0;index<text.length;index+=1)covered[index]?(index===0||!covered[index-1])&&(result+=URL_CREDENTIAL_PLACEHOLDER):result+=text[index];return result}function runWithUrlCredentialInvocation(argv,run){return invocations.run(describeInvocation(argv),run)}function invocationCarriesUrlCredentials(){return(invocations.getStore()??NO_INVOCATION).carried}function redactUrlCredentialsInText(text){const invocation=invocations.getStore()??NO_INVOCATION,redacted=invocation.carried?removeRegisteredFragments(text,invocation):text;return/@|%40/iu.test(redacted)?redacted.replaceAll(/\S+/gu,redactUrlCredentialsInToken):redacted}export{URL_CREDENTIAL_PLACEHOLDER,assertIdentityFieldsWithoutUrlCredentials,assertIdentityWithoutUrlCredentials,invocationCarriesUrlCredentials,parseIdentityOption,redactIdentityCredentials,redactIdentityFields,redactOptionalIdentityCredentials,redactUrlCredentialsInText,redactUrlCredentialsInToken,runWithUrlCredentialInvocation};
1
+ import{AsyncLocalStorage as x}from"node:async_hooks";import{quoteWindowsCommandArg as A}from"./command-line.js";import{EXIT_CODE as C}from"./constants.js";import{PmCliError as T}from"./errors.js";const p="[redacted]";function L(t,e){if(/[\t\n\r]/u.test(t)||!/(?:^|[^A-Za-z0-9+.-])(?:https?|wss?|ftp)$/iu.test(t.slice(0,e)))return!1;let n=e+1;for(;t[n]==="/"||t[n]==="\\";)n+=1;const r=t.indexOf("/",n)-n;if(r<0)return!1;const i=n+r;return!/[:@%]/u.test(t.slice(n,i))&&!/[:%]|[/\\][/\\]/u.test(t.slice(i))}function u(t){const e=Math.max(t.lastIndexOf("@"),t.toLowerCase().lastIndexOf("%40")),n=t.indexOf(":");if(e<0||n<0||n>e)return;let r=n+1;for(;r<e&&r<n+3&&(t[r]==="/"||t[r]==="\\");)r+=1;return r===e||L(t,n)?void 0:[r,e]}function m(t){const e=u(t);return e?`${t.slice(0,e[0])}${p}${t.slice(e[1])}`:t}function y(t){return m(t)}const I=["author","assignee","claim_principal"];function j(t){const e={...t};for(const n of I)typeof e[n]=="string"&&(e[n]=y(e[n]));return e}function E(t,e){if(!(typeof t!="string"||u(t.trim())===void 0))throw new T(`${e} must not carry URL credentials: an identity is a name, never a credential.`,C.USAGE,{code:"invalid_argument_value",field:e,required:`Set ${e} to a plain name such as agent-a, with no URL userinfo (no user, password or token before the host).`,nextSteps:[`Rerun with ${e} set to a plain name.`],url_credentials_rejected:{source:e}})}function G(t,e){return E(t,e),t}const O=[["comments","author"],["notes","author"],["learnings","author"],["dependencies","author"],["plan_decisions","author"],["plan_discoveries","author"],["plan_steps","owner"],["tests","provenance","author"],["tests","updated_by"]],U=4;function h(t,e,n=0){if(typeof t=="string"){E(t,e);return}if(!(n>=U||typeof t!="object"||t===null))for(const r of Object.values(t))h(r,e,n+1)}function N(t,e){let n=t;for(const r of e){if(typeof n!="object"||n===null||Array.isArray(n))return;n=n[r]}return n}function H(t){const e=t;for(const n of I)h(e[n],n);for(const[n,...r]of O){const i=e[n];Array.isArray(i)&&i.forEach((a,l)=>{h(N(a,r),`${n}[${l}].${r.join(".")}`)})}}function q(t){return typeof t=="string"?y(t):t}const d=6,$=65536,w={carried:!1,fragments:new Set,fragmentLength:d,shortSpellings:[]},g=new x;function S(t){const e=t.toLowerCase();if(e.length===t.length)return e;let n="";for(const r of t){const i=r.toLowerCase();n+=i.length===r.length?i:r}return n}function R(t){return[t,t.replaceAll(/(["\\$`])/gu,"\\$1"),A(`${t}@`).slice(1,-2),JSON.stringify(t).slice(1,-1)]}function D(t){const e=t.indexOf(":");return e>=0&&e<t.length-1?t.slice(e+1):t}function b(t){const e=new Set;let n=!1;for(const s of t){const c=u(s);if(c){n=!0;for(const _ of R(D(s.slice(c[0],c[1]))))e.add(S(_))}}const r=[...e],i=r.reduce((s,c)=>s+Math.max(0,c.length-d+1)+1,0),a=Math.max(1,Math.ceil(i/$)),l=Math.max(d,a),o=new Set,f=new Set;for(const s of r){if(s.length<l){(s.length>=d||/\s/u.test(s))&&f.add(s);continue}for(let c=0;c+l<=s.length;c+=a)o.add(s.slice(c,c+l));o.add(s.slice(-l))}return{carried:n,fragments:o,fragmentLength:l,shortSpellings:[...f]}}function M(t,e){const n=S(t),r=new Uint8Array(t.length);let i=!1;const a=e.fragmentLength;for(let o=0;o+a<=n.length;o+=1)e.fragments.has(n.slice(o,o+a))&&(r.fill(1,o,o+a),i=!0);for(const o of e.shortSpellings)for(let f=n.indexOf(o);f>=0;f=n.indexOf(o,f+1))r.fill(1,f,f+o.length),i=!0;if(!i)return t;let l="";for(let o=0;o<t.length;o+=1)r[o]?(o===0||!r[o-1])&&(l+=p):l+=t[o];return l}function V(t,e){return g.run(b(t),e)}function Y(){return(g.getStore()??w).carried}function X(t){const e=g.getStore()??w,n=e.carried?M(t,e):t;return/@|%40/iu.test(n)?n.replaceAll(/\S+/gu,m):n}export{p as URL_CREDENTIAL_PLACEHOLDER,H as assertIdentityFieldsWithoutUrlCredentials,E as assertIdentityWithoutUrlCredentials,Y as invocationCarriesUrlCredentials,G as parseIdentityOption,y as redactIdentityCredentials,j as redactIdentityFields,q as redactOptionalIdentityCredentials,X as redactUrlCredentialsInText,m as redactUrlCredentialsInToken,V as runWithUrlCredentialInvocation};
2
2
  //# sourceMappingURL=url-credentials.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="73dc2a96-d38f-5599-9c1a-3f035d466c46")}catch{}})();export*from"./item-format-migration.js";export*from"./item-store.js";export*from"./paths.js";export*from"./settings.js";
1
+ export*from"./item-format-migration.js";export*from"./item-store.js";export*from"./paths.js";export*from"./settings.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- (function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="12ee7de1-dff4-53f1-8d0d-d8b1c1ebea42")}catch{}})();import fs from"node:fs/promises";import path from"node:path";import{runActiveOnWriteHooks}from"../extensions/index.js";import{readFileIfExists,removeFileIfExists,writeFileAtomic}from"../fs/fs-utils.js";import{parseItemDocument,serializeItemDocument}from"../item/item-format.js";import{TYPE_TO_FOLDER}from"../shared/constants.js";import{getItemFormatFromPath,getItemPath}from"./paths.js";function alternateItemFormat(_targetFormat){return"json_markdown"}function normalizeRelativePath(pmRoot,absolutePath){return path.relative(pmRoot,absolutePath).replaceAll("\\","/")}function errorSummary(error){return String(error).replaceAll(/[^a-zA-Z0-9._-]+/g,"_").slice(0,120)}async function assertLegacyAlternateSafeToRemove(sourcePath,alternatePath,schema){sourcePath!==alternatePath&&parseItemDocument(await fs.readFile(alternatePath,"utf8"),{format:"json_markdown",requireSupportedFormat:!0,schema})}async function migrateItemFilesToFormat(pmRoot,targetFormat,op="item_format:migrate",typeToFolder=TYPE_TO_FOLDER,schema){if(targetFormat!=="toon")throw new Error("Only toon item-format migration targets are supported. Markdown item files are legacy read-only input.");const migratedIds=new Set,removedPaths=new Set,warnings=[];let scanned=0;const alternateFormat=alternateItemFormat(targetFormat),typeEntries=Object.entries(typeToFolder);for(const[itemType,folder]of typeEntries){const directoryPath=path.join(pmRoot,folder);let files=[];try{files=await fs.readdir(directoryPath)}catch{continue}const variantsById=new Map;for(const file of files){const absolutePath=path.join(directoryPath,file),itemFormat=getItemFormatFromPath(absolutePath);if(!itemFormat)continue;const extension=path.extname(file),itemId=file.slice(0,file.length-extension.length).trim();if(itemId.length===0)continue;const entry=variantsById.get(itemId)??{};entry[itemFormat]=absolutePath,variantsById.set(itemId,entry)}const itemIds=[...variantsById.keys()].sort((left,right)=>left.localeCompare(right));for(const itemId of itemIds){const variants=variantsById.get(itemId);scanned+=1;const alternatePath=variants[alternateFormat];if(!alternatePath)continue;const sourcePath=variants[targetFormat]??alternatePath,sourceFormat=sourcePath===variants[targetFormat]?targetFormat:alternateFormat;try{const sourceRaw=await fs.readFile(sourcePath,"utf8"),parsedDocument=parseItemDocument(sourceRaw,{format:sourceFormat,requireSupportedFormat:!0,schema,onWarning:warning=>warnings.push(`item_format_migration_parse_warning:${itemId}:${warning}`)});await assertLegacyAlternateSafeToRemove(sourcePath,alternatePath,schema);const targetPath=getItemPath(pmRoot,itemType,itemId,targetFormat,typeToFolder),serializedTarget=serializeItemDocument(parsedDocument,{format:targetFormat,schema});await readFileIfExists(targetPath)!==serializedTarget&&(await writeFileAtomic(targetPath,serializedTarget),warnings.push(...await runActiveOnWriteHooks({path:targetPath,scope:"project",op})),migratedIds.add(itemId)),await removeFileIfExists(alternatePath),removedPaths.add(normalizeRelativePath(pmRoot,alternatePath)),warnings.push(...await runActiveOnWriteHooks({path:alternatePath,scope:"project",op:`${op}:remove`})),migratedIds.add(itemId)}catch(error){warnings.push(`item_format_migration_skipped:${normalizeRelativePath(pmRoot,sourcePath)}:${errorSummary(error)}`)}}}return{target_format:targetFormat,scanned,migrated:[...migratedIds].sort((left,right)=>left.localeCompare(right)),removed:[...removedPaths].sort((left,right)=>left.localeCompare(right)),warnings}}export{migrateItemFilesToFormat};
1
+ import h from"node:fs/promises";import p from"node:path";import{runActiveOnWriteHooks as x}from"../extensions/index.js";import{readFileIfExists as $,removeFileIfExists as z,writeFileAtomic as D}from"../fs/fs-utils.js";import{parseItemDocument as S,serializeItemDocument as C}from"../item/item-format.js";import{TYPE_TO_FOLDER as R}from"../shared/constants.js";import{getItemFormatFromPath as b,getItemPath as q}from"./paths.js";function L(r){return"json_markdown"}function T(r,t){return p.relative(r,t).replaceAll("\\","/")}function M(r){return String(r).replaceAll(/[^a-zA-Z0-9._-]+/g,"_").slice(0,120)}async function W(r,t,l){r!==t&&S(await h.readFile(t,"utf8"),{format:"json_markdown",requireSupportedFormat:!0,schema:l})}async function Q(r,t,l="item_format:migrate",_=R,d){if(t!=="toon")throw new Error("Only toon item-format migration targets are supported. Markdown item files are legacy read-only input.");const g=new Set,y=new Set,s=[];let I=0;const v=L(t),k=Object.entries(_);for(const[c,m]of k){const F=p.join(r,m);let P=[];try{P=await h.readdir(F)}catch{continue}const u=new Map;for(const e of P){const a=p.join(F,e),o=b(a);if(!o)continue;const n=p.extname(e),f=e.slice(0,e.length-n.length).trim();if(f.length===0)continue;const i=u.get(f)??{};i[o]=a,u.set(f,i)}const A=[...u.keys()].sort((e,a)=>e.localeCompare(a));for(const e of A){const a=u.get(e);I+=1;const o=a[v];if(!o)continue;const n=a[t]??o,f=n===a[t]?t:v;try{const i=await h.readFile(n,"utf8"),E=S(i,{format:f,requireSupportedFormat:!0,schema:d,onWarning:O=>s.push(`item_format_migration_parse_warning:${e}:${O}`)});await W(n,o,d);const w=q(r,c,e,t,_),j=C(E,{format:t,schema:d});await $(w)!==j&&(await D(w,j),s.push(...await x({path:w,scope:"project",op:l})),g.add(e)),await z(o),y.add(T(r,o)),s.push(...await x({path:o,scope:"project",op:`${l}:remove`})),g.add(e)}catch(i){s.push(`item_format_migration_skipped:${T(r,n)}:${M(i)}`)}}}return{target_format:t,scanned:I,migrated:[...g].sort((c,m)=>c.localeCompare(m)),removed:[...y].sort((c,m)=>c.localeCompare(m)),warnings:s}}export{Q as migrateItemFilesToFormat};
2
2
  //# sourceMappingURL=item-format-migration.js.map