@unbrained/pm-cli 2026.11.30 → 2026.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (382) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/cli/commander-usage.js +10 -10
  3. package/dist/cli/error-guidance.js +5 -5
  4. package/dist/cli/extension-command-help.js +6 -6
  5. package/dist/cli/help-json-payload.js +7 -7
  6. package/dist/cli/main.js +5 -5
  7. package/dist/cli/register-list-query.js +10 -10
  8. package/dist/cli/register-mutation.js +3 -3
  9. package/dist/cli/runtime/invocation-command-path.js +2 -0
  10. package/dist/cli/runtime/read-output-mutation-retry.js +1 -1
  11. package/dist/cli-bundle/bundle-manifest.json +1 -1
  12. package/dist/cli-bundle/chunks/{chunk-DCWGM7CY.js → chunk-3HKPVOAN.js} +2 -2
  13. package/dist/cli-bundle/chunks/{chunk-Z7YL2SUM.js → chunk-3KEMIPKG.js} +2 -2
  14. package/dist/cli-bundle/chunks/{chunk-TX74QJ4W.js → chunk-4YYFY33T.js} +2 -2
  15. package/dist/cli-bundle/chunks/{chunk-47ZS6RPL.js → chunk-7NAO7I75.js} +2 -2
  16. package/dist/cli-bundle/chunks/{chunk-IGEFPHV7.js → chunk-7V65VACG.js} +52 -52
  17. package/dist/cli-bundle/chunks/chunk-A5ZEMOVR.js +2 -0
  18. package/dist/cli-bundle/chunks/{chunk-5PNOVDVO.js → chunk-AHV3CSQG.js} +2 -2
  19. package/dist/cli-bundle/chunks/{chunk-KCVSSONY.js → chunk-C6WM6ZN4.js} +3 -3
  20. package/dist/cli-bundle/chunks/chunk-CBUC4X7Q.js +127 -0
  21. package/dist/cli-bundle/chunks/{chunk-CCKM5YQM.js → chunk-G6TARHFK.js} +2 -2
  22. package/dist/cli-bundle/chunks/{chunk-TY55UX6M.js → chunk-GOEQXVOI.js} +2 -2
  23. package/dist/cli-bundle/chunks/chunk-I4SPJQQI.js +3 -0
  24. package/dist/cli-bundle/chunks/{chunk-Q4VZSMUL.js → chunk-L2ZSSMYY.js} +2 -2
  25. package/dist/cli-bundle/chunks/{chunk-NHBG5ET3.js → chunk-MZZ4ZJ5Z.js} +2 -2
  26. package/dist/cli-bundle/chunks/chunk-NRQCBUYD.js +113 -0
  27. package/dist/cli-bundle/chunks/{chunk-YVTALIN3.js → chunk-OBPO6V7H.js} +2 -2
  28. package/dist/cli-bundle/chunks/{chunk-KXTKLDKD.js → chunk-OXC5KBIQ.js} +2 -2
  29. package/dist/cli-bundle/chunks/{chunk-HXQ3OHQR.js → chunk-PCDTWL6V.js} +2 -2
  30. package/dist/cli-bundle/chunks/{chunk-AOTI76Q6.js → chunk-Q6K7HWZ7.js} +2 -2
  31. package/dist/cli-bundle/chunks/chunk-QDV7S2QS.js +2 -0
  32. package/dist/cli-bundle/chunks/{chunk-NZSXWIX7.js → chunk-ROTEELDL.js} +7 -7
  33. package/dist/cli-bundle/chunks/{chunk-WFYE34TO.js → chunk-SDXCJZKB.js} +23 -23
  34. package/dist/cli-bundle/chunks/{chunk-2SBTXR6C.js → chunk-SY5C3U32.js} +3 -3
  35. package/dist/cli-bundle/chunks/{chunk-FR7ULTM4.js → chunk-TKUG2X24.js} +2 -2
  36. package/dist/cli-bundle/chunks/{chunk-FECZV72T.js → chunk-UNBW2LF3.js} +2 -2
  37. package/dist/cli-bundle/chunks/chunk-V2S4XAX3.js +2 -0
  38. package/dist/cli-bundle/chunks/chunk-WSEIEDEK.js +2 -0
  39. package/dist/cli-bundle/chunks/{chunk-ZA5NS3PL.js → chunk-ZL6J6JYT.js} +6 -6
  40. package/dist/cli-bundle/chunks/{field-option-collisions-2F2Z7R7B.js → field-option-collisions-BBGTV7AD.js} +2 -2
  41. package/dist/cli-bundle/chunks/item-revision-3LENTXYF.js +2 -0
  42. package/dist/cli-bundle/chunks/item-transaction-56J5OCHA.js +2 -0
  43. package/dist/cli-bundle/chunks/{linked-resource-value-list-WXPPYUVQ.js → linked-resource-value-list-ZBIY4H23.js} +2 -2
  44. package/dist/cli-bundle/chunks/{mutation-actor-UK3QNEEB.js → mutation-actor-NHN33ITJ.js} +2 -2
  45. package/dist/cli-bundle/chunks/{mutation-admission-UTDYPFWP.js → mutation-admission-PGKJTCG6.js} +2 -2
  46. package/dist/cli-bundle/chunks/{register-list-query-DRA3CWHI.js → register-list-query-7S5QWDTI.js} +11 -11
  47. package/dist/cli-bundle/chunks/{register-mutation-WO74VLEQ.js → register-mutation-EK6DVIQK.js} +5 -5
  48. package/dist/cli-bundle/chunks/{register-operations-CRBKH7WN.js → register-operations-6MURXE4V.js} +2 -2
  49. package/dist/cli-bundle/chunks/{register-setup-6V6NQB5C.js → register-setup-RW26X3GJ.js} +2 -2
  50. package/dist/cli-bundle/chunks/{stage-DYEHGASU.js → stage-4ZCF74G4.js} +2 -2
  51. package/dist/cli-bundle/focused-chunks/{chunk-RQYVX2T6.js → chunk-2DGKVXFT.js} +2 -2
  52. package/dist/cli-bundle/focused-chunks/chunk-2UWKU2BQ.js +3 -0
  53. package/dist/cli-bundle/focused-chunks/{chunk-A3DORTXS.js → chunk-3COWDIPX.js} +54 -54
  54. package/dist/cli-bundle/focused-chunks/{chunk-UQJ4PY2Y.js → chunk-4SCFAWAW.js} +2 -2
  55. package/dist/cli-bundle/focused-chunks/{chunk-7G7JIXLL.js → chunk-6BKT6XQN.js} +2 -2
  56. package/dist/cli-bundle/focused-chunks/chunk-6IY5CVGJ.js +2 -0
  57. package/dist/cli-bundle/focused-chunks/chunk-7A6SEZEY.js +4 -0
  58. package/dist/cli-bundle/focused-chunks/{chunk-IJ3T3W4U.js → chunk-BHNBPCHP.js} +2 -2
  59. package/dist/cli-bundle/focused-chunks/{chunk-LWBZ7UGG.js → chunk-EQCQTYKO.js} +2 -2
  60. package/dist/cli-bundle/focused-chunks/{chunk-FM5WQ6ZU.js → chunk-HTDYNY4L.js} +2 -2
  61. package/dist/cli-bundle/focused-chunks/{chunk-TQQO42C2.js → chunk-J72TRWR5.js} +26 -26
  62. package/dist/cli-bundle/focused-chunks/{chunk-L357ZAES.js → chunk-JPZGC3W4.js} +5 -5
  63. package/dist/cli-bundle/focused-chunks/{chunk-62AMZMR4.js → chunk-KNBGHCIP.js} +3 -3
  64. package/dist/cli-bundle/focused-chunks/chunk-N64AC5G6.js +100 -0
  65. package/dist/cli-bundle/focused-chunks/{chunk-IIVDBAJM.js → chunk-OG57ESZK.js} +2 -2
  66. package/dist/cli-bundle/focused-chunks/{chunk-MZNV26XE.js → chunk-P2H3GTJK.js} +2 -2
  67. package/dist/cli-bundle/focused-chunks/chunk-QZRYGYTI.js +2 -0
  68. package/dist/cli-bundle/focused-chunks/chunk-SQMOF65W.js +2 -0
  69. package/dist/cli-bundle/focused-chunks/chunk-T3ILWAEV.js +2 -0
  70. package/dist/cli-bundle/focused-chunks/{chunk-SXC3NVZI.js → chunk-TR22GU7M.js} +2 -2
  71. package/dist/cli-bundle/focused-chunks/{chunk-M57KDG7I.js → chunk-TXTPAFHJ.js} +2 -2
  72. package/dist/cli-bundle/focused-chunks/chunk-VK3IE3TS.js +29 -0
  73. package/dist/cli-bundle/focused-chunks/{chunk-NJTKGBSK.js → chunk-VQIC3UZB.js} +2 -2
  74. package/dist/cli-bundle/focused-chunks/{chunk-U35K7FSE.js → chunk-W4JMV7GF.js} +2 -2
  75. package/dist/cli-bundle/focused-chunks/{field-option-collisions-7TG7STO7.js → field-option-collisions-2C6DLUC4.js} +2 -2
  76. package/dist/cli-bundle/focused-chunks/item-revision-723XCQPS.js +2 -0
  77. package/dist/cli-bundle/focused-chunks/{item-transaction-2IC2MLML.js → item-transaction-LQLQLZE7.js} +2 -2
  78. package/dist/cli-bundle/focused-chunks/{mutation-actor-LJVF2HVD.js → mutation-actor-DJMZUIZI.js} +2 -2
  79. package/dist/cli-bundle/focused-chunks/mutation-admission-SDWQVVHN.js +2 -0
  80. package/dist/cli-bundle/focused-chunks/{stage-MWR73LTZ.js → stage-QBZIK3T5.js} +2 -2
  81. package/dist/cli-bundle/main.js +27 -27
  82. package/dist/cli-bundle/sdk-authoring.js +1 -1
  83. package/dist/cli-bundle/sdk-contracts.js +1 -1
  84. package/dist/cli-bundle/sdk-core.js +1 -1
  85. package/dist/cli-bundle/sdk-governance.js +1 -1
  86. package/dist/cli-bundle/sdk-graph.js +1 -1
  87. package/dist/cli-bundle/sdk-merge.js +61 -61
  88. package/dist/cli-bundle/sdk-query.js +1 -1
  89. package/dist/cli-bundle/sdk-runtime.js +1 -1
  90. package/dist/cli-bundle/sdk-testing.js +1 -1
  91. package/dist/cli-bundle/sdk.js +2 -2
  92. package/dist/core/extensions/reserved-host-flags.js +1 -1
  93. package/dist/core/shared/secret-rules.d.ts +86 -12
  94. package/dist/core/shared/secret-rules.js +7 -5
  95. package/dist/sdk/cli-bootstrap.js +1 -1
  96. package/dist/sdk/cli-contracts/flag-contracts.d.ts +50 -0
  97. package/dist/sdk/cli-contracts/flag-contracts.js +1 -1
  98. package/dist/sdk/cli-contracts/runtime-contracts.d.ts +3 -1
  99. package/dist/sdk/cli-contracts/runtime-contracts.js +1 -1
  100. package/dist/sdk/extension/command-options.js +1 -1
  101. package/dist/sdk/extension/install-sources.d.ts +2 -2
  102. package/dist/sdk/extension/install-sources.js +5 -5
  103. package/dist/sdk/lifecycle/expect-hash-admission.d.ts +15 -0
  104. package/dist/sdk/lifecycle/expect-hash-admission.js +2 -0
  105. package/dist/sdk/lifecycle/item-revision.d.ts +4 -1
  106. package/dist/sdk/lifecycle/item-revision.js +1 -1
  107. package/dist/sdk/mutation-guard.js +1 -1
  108. package/dist/sdk/output-contracts.js +1 -1
  109. package/dist/sdk/output-projection.d.ts +1 -1
  110. package/dist/sdk/output-projection.js +1 -1
  111. package/dist/sdk/public-surface.json +1 -1
  112. package/dist/sdk/query/aggregate.js +1 -1
  113. package/dist/sdk/query/context.js +1 -1
  114. package/dist/sdk/query/list.js +1 -1
  115. package/dist/sdk/query/next.js +1 -1
  116. package/dist/sdk/query/search-contracts.js +1 -1
  117. package/dist/sdk/read-output/surfaces.js +1 -1
  118. package/dist/sdk/read-output-budget.d.ts +1 -1
  119. package/dist/sdk/read-output-budget.js +1 -1
  120. package/dist/sdk/read-output-contracts.js +1 -1
  121. package/dist/sdk/read-output-rows.js +1 -1
  122. package/docs/COMMANDS.md +37 -0
  123. package/docs/MUTATION_INTEGRITY.md +226 -10
  124. package/docs/SDK.md +16 -6
  125. package/docs/agent-task-token-baseline.json +1 -1
  126. package/marketplace.json +1 -1
  127. package/node_modules/tar/README.md +1792 -1147
  128. package/node_modules/tar/dist/commonjs/bytes.d.ts +21 -0
  129. package/node_modules/tar/dist/commonjs/bytes.js +83 -0
  130. package/node_modules/tar/dist/commonjs/codec.d.ts +53 -0
  131. package/node_modules/tar/dist/commonjs/codec.js +35 -0
  132. package/node_modules/tar/dist/commonjs/concat.d.ts +3 -0
  133. package/node_modules/tar/dist/commonjs/concat.js +20 -0
  134. package/node_modules/tar/dist/commonjs/create.d.ts +39 -2
  135. package/node_modules/tar/dist/commonjs/create.js +150 -64
  136. package/node_modules/tar/dist/commonjs/dealias.d.ts +79 -0
  137. package/node_modules/tar/dist/commonjs/dealias.js +50 -0
  138. package/node_modules/tar/dist/commonjs/delete.d.ts +19 -0
  139. package/node_modules/tar/dist/commonjs/delete.js +121 -0
  140. package/node_modules/tar/dist/commonjs/entries.d.ts +82 -0
  141. package/node_modules/tar/dist/commonjs/entries.js +398 -0
  142. package/node_modules/tar/dist/commonjs/extract.d.ts +14 -2
  143. package/node_modules/tar/dist/commonjs/extract.js +40 -81
  144. package/node_modules/tar/dist/commonjs/fs.d.ts +201 -0
  145. package/node_modules/tar/dist/commonjs/fs.js +5 -0
  146. package/node_modules/tar/dist/commonjs/header.d.ts +4 -4
  147. package/node_modules/tar/dist/commonjs/header.js +71 -53
  148. package/node_modules/tar/dist/commonjs/index.d.ts +25 -18
  149. package/node_modules/tar/dist/commonjs/index.js +46 -18
  150. package/node_modules/tar/dist/commonjs/index.min.js +2 -3
  151. package/node_modules/tar/dist/commonjs/large-numbers.d.ts +2 -2
  152. package/node_modules/tar/dist/commonjs/large-numbers.js +4 -4
  153. package/node_modules/tar/dist/commonjs/list.d.ts +23 -6
  154. package/node_modules/tar/dist/commonjs/list.js +99 -138
  155. package/node_modules/tar/dist/commonjs/mkdir.d.ts +16 -11
  156. package/node_modules/tar/dist/commonjs/mkdir.js +121 -159
  157. package/node_modules/tar/dist/commonjs/normalize-unicode.js +9 -0
  158. package/node_modules/tar/dist/commonjs/options.d.ts +284 -513
  159. package/node_modules/tar/dist/commonjs/options.js +20 -61
  160. package/node_modules/tar/dist/commonjs/pack.d.ts +150 -96
  161. package/node_modules/tar/dist/commonjs/pack.js +752 -445
  162. package/node_modules/tar/dist/commonjs/parser.d.ts +98 -0
  163. package/node_modules/tar/dist/commonjs/parser.js +452 -0
  164. package/node_modules/tar/dist/commonjs/path-reservations.d.ts +17 -7
  165. package/node_modules/tar/dist/commonjs/path-reservations.js +110 -140
  166. package/node_modules/tar/dist/commonjs/path.d.ts +19 -0
  167. package/node_modules/tar/dist/commonjs/path.js +90 -0
  168. package/node_modules/tar/dist/commonjs/pax.d.ts +3 -1
  169. package/node_modules/tar/dist/commonjs/pax.js +67 -36
  170. package/node_modules/tar/dist/commonjs/read-entry.d.ts +97 -11
  171. package/node_modules/tar/dist/commonjs/read-entry.js +251 -97
  172. package/node_modules/tar/dist/commonjs/read-file.d.ts +22 -0
  173. package/node_modules/tar/dist/commonjs/read-file.js +104 -0
  174. package/node_modules/tar/dist/commonjs/replace.d.ts +45 -1
  175. package/node_modules/tar/dist/commonjs/replace.js +164 -211
  176. package/node_modules/tar/dist/commonjs/server/codecs.d.ts +38 -0
  177. package/node_modules/tar/dist/commonjs/server/codecs.js +252 -0
  178. package/node_modules/tar/dist/commonjs/server/index.d.ts +115 -0
  179. package/node_modules/tar/dist/commonjs/server/index.js +166 -0
  180. package/node_modules/tar/dist/commonjs/server/index.min.js +3 -0
  181. package/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +8 -0
  182. package/node_modules/tar/dist/commonjs/strip-absolute-path.js +17 -20
  183. package/node_modules/tar/dist/commonjs/to-stream.d.ts +7 -0
  184. package/node_modules/tar/dist/commonjs/to-stream.js +22 -0
  185. package/node_modules/tar/dist/commonjs/types.d.ts +4 -3
  186. package/node_modules/tar/dist/commonjs/types.js +4 -3
  187. package/node_modules/tar/dist/commonjs/unpack.d.ts +143 -89
  188. package/node_modules/tar/dist/commonjs/unpack.js +780 -725
  189. package/node_modules/tar/dist/commonjs/update.d.ts +11 -1
  190. package/node_modules/tar/dist/commonjs/update.js +37 -28
  191. package/node_modules/tar/dist/commonjs/warn.d.ts +27 -0
  192. package/node_modules/tar/dist/commonjs/warn.js +36 -0
  193. package/node_modules/tar/dist/commonjs/win32-path.d.ts +16 -0
  194. package/node_modules/tar/dist/commonjs/win32-path.js +67 -0
  195. package/node_modules/tar/dist/commonjs/write-entry.d.ts +64 -111
  196. package/node_modules/tar/dist/commonjs/write-entry.js +108 -672
  197. package/node_modules/tar/dist/commonjs/write-flag.d.ts +18 -0
  198. package/node_modules/tar/dist/commonjs/write-flag.js +29 -0
  199. package/node_modules/tar/dist/esm/bytes.d.ts +21 -0
  200. package/node_modules/tar/dist/esm/bytes.js +72 -0
  201. package/node_modules/tar/dist/esm/codec.d.ts +53 -0
  202. package/node_modules/tar/dist/esm/codec.js +32 -0
  203. package/node_modules/tar/dist/esm/concat.d.ts +3 -0
  204. package/node_modules/tar/dist/esm/concat.js +16 -0
  205. package/node_modules/tar/dist/esm/create.d.ts +39 -2
  206. package/node_modules/tar/dist/esm/create.js +144 -61
  207. package/node_modules/tar/dist/esm/dealias.d.ts +79 -0
  208. package/node_modules/tar/dist/esm/dealias.js +46 -0
  209. package/node_modules/tar/dist/esm/delete.d.ts +19 -0
  210. package/node_modules/tar/dist/esm/delete.js +117 -0
  211. package/node_modules/tar/dist/esm/entries.d.ts +82 -0
  212. package/node_modules/tar/dist/esm/entries.js +388 -0
  213. package/node_modules/tar/dist/esm/extract.d.ts +14 -2
  214. package/node_modules/tar/dist/esm/extract.js +37 -44
  215. package/node_modules/tar/dist/esm/fs.d.ts +201 -0
  216. package/node_modules/tar/dist/esm/fs.js +4 -0
  217. package/node_modules/tar/dist/esm/header.d.ts +4 -4
  218. package/node_modules/tar/dist/esm/header.js +71 -53
  219. package/node_modules/tar/dist/esm/index.d.ts +25 -18
  220. package/node_modules/tar/dist/esm/index.js +23 -18
  221. package/node_modules/tar/dist/esm/index.min.js +2 -3
  222. package/node_modules/tar/dist/esm/large-numbers.d.ts +2 -2
  223. package/node_modules/tar/dist/esm/large-numbers.js +4 -4
  224. package/node_modules/tar/dist/esm/list.d.ts +23 -6
  225. package/node_modules/tar/dist/esm/list.js +96 -101
  226. package/node_modules/tar/dist/esm/mkdir.d.ts +16 -11
  227. package/node_modules/tar/dist/esm/mkdir.js +119 -154
  228. package/node_modules/tar/dist/esm/normalize-unicode.js +9 -0
  229. package/node_modules/tar/dist/esm/options.d.ts +284 -513
  230. package/node_modules/tar/dist/esm/options.js +17 -51
  231. package/node_modules/tar/dist/esm/pack.d.ts +150 -96
  232. package/node_modules/tar/dist/esm/pack.js +750 -441
  233. package/node_modules/tar/dist/esm/parser.d.ts +98 -0
  234. package/node_modules/tar/dist/esm/parser.js +448 -0
  235. package/node_modules/tar/dist/esm/path-reservations.d.ts +17 -7
  236. package/node_modules/tar/dist/esm/path-reservations.js +110 -140
  237. package/node_modules/tar/dist/esm/path.d.ts +19 -0
  238. package/node_modules/tar/dist/esm/path.js +80 -0
  239. package/node_modules/tar/dist/esm/pax.d.ts +3 -1
  240. package/node_modules/tar/dist/esm/pax.js +66 -35
  241. package/node_modules/tar/dist/esm/read-entry.d.ts +97 -11
  242. package/node_modules/tar/dist/esm/read-entry.js +248 -96
  243. package/node_modules/tar/dist/esm/read-file.d.ts +22 -0
  244. package/node_modules/tar/dist/esm/read-file.js +99 -0
  245. package/node_modules/tar/dist/esm/replace.d.ts +45 -1
  246. package/node_modules/tar/dist/esm/replace.js +160 -207
  247. package/node_modules/tar/dist/esm/server/codecs.d.ts +38 -0
  248. package/node_modules/tar/dist/esm/server/codecs.js +214 -0
  249. package/node_modules/tar/dist/esm/server/index.d.ts +115 -0
  250. package/node_modules/tar/dist/esm/server/index.js +102 -0
  251. package/node_modules/tar/dist/esm/server/index.min.js +3 -0
  252. package/node_modules/tar/dist/esm/strip-absolute-path.d.ts +8 -0
  253. package/node_modules/tar/dist/esm/strip-absolute-path.js +17 -20
  254. package/node_modules/tar/dist/esm/to-stream.d.ts +7 -0
  255. package/node_modules/tar/dist/esm/to-stream.js +18 -0
  256. package/node_modules/tar/dist/esm/types.d.ts +4 -3
  257. package/node_modules/tar/dist/esm/types.js +4 -3
  258. package/node_modules/tar/dist/esm/unpack.d.ts +143 -89
  259. package/node_modules/tar/dist/esm/unpack.js +776 -719
  260. package/node_modules/tar/dist/esm/update.d.ts +11 -1
  261. package/node_modules/tar/dist/esm/update.js +35 -28
  262. package/node_modules/tar/dist/esm/warn.d.ts +27 -0
  263. package/node_modules/tar/dist/esm/warn.js +31 -0
  264. package/node_modules/tar/dist/esm/win32-path.d.ts +16 -0
  265. package/node_modules/tar/dist/esm/win32-path.js +60 -0
  266. package/node_modules/tar/dist/esm/write-entry.d.ts +64 -111
  267. package/node_modules/tar/dist/esm/write-entry.js +107 -633
  268. package/node_modules/tar/dist/esm/write-flag.d.ts +18 -0
  269. package/node_modules/tar/dist/esm/write-flag.js +25 -0
  270. package/node_modules/tar/package.json +68 -224
  271. package/package.json +2 -2
  272. package/packages/pm-beads/package.json +1 -1
  273. package/packages/pm-calendar/package.json +1 -1
  274. package/packages/pm-command-kit/package.json +1 -1
  275. package/packages/pm-digital-twin/package.json +1 -1
  276. package/packages/pm-governance-audit/package.json +1 -1
  277. package/packages/pm-guide-shell/package.json +1 -1
  278. package/packages/pm-kanban/package.json +1 -1
  279. package/packages/pm-lifecycle-hooks/package.json +1 -1
  280. package/packages/pm-linked-test-adapters/package.json +1 -1
  281. package/packages/pm-search-advanced/package.json +1 -1
  282. package/packages/pm-templates/package.json +1 -1
  283. package/packages/pm-todos/package.json +1 -1
  284. package/packages/pm-vcs/package.json +1 -1
  285. package/plugins/pm-claude/.claude-plugin/plugin.json +1 -1
  286. package/plugins/pm-claude/package.json +1 -1
  287. package/plugins/pm-codex/.codex-plugin/plugin.json +1 -1
  288. package/plugins/pm-codex/package.json +1 -1
  289. package/plugins/pm-codex/plugin.json +1 -1
  290. package/runtime-dependencies.json +1 -1
  291. package/dist/cli-bundle/chunks/chunk-3TXEWHQX.js +0 -125
  292. package/dist/cli-bundle/chunks/chunk-JPJNJHQW.js +0 -2
  293. package/dist/cli-bundle/chunks/chunk-NVYDPNQP.js +0 -2
  294. package/dist/cli-bundle/chunks/chunk-SJWIPGZW.js +0 -113
  295. package/dist/cli-bundle/chunks/chunk-USBTXMKS.js +0 -2
  296. package/dist/cli-bundle/chunks/chunk-VCXQ6A35.js +0 -3
  297. package/dist/cli-bundle/chunks/chunk-YPMNXG2C.js +0 -2
  298. package/dist/cli-bundle/chunks/item-revision-UAF6L47R.js +0 -2
  299. package/dist/cli-bundle/chunks/item-transaction-RJECL53Y.js +0 -2
  300. package/dist/cli-bundle/focused-chunks/chunk-2UUBS4BG.js +0 -2
  301. package/dist/cli-bundle/focused-chunks/chunk-4ER3VMST.js +0 -2
  302. package/dist/cli-bundle/focused-chunks/chunk-4YBMHMBJ.js +0 -2
  303. package/dist/cli-bundle/focused-chunks/chunk-HXM7K6VH.js +0 -100
  304. package/dist/cli-bundle/focused-chunks/chunk-NGHT2LNG.js +0 -3
  305. package/dist/cli-bundle/focused-chunks/chunk-P55AZPFN.js +0 -2
  306. package/dist/cli-bundle/focused-chunks/chunk-WAP3DF4B.js +0 -27
  307. package/dist/cli-bundle/focused-chunks/chunk-XR745UGE.js +0 -4
  308. package/dist/cli-bundle/focused-chunks/item-revision-J7EUGCHR.js +0 -2
  309. package/dist/cli-bundle/focused-chunks/mutation-admission-SLFAUONA.js +0 -2
  310. package/node_modules/@isaacs/fs-minipass/LICENSE +0 -15
  311. package/node_modules/@isaacs/fs-minipass/README.md +0 -71
  312. package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts +0 -118
  313. package/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js +0 -430
  314. package/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json +0 -3
  315. package/node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts +0 -118
  316. package/node_modules/@isaacs/fs-minipass/dist/esm/index.js +0 -420
  317. package/node_modules/@isaacs/fs-minipass/dist/esm/package.json +0 -3
  318. package/node_modules/@isaacs/fs-minipass/package.json +0 -72
  319. package/node_modules/chownr/LICENSE.md +0 -63
  320. package/node_modules/chownr/README.md +0 -3
  321. package/node_modules/chownr/dist/commonjs/index.d.ts +0 -3
  322. package/node_modules/chownr/dist/commonjs/index.js +0 -93
  323. package/node_modules/chownr/dist/commonjs/package.json +0 -3
  324. package/node_modules/chownr/dist/esm/index.d.ts +0 -3
  325. package/node_modules/chownr/dist/esm/index.js +0 -85
  326. package/node_modules/chownr/dist/esm/package.json +0 -3
  327. package/node_modules/chownr/package.json +0 -69
  328. package/node_modules/minipass/LICENSE.md +0 -55
  329. package/node_modules/minipass/README.md +0 -825
  330. package/node_modules/minipass/dist/commonjs/index.d.ts +0 -545
  331. package/node_modules/minipass/dist/commonjs/index.js +0 -1038
  332. package/node_modules/minipass/dist/commonjs/package.json +0 -3
  333. package/node_modules/minipass/dist/esm/index.d.ts +0 -545
  334. package/node_modules/minipass/dist/esm/index.js +0 -1020
  335. package/node_modules/minipass/dist/esm/package.json +0 -3
  336. package/node_modules/minipass/package.json +0 -77
  337. package/node_modules/minizlib/LICENSE +0 -26
  338. package/node_modules/minizlib/README.md +0 -64
  339. package/node_modules/minizlib/dist/commonjs/constants.d.ts +0 -2
  340. package/node_modules/minizlib/dist/commonjs/constants.js +0 -123
  341. package/node_modules/minizlib/dist/commonjs/index.d.ts +0 -99
  342. package/node_modules/minizlib/dist/commonjs/index.js +0 -416
  343. package/node_modules/minizlib/dist/commonjs/package.json +0 -3
  344. package/node_modules/minizlib/dist/esm/constants.d.ts +0 -2
  345. package/node_modules/minizlib/dist/esm/constants.js +0 -117
  346. package/node_modules/minizlib/dist/esm/index.d.ts +0 -99
  347. package/node_modules/minizlib/dist/esm/index.js +0 -363
  348. package/node_modules/minizlib/dist/esm/package.json +0 -3
  349. package/node_modules/minizlib/package.json +0 -80
  350. package/node_modules/tar/dist/commonjs/get-write-flag.d.ts +0 -2
  351. package/node_modules/tar/dist/commonjs/get-write-flag.js +0 -32
  352. package/node_modules/tar/dist/commonjs/make-command.d.ts +0 -49
  353. package/node_modules/tar/dist/commonjs/make-command.js +0 -52
  354. package/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +0 -2
  355. package/node_modules/tar/dist/commonjs/normalize-windows-path.js +0 -12
  356. package/node_modules/tar/dist/commonjs/parse.d.ts +0 -92
  357. package/node_modules/tar/dist/commonjs/parse.js +0 -655
  358. package/node_modules/tar/dist/commonjs/process-umask.d.ts +0 -2
  359. package/node_modules/tar/dist/commonjs/process-umask.js +0 -7
  360. package/node_modules/tar/dist/commonjs/warn-method.d.ts +0 -24
  361. package/node_modules/tar/dist/commonjs/warn-method.js +0 -31
  362. package/node_modules/tar/dist/esm/get-write-flag.d.ts +0 -2
  363. package/node_modules/tar/dist/esm/get-write-flag.js +0 -26
  364. package/node_modules/tar/dist/esm/make-command.d.ts +0 -49
  365. package/node_modules/tar/dist/esm/make-command.js +0 -48
  366. package/node_modules/tar/dist/esm/normalize-windows-path.d.ts +0 -2
  367. package/node_modules/tar/dist/esm/normalize-windows-path.js +0 -9
  368. package/node_modules/tar/dist/esm/parse.d.ts +0 -92
  369. package/node_modules/tar/dist/esm/parse.js +0 -651
  370. package/node_modules/tar/dist/esm/process-umask.d.ts +0 -2
  371. package/node_modules/tar/dist/esm/process-umask.js +0 -3
  372. package/node_modules/tar/dist/esm/warn-method.d.ts +0 -24
  373. package/node_modules/tar/dist/esm/warn-method.js +0 -27
  374. package/node_modules/yallist/LICENSE.md +0 -63
  375. package/node_modules/yallist/README.md +0 -205
  376. package/node_modules/yallist/dist/commonjs/index.d.ts +0 -39
  377. package/node_modules/yallist/dist/commonjs/index.js +0 -384
  378. package/node_modules/yallist/dist/commonjs/package.json +0 -3
  379. package/node_modules/yallist/dist/esm/index.d.ts +0 -39
  380. package/node_modules/yallist/dist/esm/index.js +0 -379
  381. package/node_modules/yallist/dist/esm/package.json +0 -3
  382. package/node_modules/yallist/package.json +0 -68
@@ -1,8 +1,3 @@
1
- /**
2
- * @module core/shared/secret-rules
3
- * Single credential and private-context detector inventory for mutation preflight
4
- * and repository scanning. Diagnostics must never include matched text.
5
- */
6
1
  /** Safe transformation identities; neither original nor decoded values escape. */
7
2
  export type SecretNormalizationKind="percent_decode"|"json_unescape"|"unicode_fold";
8
3
  /** Original source location and optional inspection provenance. */
@@ -98,8 +93,86 @@ regex:RegExp;
98
93
  value:string;}
99
94
  /** Canonical patterns; repository exemptions never exempt mutation payloads. */
100
95
  export declare const SECRET_RULES:readonly[{readonly name:"private-key";readonly mutationRule:"private_key";readonly category:"credential";readonly regex:RegExp;},{readonly name:"github-token";readonly mutationRule:"github_token";readonly category:"credential";readonly regex:RegExp;},{readonly name:"npm-token";readonly mutationRule:"npm_token";readonly category:"credential";readonly regex:RegExp;},{readonly name:"aws-access-key";readonly mutationRule:"aws_access_key";readonly category:"credential";readonly regex:RegExp;},{readonly name:"google-api-key";readonly mutationRule:"google_api_key";readonly category:"credential";readonly regex:RegExp;},{readonly name:"slack-token";readonly mutationRule:"slack_token";readonly category:"credential";readonly regex:RegExp;},{readonly name:"anthropic-api-key";readonly mutationRule:"anthropic_api_key";readonly category:"credential";readonly regex:RegExp;},{readonly name:"openai-api-key";readonly mutationRule:"openai_api_key";readonly category:"credential";readonly regex:RegExp;},{readonly name:"gitlab-token";readonly mutationRule:"gitlab_token";readonly category:"credential";readonly regex:RegExp;},{readonly name:"jwt-like-token";readonly mutationRule:"jwt_like_token";readonly category:"credential";readonly regex:RegExp;},{readonly name:"npm-auth-token-assignment";readonly mutationRule:"npm_auth_token_assignment";readonly category:"credential";readonly regex:RegExp;},{readonly name:"sentry-user-token";readonly mutationRule:"sentry_user_token";readonly category:"credential";readonly regex:RegExp;},{readonly name:"sentry-org-token";readonly mutationRule:"sentry_org_token";readonly category:"credential";readonly regex:RegExp;},{readonly name:"private-ip";readonly mutationRule:"private_ip";readonly category:"network";readonly regex:RegExp;},{readonly name:"private-ssh-target";readonly mutationRule:"private_ssh_target";readonly category:"network";readonly regex:RegExp;},{readonly name:"sshpass-inline-password";readonly mutationRule:"sshpass_inline_password";readonly category:"credential";readonly regex:RegExp;},{readonly name:"password-assignment";readonly mutationRule:"password_assignment";readonly category:"credential";readonly regex:RegExp;readonly structured:{readonly keys:"password|passphrase";readonly value:string;readonly element:true;};readonly minimumLiteralLength:8;},{readonly name:"absolute-home-path";readonly mutationRule:"absolute_home_path";readonly category:"path";readonly regex:RegExp;readonly excludeFiles:RegExp;},{readonly name:"user-at-private-host";readonly mutationRule:"user_at_private_host";readonly category:"network";readonly regex:RegExp;readonly excludeFiles:RegExp;},{readonly name:"high-entropy-assignment";readonly mutationRule:"high_entropy_assignment";readonly category:"credential";readonly regex:RegExp;readonly structured:{readonly keys:"token|secret|password|passwd|api[_-]?key";readonly value:string;};readonly mutationOnlyReason:"Generic assignments in source code are not credentials; preserve the existing mutation heuristic without treating source identifiers as secrets.";readonly minimumEntropy:3.5;},{readonly name:"credential-key-assignment";readonly mutationRule:"credential_key_assignment";readonly category:"credential";readonly regex:RegExp;readonly structured:{readonly 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))";readonly value:string;readonly element:true;readonly elementValue:true;};readonly 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.";readonly minimumEntropy:3;readonly minimumLiteralLength:8;readonly literalValue:RegExp;readonly baseline:{readonly regex:RegExp;readonly value:string;};readonly rejectValue:RegExp;readonly rejectStatementReference:RegExp;}];
96
+ /**
97
+ * A text and, once read, the escaped JSON string literals in it with their
98
+ * decoded texts, so the inventory rules judging one string share one decoding
99
+ * of it, and any other rules share another. Nodes hang
100
+ * off the value they were made for, never off a table keyed by text, so no
101
+ * lookup compares long strings and nothing outlives the caller's reference.
102
+ */
103
+ export interface SecretDecodedText{
104
+ /** The text itself. */
105
+ readonly text:string;
106
+ /** Escaped JSON string literals of the text whose decoded text can yield an inventory finding or warning, decoded; read on first use. */
107
+ spans?:readonly DecodedSpan[];
108
+ /** Every escaped JSON string literal of the text, decoded, for a rule outside the inventory; read on first use. */
109
+ allSpans?:readonly DecodedSpan[];}
110
+ /** One escaped JSON string literal and the text it decodes to. */
111
+ export interface DecodedSpan{
112
+ /** Offset of the literal's opening quote. */
113
+ readonly start:number;
114
+ /** The literal's decoded value, itself read on demand. */
115
+ readonly decoded:SecretDecodedText;}
116
+ /** A decode node for one text; share it across the rules that judge that text. */
117
+ export declare function createSecretDecodedText(text:string):SecretDecodedText;
118
+ /** How {@link findSecretRuleMatches} reads content. */
119
+ export interface SecretRuleScanOptions{
120
+ /**
121
+ * Also judge the text each escaped JSON string literal decodes to (see
122
+ * decodedStringMatches). Mutation payloads opt in; the repository gate reads
123
+ * files as written, so it reports what a file's text matches as written but
124
+ * not a finding only this reading makes, such as a synthetic detector
125
+ * fixture that tracker history records inside an escaped JSON string.
126
+ */
127
+ decodeStrings?:boolean;
128
+ /** The decode node for `content`, shared across rules; a fresh one is made when omitted or made for other text. */
129
+ decoded?:SecretDecodedText;}
101
130
  /** Share matching and normalization, returning locations rather than matched values. */
102
- export declare function findSecretRuleMatches(rule:SecretRule,content:string):Generator<SecretRuleMatch>;
131
+ export declare function findSecretRuleMatches(rule:SecretRule,content:string,options?:SecretRuleScanOptions):Generator<SecretRuleMatch>;
132
+ /** Whether a member named `name` holds numeric metadata (a JSON Schema bound or a time field), so a number in it is not judged. */
133
+ export declare function isNumericMetadataKey(name:string):boolean;
134
+ /** The parts of the YAML parser the confirmation uses, captured privately on first use. */
135
+ type YamlParser=Readonly<Pick<typeof import("yaml"),"parseDocument"|"isMap"|"isSeq"|"isPair"|"isScalar">>;
136
+ /**
137
+ * Whether a walked container, read on its own, confirms one of the numbers the
138
+ * walk judged (`candidates`, offsets into `text`). JSON.parse accepts it (every
139
+ * unquoted value the walk judges in valid JSON is a JSON number), or a strict
140
+ * YAML 1.2 parse reports no error, no mapping repeats a key, and the parser
141
+ * reads a candidate as a numeric scalar starting at its offset (a bare
142
+ * carriage return after digits belongs to a YAML plain scalar, so there
143
+ * `pin: 123456789` followed by one is a string). YAML rejects, among others,
144
+ * empty entries, a second colon in one entry, an implicit key of a
145
+ * single-pair entry in a flow sequence that spans lines or exceeds 1,024
146
+ * UTF-16 code units up to its colon, scalars starting with a reserved
147
+ * indicator, document markers and duplicate keys; JSON accepts duplicate
148
+ * names. The hand-written walk before it stops early at constructs outside
149
+ * JSON-compatible flow; this check makes the boundary exact, so a number
150
+ * finding is confirmed only where a real parser reads that number. JSON.parse
151
+ * never sees a long string literal in key position (see parsesAsJson). YAML's
152
+ * indentation rules relative to an enclosing block are not applied, since the
153
+ * container is read alone. A container too deep for the YAML parser, with no
154
+ * other parse error, yields `incomplete`, reported for review.
155
+ */
156
+ declare function confirmsNumbers(text:string,candidates:readonly number[],exempt?:readonly number[]):boolean|"incomplete";
157
+ /**
158
+ * Whether JSON.parse accepts a text, in linear time. V8 interns the keys
159
+ * JSON.parse builds and hashes a long string by its length alone, so parsing
160
+ * many long keys of one length is quadratic. Each double-quoted run of
161
+ * LONG_KEY or more code units is therefore parsed alone, as a value (never
162
+ * interned), and then shrunk to `""` before the whole text is parsed: one
163
+ * string token in place of another leaves JSON validity unchanged, duplicate
164
+ * names included.
165
+ */
166
+ declare function parsesAsJson(text:string):boolean;
167
+ /**
168
+ * Whether a YAML mapping anywhere in the tree (keys included) repeats a key,
169
+ * judged as the parser's own check judges keys: a scalar by its resolved
170
+ * value, compared with SameValueZero (so `.nan` keys count as repeats, which
171
+ * only withholds a finding), and a collection or a tagged object value by
172
+ * identity. One set per mapping and an explicit stack keep the check linear
173
+ * at any depth.
174
+ */
175
+ declare function repeatsKey(yaml:YamlParser,root:unknown):boolean;
103
176
  /**
104
177
  * Where the references that lead a value end (`$($(cmd))`, `${A:-${B}}`,
105
178
  * `$NAME`, `<x>`). An iterative scan, so no reference length can exhaust the
@@ -116,12 +189,13 @@ declare function leadingReferencesEnd(text:string):number;
116
189
  */
117
190
  export declare function structuredKeyShape(rule:SecretRule,name:string):"exact"|"prefixed"|undefined;
118
191
  /**
119
- * Judge one string as a quoted structured value of a key-named rule, exactly
120
- * as the structured pass judges a quoted value in text: `compact` for a
121
- * prefixed key's value or an object member's value, lenient for an exact key's
122
- * value or an array element.
192
+ * Judge one payload scalar as a structured value of a key-named rule, exactly
193
+ * as the structured pass judges its JSON spelling in text: a string as a
194
+ * quoted value, a number as the bare number after a key or inside a container.
195
+ * `compact` for a prefixed key's value or an object member's value, lenient
196
+ * for an exact key's value or an array element.
123
197
  */
124
- export declare function acceptsStructuredValue(rule:SecretRule,value:string,compact:boolean):boolean;
198
+ export declare function acceptsStructuredValue(rule:SecretRule,value:string|number|bigint,compact:boolean):boolean;
125
199
  /**
126
200
  * Expand run-time references in data, such as a decoded literal or an element
127
201
  * body, whose own quote characters are literal: `${NAME}`, `${NAME:?message}`,
@@ -150,4 +224,4 @@ export declare function literalAfterReferences(value:string,variables?:boolean):
150
224
  */
151
225
  export declare function acceptsSecretMatch(rule:SecretRule,match:RegExpMatchArray):boolean;
152
226
  /** Internal scanners exposed for unit tests only; not part of any public surface. */
153
- export declare const _testOnly:{leadingReferencesEnd:typeof leadingReferencesEnd;};export{};
227
+ export declare const _testOnly:{leadingReferencesEnd:typeof leadingReferencesEnd;parsesAsJson:typeof parsesAsJson;repeatsKey:typeof repeatsKey;confirmsNumbers:typeof confirmsNumbers;};export{};
@@ -1,6 +1,8 @@
1
- const h=`[^\\s/\\\\<>"'\\x60()\\[\\]{},;?=:#*]+`,d="[/\\\\]+",ze="[\\p{L}\\p{N}._@-]+",$=ze+"(?:"+d+h+")*",N="(?:(?:home|users)"+d+$+"|root"+d+$+")",Me="[/\\\\]"+N,Pe="[/\\\\]{2,}"+N,De="/?[a-z]:"+d+"users"+d+$,Ze=h+"(?: +"+h+")*",x="(?:"+Ze+d+")?users"+d+$,Ue="[/\\\\]{2,}"+h+d+x,ve="(?:[a-z]:|volume\\{[a-f0-9-]+\\}|"+h+")",v="[/\\\\]{2}[?.]"+d+"(?:unc"+d+h+d+x+"|"+ve+d+"users"+d+$+")",Fe="file:(?:"+v+"|(?:[/\\\\](?![/\\\\])|[/\\\\]{3,}|[/\\\\]{2}localhost"+d+")(?:"+N+"|[a-z]:"+d+"users"+d+$+")|[/\\\\]{2}(?:[a-z]:"+d+"users"+d+$+"|"+h+d+"(?:"+N+"|"+x+")))",Ve=new RegExp("(?:^|[^\\p{L}\\p{N}_./\\\\~])(?:"+Me+"|"+De+"|"+Fe+")|(?:^|[^\\p{L}\\p{N}_:./\\\\~])(?:"+Pe+"|"+Ue+"|"+v+")","giu"),F=4,Be=/%[a-f0-9]{2}|\\(?:u[a-f0-9]{4}|x[a-f0-9]{2}|\/)/iu,He=new TextDecoder("utf-8");function We(e){return e.replace(/(?:%[a-f0-9]{2})+/giu,n=>He.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 qe(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 Ge(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 Ke(e,n){for(const[t,r]of[["percent_decode",We],["json_unescape",qe],["unicode_fold",Ge]]){const s=r(e);s!==e&&!n.includes(t)&&n.push(t),e=s}return e}function*Qe(e,n,t){let r=e;const s=[];for(let i=0;i<F;i+=1){const u=r;if(r=Ke(r,s),!t){n.lastIndex=0;for(const o of r.matchAll(n))t=!0,yield{index:0,normalizations:[...s]}}if(r===u)break;i===F-1&&Be.test(r)&&(yield{index:0,normalizations:[...s],normalization_incomplete:!0})}}function*Ye(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 Qe(r,n,s))yield{...i,index:t};t+=r.length+1}}const V="password|passphrase",y=4,_=4096,S=e=>`${e}+(?!${e})`,B=String.raw`'[^'\r\n]*'|"[^"\\\r\n]*(?:\\.[^"\\\r\n]*){0,${_}}"`,je=String.raw`\$\{(?:${S(String.raw`[^{}$'"\\\r\n]`)}|\\[^\r\n]|${B}|\$(?!\{)|\$\{[^{}\r\n]*\}){0,${_}}\}`+String.raw`|\$\((?:${S(String.raw`[^()$'"\\\r\n]`)}|\\[^\r\n]|${B}|\$(?!\()|\$\([^()\r\n]*\)){0,${_}}\)`,H=String.raw`${je}|<[^<>\r\n]*>|${S(String.raw`[A-Za-z0-9!@#%^&*._+\-=]`)}|\$(?![{(])`,Xe=String.raw`"[^"]*"|'[^']*'`,W=String.raw`(?:"[^"\s]*"|'[^'\s]*')(?:${H}){0,${_}}`,q=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)?$)))`+`((?:${H}){1,${_}}(?:${W}){0,${y}}|(?:${W}){1,${y}}|${Xe})`),Je=8,G="token|secret|password|passwd|api[_-]?key",b="(?<![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))",R=4096,K=String.raw`"(?=[^"\s]{8}[^"\s]*")|'(?=[^'\s]{8}[^'\s]*')|(?!["'])`,Q=String.raw`(?![<[$/]|~\/|\.\.?\/|[A-Za-z][\w+.-]*:\/\/|%[A-Za-z_]\w*%(?=$|[\s"',;)}\]<>&|\\])|[A-Za-z]:[\\/]|(?<=")(?:(?:[A-Za-z_]\w*\.){1,${R}}[A-Za-z_]\w*|[A-Za-z]+(?:-[A-Za-z]+){0,${R}}|(?:[\w.-]+\/){1,${R}}[\w.-]+\.[A-Za-z][A-Za-z0-9]{0,4})"|(?<=')(?:(?:[A-Za-z_]\w*\.){1,${R}}[A-Za-z_]\w*|[A-Za-z]+(?:-[A-Za-z]+){0,${R}}|(?:[\w.-]+\/){1,${R}}[\w.-]+\.[A-Za-z][A-Za-z0-9]{0,4})'|(?<!["'])[A-Za-z]+(?:-[A-Za-z]+){0,${R}}(?![\w!@#$%^&*.+\-=/~])|(?<!["'])(?:[A-Za-z_]\w*\.){1,${R}}[A-Za-z_]\w*(?![\w!@#$%^&*.+\-=/~])|(?<!["'])(?:[\w.-]+\/){1,${R}}[\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,})`,k=new RegExp(`(?:${K})(${Q})`,"iy"),en=8,nn=String.raw`[A-Za-z0-9!@#%^*._+\-=/~]`,Y=String.raw`&(?!&)`,tn=64,j=String.raw`'[^'\s]*'|"[^"\\\s]*(?:\\\S[^"\\\s]*){0,${_}}"`,X=String.raw`\$\{(?:${S(String.raw`[^{}$'"\\\s]`)}|\\\S|${j}|\$(?!\{)|\$\{[^{}\s]*\}){0,${_}}\}`+String.raw`|\$\((?:${S(String.raw`[^()$'"\\\s]`)}|\\\S|${j}|\$(?!\()|\$\([^()\s]*\)){0,${_}}\)`+String.raw`|<[^<>\s]*>|\$[A-Za-z_]\w*(?!\w)`,J=e=>String.raw`${X}|${S(e)}|${Y}|\$(?![{(A-Za-z_])`,ee=e=>String.raw`(?:"[^"\s]*"|'[^'\s]*')(?:${J(e)}){0,${_}}`,rn=e=>String.raw`(?:(?:${e}|${Y}){1,${tn}}(?=[$<]))?(?:${X})`+String.raw`(?:${J(e)}){0,${_}}(?:${ee(e)}){0,${y}}`,sn=e=>String.raw`(?:${ee(e)}){1,${y}}`,ne=e=>String.raw`(?<!["'])(?:${e(nn)})`,te=String.raw`(?:[\w@#~]|!(?![.+\-*/%=^!(]))`,un=String.raw`(?=(?:"[^"\s]*"|'[^'\s]*')[$<"']`+String.raw`|"(?=[^"\s]*[$<])[^"\s]*"${te}|'(?=[^'\s]*[$<])[^'\s]*'${te})`,on=String.raw`(?<=")(?=[^"\s]*[$<])[^"\s]+|(?<=')(?=[^'\s]*[$<])[^'\s]+`,re=new RegExp(`(?:${un}|${K})((?=["'])(?:${ne(sn)})|${on}|${ne(rn)}|${Q})`),se=/["']?([A-Za-z0-9+/=_-]{24,})/,Vt=[{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(?:${V})\s*[:=]\s*`+q.source,"gi"),structured:{keys:V,value:q.source,element:!0},minimumLiteralLength:Je},{name:"absolute-home-path",mutationRule:"absolute_home_path",category:"path",regex:Ve,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(?:${G})\s*[:=]\s*`+se.source,"gi"),structured:{keys:G,value:se.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(?:${b})\s*[:=]\s*`+re.source,"gi"),structured:{keys:b,value:re.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:en,literalValue:k,baseline:{regex:new RegExp(String.raw`\b(?:${b})\s*[:=]\s*`+k.source,"gi"),value:k.source},rejectValue:/^(?:[\w.-]+\/)*id_(?:rsa|dsa|ecdsa|ed25519)(?:_sk)?(?:\.pub)?$/u,rejectStatementReference:/^[A-Z]+(?:_[A-Z]+)+$/u}];function*Bt(e,n){if(e.mutationRule==="absolute_home_path"){yield*Ye(n,e.regex);return}for(const t of ue(e))yield*pn(t,n),t.structured&&(yield*St(t,t.structured,n))}const ie=new WeakMap;function ue(e){const n=e.baseline;if(n===void 0)return[e];let t=ie.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}),ie.set(e,t)),[e,t]}function an(e,n){const t=e[n-1]==="#"||e[n-1]==="!"?n-1:n;return e[t-1]==="{"&&e[t-2]==="$"}const z=new WeakSet,oe=new WeakMap,cn=4096;function ln(e,n,t){const r=[],s=[],i=n+t.length;return ae(e,n,i,s,r),ae(e,i,Math.min(e.length,i+cn),s),r}function ae(e,n,t,r,s){for(let i=n;i<t&&(s!==void 0||r.length>0);i+=1){const u=r.at(-1);if(e[i]==="$"&&(e[i+1]==="{"||e[i+1]==="(")&&u?.quoted!=="'"){const o={open:i,close:t,command:e[i+1]==="(",quoted:[]};s?.push(o),r.push({span:o,closer:e[i+1]==="{"?"}":")"}),i+=1}else u!==void 0&&(i=dn(e,i,r))}}function dn(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 fn(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 gn(e,n){let t=0,r=e.quoted.length-1;for(;t<=r;){const s=t+r>>1,[i,u]=e.quoted[s];if(n<i)r=s-1;else if(n>u)t=s+1;else return!0}return!1}const ce=/\$[({A-Za-z_]|</u,L=new WeakMap;function*pn(e,n){const t=new RegExp(e.regex),r=En(e);let s,i;for(let u=t.exec(n);u!==null;u=t.exec(n)){let o=u;if(e.minimumLiteralLength!==void 0){i??=me(n);const c=u.index+u[0].length,a=c-u[1].length,l=Oe(i,a,c);l>a&&(l<c&&(o=Te(u,l),t.lastIndex=l),L.set(o,l))}C(e,o)?yield{index:o.index}:r!==void 0&&ce.test(o[1])&&(s??=new RegExp(t),yield*_n(e,s,n,o,r==="deep"))}}function En(e){return e.minimumLiteralLength===void 0?void 0:e.minimumEntropy===void 0&&e.literalValue===void 0&&e.rejectValue===void 0?"deep":"shallow"}function*_n(e,n,t,r,s){const i=r.index+r[0].length;n.lastIndex=i-r[1].length;let u;for(let o=n.exec(t);o!==null&&o.index<i;o=n.exec(t)){if(an(t,o.index)){n.lastIndex=o.index+1;continue}u??=fn(ln(t,i-r[1].length,r[1]));const c=u(o.index);c!==void 0&&(oe.set(o,c.close),c.command&&!gn(c,o.index)&&z.add(o)),C(e,o)?yield{index:o.index}:s&&ce.test(o[1])&&(n.lastIndex=o.index+o[0].length-o[1].length)}}const le=new Map,O=/[\r\n\u2028\u2029]/u;function M(e){const n=`${e.keys}\0${e.value}\0${e.element===!0}`;let t=le.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")}}:{}},le.set(n,t)),t}function de(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 An(e,n){return de(e,n).end}function Rn(e,n,t){return e.at(-1)==="}"?t:n}function hn(e,n,t,r=t){const s=[];let i=!1;for(let u=n;u<e.length;u+=1){const o=e[u];switch(o){case"[":case"{":s.push(o==="["?"]":"}"),i=o==="{";break;case"]":case"}":if(s.pop()!==o||s.length===0)return{found:!1,end:u+1};i=!1;break;case",":i=s.at(-1)==="}";break;case":":i=!1;break;case'"':case"'":if(!i&&Rn(s,t,r)(u))return{found:!0,end:u};u=An(e,u)-1;break;default:break}}return{found:!1,end:e.length}}const $n=/\\(?: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,Sn={n:`
3
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"};function wn(e,n){const t=e[0],r=e.slice(1,n?-1:void 0).replaceAll($n,u=>{const o=u[1];if((o==="u"||o==="x")&&u.length>2)return String.fromCharCode(Number.parseInt(u.slice(2),16));if(/^[0-7]$/u.test(o))return String.fromCharCode(Number.parseInt(u.slice(1),8));if(o==="U"&&u.length===10){const c=Number.parseInt(u.slice(2),16);return c<=1114111?String.fromCodePoint(c):"\uFFFD"}return Sn[o]??o}),s=r.replaceAll(t,t==='"'?"'":'"').replaceAll(/[\r\n\u2028\u2029]/gu," "),i=n?t:"";return{reading:`${t}${s}${i}`,...fe(`${t}${r}${i}`,n)}}function mn(e,n,t,r){const s=wn(t,r);return e[n]==="'"&&r?[s,{reading:t,...fe(t,!0)}]:[s]}function fe(e,n){return{original:e,bodyStart:1,bodyEnd:e.length-(n?1:0)}}const Nn=64;function ge(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-Nn);for(let i=n-1;i>=s;i-=1){const u=e[i];if(u===t)return"prefixed";if(u===`
4
- `||u==="\r"||u==='"'||u==="'")return"malformed"}return"malformed"}function pe(e,n,t,r=!1){const s=Xn(e,t),i=(a,l,f)=>{n.lastIndex=l;const g=n.exec(a);if(g===null||O.test(g[0]))return null;const p=s(g),E=p.indices?.[1];return f!==void 0&&E!==void 0&&(p[1]=f.original.slice(Math.max(E[0],f.bodyStart),Math.min(E[1],f.bodyEnd)),T.add(p)),C(e,p)?p:null},u=a=>{if(t[a]!=='"'&&t[a]!=="'")return;const{end:l,terminated:f}=de(t,a),g=t.slice(a,l);if(!r&&!g.includes("\\"))return;if(O.test(g))return[];const p=mn(t,a,g,f).map(E=>i(E.reading,0,E)).filter(E=>E!==null);return t[a]==="'"?[...p,...o(a)]:p},o=a=>{const l=i(t,a);return l===null?[]:[l]},c=a=>u(a)??o(a);return{direct:a=>i(t,a)!==null,escaped:a=>(u(a)?.length??0)>0,accepts:a=>l=>c(l).some(f=>!(a&&/\s/u.test(yn(e,f))))}}function yn(e,n){return e.minimumLiteralLength===void 0?n[0]:Ee(n)}const T=new WeakSet;function Ee(e){const n=z.has(e)&&!A(m(e))?xn(e[1]):void 0,t=n??e[1];if(n===void 0&&Tn(e,t))return"";const r=n!==void 0||kn(e);return T.has(e)||A(m(e))?ke(t,r):Ft(t,r)}const Ln=/^%[A-Za-z_]\w*%$/u,On=/^(["']?)%[A-Za-z_]\w*%\1$/u;function Tn(e,n){if(!On.test(n))return!1;if(T.has(e))return!0;const t=e.input,r=e.index+e[0].length;if(L.get(e)===r)return!0;let s=r;for(;s<t.length&&(t[s]===" "||t[s]===" ");)s+=1;return s===t.length||O.test(t[s])?!0:A(n[0])&&/[,;)}\]]/u.test(t[s])&&Cn(e)}const In=/(?:^|[\s{,[])(["'])[^"'\r\n]{1,256}\1\s*[:=]\s*$/u;function Cn(e){if(_e(e,!1)!==void 0)return!0;const n=e.input,t=e.index+e[0].length-e[1].length,r=n.slice(Math.max(0,t-Ae),t);return In.test(r)||/:[ \t]*$/u.test(r)}function xn(e){for(let n=0;n<e.length;n+=1){const t=e[n];if(t==="'"||t==='"')n=Ce(e,n);else if(t==="$"&&(e[n+1]==="{"||e[n+1]==="("))n=Math.max(n,Z(e,n)-1);else if(/[|&;<>]/u.test(t))return e.slice(0,n)}}const bn=/^[;,)}\]]{0,64}/u;function kn(e){const n=e.input,t=e.index+e[0].length,r=A(m(e))&&A(n[t])?t+1:A(e[0].at(-1))?t:-1,s=r===-1?t:r,i=bn.exec(n.slice(s,s+$e))[0].length,u=s+i;if(u===n.length||/\s/u.test(n[u])||zn(e,s,t))return!0;if(r===-1||i===0)return!1;const o=_e(e,r===t+1),c=n.slice(u,u+40),a=/[}\]]/u.test(n.slice(s,u));return o!==void 0&&(Re.test(c)||(o==="element"||a)&&he.test(c))}function zn(e,n,t){return oe.get(e)===n||z.has(e)&&/[|&;<>]/u.test(e.input[n])?!0:L.get(e)===t}function _e(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-Ae),r);return Pn.test(s)?"element":Mn.test(s)?"key":void 0}const Ae=512,Mn=/[{,]\s*(["'])[^"'\r\n]{1,256}\1\s*[:=]\s*$/u,Pn=/[[,]\s*$/u,Re=/^(?:["'`]|[{[](?:[\s"'`{[\]}]|$|(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)[\s,\]}]))/u,he=/^(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)[\s,\]}]/u,$e=64,w=0,P=1,Dn=2,Se=/[\p{L}\p{N}_]/u;function we(e){return e===10||e===13}function me(e){return{content:e,index:0,state:w,opener:-1,escapes:!0,declined:!1}}function D(e){const{content:n}=e,t=e.index,r=n.charCodeAt(t);if(e.index=t+1,we(r))return e.state=w,e.escapes=!0,e.declined=!1,-1;if(r===92)return Zn(e,t),-1;if(r!==34&&r!==39)return-1;const s=r===34?P:Dn;return e.state===s?(e.state=w,e.escapes=!0,t):(e.state===w&&Un(e,s,t),-1)}function Zn(e,n){const{content:t}=e;!e.escapes||n+1>=t.length||we(t.charCodeAt(n+1))||(e.index=n+2,e.state===w&&A(t[n+1])&&(e.declined=!0))}function Un(e,n,t){const{content:r}=e;if(t>0&&Se.test(r[t-1])&&!vn.test(r.slice(Math.max(0,t-3),t))){e.declined=!0;return}e.state=n,e.opener=t,e.escapes=n===P||r[t-1]==="$"||Bn(r,t)}const vn=/(?:^|[^\p{L}\p{N}_])(?:[rRbBuUfF]|[rR][bBfF]|[bBfF][rR])$/u;function Fn(e){return!e.declined}function Ne(e,n){for(;e.index<n;)D(e)}function Vn(e,n){const t=ye(e,n),r=e[t];return{inContainer:r!==void 0&&/[[{,:]/u.test(r),attribute:r==="="&&Wn(e,t)}}function ye(e,n){let t=n-1;for(;t>=0&&/\s/u.test(e[t]);)t-=1;return t}function Bn(e,n){return/[[{,:]/u.test(e.charAt(ye(e,n)))}const Hn=8192;function Wn(e,n){const t=Math.max(0,n-Hn);for(let r=n-1;r>=t;r-=1){const s=e[r];if(s===">")return!1;if(s==="<")return/[A-Za-z]/u.test(e.charAt(r+1));if(s==='"'||s==="'"){const i=e.lastIndexOf(s,r-1);if(i<t)return!1;r=i}}return!1}const qn=/[,:;)}\]]/u;function Gn(e,n,t){let r=n+1;if(Kn(e,r,t))return!0;const s=Math.min(e.length,r+$e);for(;r<s&&qn.test(e[r]);)r+=1;if(r===n+1)return!1;for(;r<e.length&&(e[r]===" "||e[r]===" ");)r+=1;if(r===e.length||O.test(e[r]))return!0;if(!t.inContainer)return!1;const i=e.slice(r,r+Qn);return Re.test(i)||he.test(i)||Yn.test(i)}function Kn(e,n,t){return n===e.length||/\s/u.test(e[n])?!0:t.attribute&&(e[n]===">"||e.startsWith("/>",n))}const Qn=512,Yn=/^[A-Za-z_][\w.-]{0,480}:(?:\s|$)/u,Le=1024;function jn(e){const n=me(e),t=[{...n}];return r=>{for(;n.index<r;)n.index+1>=t.length*Le&&t.push({...n}),D(n);const i={...n.index===r?n:t[Math.min(Math.floor(r/Le),t.length-1)]};return Ne(i,r),i}}function Xn(e,n){if(e.minimumLiteralLength===void 0)return r=>r;let t;return r=>{if(r.input!==n)return r;const s=r[1],i=r.index+r[0].length;if(!/["']/u.test(s.slice(1))&&!A(n.charAt(i)))return r;const u=i-s.length;t??=jn(n);const o=Oe(t(u),u,i);if(o<=u)return r;const c=o<i?Te(r,o):r;return L.set(c,o),c}}function Oe(e,n,t){Ne(e,n);const r=e.state;if(r===w||!Fn(e))return-1;const{content:s}=e,i=e.opener,u=r===P?"'":'"',o={open:!1,placeholder:!1,references:[]},c=Math.min(t,s.length-1);for(;e.index<=c;){nt(o,s,e.index,u);const a=D(e);if(a!==-1){const l=o.open||o.placeholder||o.references.length>0;return rt(s,a,t,l)&&Gn(s,a,Vn(s,i))?a:-1}if(e.state!==r)return-1}return-1}const Jn=/^<[^<>\s]{0,254}>/u,et=256;function nt(e,n,t,r){const s=n[t];e.open?s===r&&(e.open=!1):e.placeholder?s===">"&&(e.placeholder=!1):s==="$"&&(n[t+1]==="{"||n[t+1]==="(")?e.references.push(n[t+1]==="{"?"}":")"):s===e.references.at(-1)?e.references.pop():s==="<"&&Jn.test(n.slice(t,t+et))?e.placeholder=!0:s===r&&(e.open=tt(n,t))}function tt(e,n){return e[n]==='"'||!Se.test(e[n-1])}function rt(e,n,t,r){return n>=t||!(r||/\s/u.test(e.charAt(n+1)))}function Te(e,n){const t=e.index+e[0].length-e[1].length,r=[e.input.slice(e.index,n),e.input.slice(t,n)];return Object.assign(r,{index:e.index,input:e.input,groups:void 0})}const st=/^\s{0,16}\(/u,it=/(?<![=!<>])=[ \t]{0,16}$/u;function m(e){return e.input[e.index+e[0].length-e[1].length-1]}function A(e){return e==='"'||e==="'"}const ut=/[$<"']/u;function ot(e){if(T.has(e)||A(m(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]==="<"&&(gt(e[1])||it.test(e.input.slice(Math.max(0,t-18),t))||Et.test(r)))return!0;const s=Ie(e[1]),i=e[1][s]==="!"?e[1][s+1]:e[1][s];return pt.test(i??"")||st.test(r)}function Ie(e){let n=0;for(let t=Z(e,n);t!==-1;t=Z(e,n))n=t;return n}function Z(e,n){const t=e[n];if(t==="<")return at(e,n);if(t!=="$")return-1;const r=e[n+1];if(r==="{"||r==="(")return ct(e,n+1,r);I.lastIndex=n;const s=I.exec(e)?.[0];return s===void 0?-1:n+s.length}function at(e,n){const t=e.indexOf(">",n+1),r=e.indexOf("<",n+1);return t!==-1&&(r===-1||t<r)?t+1:-1}function ct(e,n,t){const r=t==="{"?"}":")";let s=0;for(let i=n;i<e.length;i+=1){const u=e[i];if(u==="\\")i+=1;else if(u==="'"||u==='"')i=Ce(e,i);else if(u===t)s+=1;else if(u===r&&--s===0)return i+1}return-1}function Ce(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 lt=/^[\w$.[\]|&,{}:;?]+$/u,dt=/^(?:"[^"]*"|'[^']*'|-?\d+(?:\.\d+)?)(?:\|(?:"[^"]*"|'[^']*'|-?\d+(?:\.\d+)?|[A-Za-z_$][\w$.]*))*$/u,ft=/\b(?:string|number|boolean|bigint|symbol|any|unknown|object|never|void|undefined|null)\b/u;function gt(e){const n=e.slice(1,e.indexOf(">"));return dt.test(n)?!0:lt.test(n)?ft.test(n)||/[.|&[{]/u.test(n)||/^[A-Z][\w$]*$/u.test(n)&&(n.length===1||/[a-z]/u.test(n)):!1}const pt=/[.+\-*/%=^&]/u,Et=/^\s{0,16}(?:\?\.|\?\?|\|\||&&|[([])/u;function _t(e,n,t){if(t)return!1;const r=n.replaceAll('"',"'");return e.lastIndex=0,e.exec(`"${r}"`)?.[1]===r}function Ht(e,n){if(!e.structured)return;const t=`${JSON.stringify(n)}:`,r=M(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=ge(t,s.index,s[1]);if(i!=="malformed")return i}}function Wt(e,n,t){if(!e.structured)return!1;const r=JSON.stringify(n).replaceAll("\u2028","\\u2028").replaceAll("\u2029","\\u2029");return ue(e).some(s=>pe(s,M(s.structured).value,r,!0).accepts(t)(0))}function*At(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,u=Rt(e,n,i);if(u===void 0){r.lastIndex=s.index+1;continue}t(n.slice(i,u.start).trim())&&(yield{index:s.index}),r.lastIndex=u.end}}function Rt(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 ht(e,n,t){return n<e.exact||t&&n<e.compact}function $t(e,n,t,r){return(t||e.escaped(r)&&!e.direct(r))&&n(r)}function*St(e,n,t){const r=M(n),s=pe(e,r.value,t),i=new RegExp(r.key),u={exact:0,compact:0};for(let o=i.exec(t);o;o=i.exec(t)){const c=o[1],a=ge(t,o.index,c);if(a==="malformed")continue;const l=a==="prefixed",f=s.accepts(l),g=o.index+o[0].length,p=t[g];if(p==="["||p==="{"){if(ht(u,g,l))continue;const E=hn(t,g,f,s.accepts(!0));u[l?"compact":"exact"]=E.end,E.found&&(yield{index:o.index})}else $t(s,f,c,g)&&(yield{index:o.index})}r.element&&(yield*At(r.element,t,mt(e,n,r)))}const wt=8;function mt(e,n,t){if(!n.elementValue){const r=e.minimumLiteralLength??wt;return s=>!Ln.test(s.trim())&&ke(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,C(e,i))}}function Nt(e,n,t){const r=n.index+n[0].length;return/^[ \t]*;/u.test(n.input.slice(r,r+64))&&!A(m(n))&&e.test(t)}function yt(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 U(e,n){e.raw+=n,e.literal+=n}function Lt(e,n,t){const r=e[n+1];if(e[n]!=="$"||r!=="{"&&r!=="(")return-1;const s=r==="{"?e.slice(n+2,n+2+zt(e,n+2)):"",i=t[0],u=t.length===1&&i.quote!==void 0&&i.literal.length===i.pieceStart;return t.push({close:r==="{"?"}":")",keep:s!=="",raw:`$${r}${s}`,literal:"",opensPiece:u}),n+2+s.length}const Ot=/[A-Za-z_]/u,Tt=/\w/u,It=/[{(A-Za-z_]/u,I=/\$[A-Za-z_]\w*/y,Ct=/^_*[A-Z][A-Z0-9_]*$/u,xt=/^\$[A-Za-z_]\w*$/u,bt=/^(["'])\$[A-Za-z_]\w*\1$/u;function kt(e,n,t){I.lastIndex=n;const r=I.exec(e)?.[0];return r===void 0?-1:(t.literal===""&&Ct.test(r.slice(1))?t.raw+=r:U(t,r),n+r.length)}function zt(e,n){if(!Ot.test(e[n]??""))return 0;let t=n+1;for(;t<e.length&&Tt.test(e[t]);)t+=1;e[t]===":"&&(t+=1);const r=e[t];return r==="-"||r==="="||r==="+"?t+1-n:0}function Mt(e,n){const t=e.pop(),r=e.at(-1);r.raw+=`${t.raw}${n}`,t.keep&&(r.literal+=t.literal)}const xe=/[^$<"'\\})]+/y,Pt='$`"\\\n';function Dt(e,n){return e===`
5
- `?"":n==='"'&&!Pt.includes(e)?`\\${e}`:e}function Zt(e,n,t){const r=e[n],s=t.quote;if(s==='"'&&r==="$"&&It.test(e[n+1]??""))return-1;let i=1,u=r;if(r==="\\"&&s!=="'"&&n+1<e.length)i=2,u=Dt(e[n+1],s);else if(s===void 0){if(r!=='"'&&r!=="'")return-1;t.quote=r,u=""}else r===s&&(t.quote=void 0,u="");return t.raw+=e.slice(n,n+i),t.keep&&(t.literal+=u),n+i}function Ut(e,n,t,r,s){const i=t.at(-1);xe.lastIndex=n;const u=xe.exec(e)?.[0];if(u!==void 0)return U(i,u),n+u.length;if(t.length>1){const g=Zt(e,n,i);if(g!==-1)return g}else if(r&&vt(e[n],i))return n+1;const o=Lt(e,n,t);if(o!==-1)return o;const c=t.at(-1),a=e[n],l=s&&a==="$"?kt(e,n,c):-1;if(l!==-1)return l;if(t.length>1&&a===c.close)return Mt(t,a),n+1;const f=a==="<"?yt(e,n):-1;return f!==-1?(c.raw+=e.slice(n,f+1),f+1):(U(c,a),n+1)}function vt(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 be(e,n,t){if(t&&(xt.test(e)||n&&bt.test(e)))return"";const r={close:"}",keep:!0,raw:"",literal:""},s=[r];for(let i=0;i<e.length;)i=Ut(e,i,s,n,t);for(let i=s.length-1;i>0;i-=1){const u=s[i],o=s[i-1];o.raw+=u.raw,n&&i===1&&u.opensPiece===!0||(o.literal+=u.raw)}return r.literal}function ke(e,n=!0){return be(e,!1,n)}function Ft(e,n=!0){return be(e,!0,n)}function C(e,n){const t=e.minimumLiteralLength===void 0?n[1]:Ee(n);if(e.minimumLiteralLength!==void 0&&t.length<e.minimumLiteralLength||e.literalValue&&ut.test(n[1])&&!_t(e.literalValue,t,ot(n))||e.rejectValue?.test(t)===!0||e.rejectStatementReference&&Nt(e.rejectStatementReference,n,t))return!1;if(e.minimumEntropy===void 0)return!0;const r=[...t],s=new Map;for(const u of r)s.set(u,(s.get(u)??0)+1);let i=0;for(const u of s.values()){const o=u/r.length;i-=o*Math.log2(o)}return i>=e.minimumEntropy}const qt={leadingReferencesEnd:Ie};export{Ve as PRIVATE_HOME_PATH_PATTERN,Vt as SECRET_RULES,qt as _testOnly,C as acceptsSecretMatch,Wt as acceptsStructuredValue,ke as expandRuntimeReferences,Ye as findPrivateHomePathMatches,Bt as findSecretRuleMatches,Ft as literalAfterReferences,Ht as structuredKeyShape};
1
+ import{createHash as gn}from"node:crypto";import{createRequire as pn}from"node:module";const A=`[^\\s/\\\\<>"'\\x60()\\[\\]{},;?=:#*]+`,l="[/\\\\]+",En="[\\p{L}\\p{N}._@-]+",h=En+"(?:"+l+A+")*",b="(?:(?:home|users)"+l+h+"|root"+l+h+")",_n="[/\\\\]"+b,mn="[/\\\\]{2,}"+b,Sn="/?[a-z]:"+l+"users"+l+h,An=A+"(?: +"+A+")*",z="(?:"+An+l+")?users"+l+h,hn="[/\\\\]{2,}"+A+l+z,Rn="(?:[a-z]:|volume\\{[a-f0-9-]+\\}|"+A+")",J="[/\\\\]{2}[?.]"+l+"(?:unc"+l+A+l+z+"|"+Rn+l+"users"+l+h+")",yn="file:(?:"+J+"|(?:[/\\\\](?![/\\\\])|[/\\\\]{3,}|[/\\\\]{2}localhost"+l+")(?:"+b+"|[a-z]:"+l+"users"+l+h+")|[/\\\\]{2}(?:[a-z]:"+l+"users"+l+h+"|"+A+l+"(?:"+b+"|"+z+")))",$n=new RegExp("(?:^|[^\\p{L}\\p{N}_./\\\\~])(?:"+_n+"|"+Sn+"|"+yn+")|(?:^|[^\\p{L}\\p{N}_:./\\\\~])(?:"+mn+"|"+hn+"|"+J+")","giu"),Q=4,Nn=/%[a-f0-9]{2}|\\(?:u[a-f0-9]{4}|x[a-f0-9]{2}|\/)/iu,bn=new TextDecoder("utf-8");function Tn(e){return e.replace(/(?:%[a-f0-9]{2})+/giu,n=>bn.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 xn(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 On(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 In(e,n){for(const[t,r]of[["percent_decode",Tn],["json_unescape",xn],["unicode_fold",On]]){const s=r(e);s!==e&&!n.includes(t)&&n.push(t),e=s}return e}function*Ln(e,n,t){let r=e;const s=[];for(let i=0;i<Q;i+=1){const u=r;if(r=In(r,s),!t){n.lastIndex=0;for(const o of r.matchAll(n))t=!0,yield{index:0,normalizations:[...s]}}if(r===u)break;i===Q-1&&Nn.test(r)&&(yield{index:0,normalizations:[...s],normalization_incomplete:!0})}}function*Cn(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 Ln(r,n,s))yield{...i,index:t};t+=r.length+1}}const X="password|passphrase",T=4,p=4096,y=e=>`${e}+(?!${e})`,ee=String.raw`'[^'\r\n]*'|"[^"\\\r\n]*(?:\\.[^"\\\r\n]*){0,${p}}"`,wn=String.raw`\$\{(?:${y(String.raw`[^{}$'"\\\r\n]`)}|\\[^\r\n]|${ee}|\$(?!\{)|\$\{[^{}\r\n]*\}){0,${p}}\}`+String.raw`|\$\((?:${y(String.raw`[^()$'"\\\r\n]`)}|\\[^\r\n]|${ee}|\$(?!\()|\$\([^()\r\n]*\)){0,${p}}\)`,ne=String.raw`${wn}|<[^<>\r\n]*>|${y(String.raw`[A-Za-z0-9!@#%^&*._+\-=]`)}|\$(?![{(])`,Mn=String.raw`"[^"]*"|'[^']*'`,te=String.raw`(?:"[^"\s]*"|'[^'\s]*')(?:${ne}){0,${p}}`,Dn=16,re=new RegExp(String.raw`(?!config\.auth\.password\s*(?:\|\|\s*(?:''|"")|\?\s*unescape\(encodeURIComponent\(config\.auth\.password\)\)\s*:\s*(?:''|""))(?=[ \t]*(?:\/\*(?:[^*]|\*(?!\/)){0,${p}}\*\/[ \t]*){0,${Dn}}(?:;|$|\/\/[^\r\n\u2028\u2029]{0,${p}}(?:\r\n)?$)))`+`((?:${ne}){1,${p}}(?:${te}){0,${T}}|(?:${te}){1,${T}}|${Mn})`),Pn=8,se="token|secret|password|passwd|api[_-]?key",k="(?<![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))",S=4096,ie=String.raw`"(?=[^"\s]{8}[^"\s]*")|'(?=[^'\s]{8}[^'\s]*')|(?!["'])`,ue=String.raw`(?![<[$/]|~\/|\.\.?\/|[A-Za-z][\w+.-]*:\/\/|%[A-Za-z_]\w*%(?=$|[\s"',;)}\]<>&|\\])|[A-Za-z]:[\\/]|(?<=")(?:(?:[A-Za-z_]\w*\.){1,${S}}[A-Za-z_]\w*|[A-Za-z]+(?:-[A-Za-z]+){0,${S}}|(?:[\w.-]+\/){1,${S}}[\w.-]+\.[A-Za-z][A-Za-z0-9]{0,4})"|(?<=')(?:(?:[A-Za-z_]\w*\.){1,${S}}[A-Za-z_]\w*|[A-Za-z]+(?:-[A-Za-z]+){0,${S}}|(?:[\w.-]+\/){1,${S}}[\w.-]+\.[A-Za-z][A-Za-z0-9]{0,4})'|(?<!["'])[A-Za-z]+(?:-[A-Za-z]+){0,${S}}(?![\w!@#$%^&*.+\-=/~])|(?<!["'])(?:[A-Za-z_]\w*\.){1,${S}}[A-Za-z_]\w*(?![\w!@#$%^&*.+\-=/~])|(?<!["'])(?:[\w.-]+\/){1,${S}}[\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,})`,Z=new RegExp(`(?:${ie})(${ue})`,"iy"),zn=8,kn=String.raw`[A-Za-z0-9!@#%^*._+\-=/~]`,oe=String.raw`&(?!&)`,Zn=64,ce=String.raw`'[^'\s]*'|"[^"\\\s]*(?:\\\S[^"\\\s]*){0,${p}}"`,ae=String.raw`\$\{(?:${y(String.raw`[^{}$'"\\\s]`)}|\\\S|${ce}|\$(?!\{)|\$\{[^{}\s]*\}){0,${p}}\}`+String.raw`|\$\((?:${y(String.raw`[^()$'"\\\s]`)}|\\\S|${ce}|\$(?!\()|\$\([^()\s]*\)){0,${p}}\)`+String.raw`|<[^<>\s]*>|\$[A-Za-z_]\w*(?!\w)`,de=e=>String.raw`${ae}|${y(e)}|${oe}|\$(?![{(A-Za-z_])`,fe=e=>String.raw`(?:"[^"\s]*"|'[^'\s]*')(?:${de(e)}){0,${p}}`,Un=e=>String.raw`(?:(?:${e}|${oe}){1,${Zn}}(?=[$<]))?(?:${ae})`+String.raw`(?:${de(e)}){0,${p}}(?:${fe(e)}){0,${T}}`,vn=e=>String.raw`(?:${fe(e)}){1,${T}}`,le=e=>String.raw`(?<!["'])(?:${e(kn)})`,ge=String.raw`(?:[\w@#~]|!(?![.+\-*/%=^!(]))`,Kn=String.raw`(?=(?:"[^"\s]*"|'[^'\s]*')[$<"']`+String.raw`|"(?=[^"\s]*[$<])[^"\s]*"${ge}|'(?=[^'\s]*[$<])[^'\s]*'${ge})`,Fn=String.raw`(?<=")(?=[^"\s]*[$<])[^"\s]+|(?<=')(?=[^'\s]*[$<])[^'\s]+`,pe=new RegExp(`(?:${Kn}|${ie})((?=["'])(?:${le(vn)})|${Fn}|${le(Un)}|${ue})`),Ee=/["']?([A-Za-z0-9+/=_-]{24,})/,U=/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g,Bn=[{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:U},{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(?:${X})\s*[:=]\s*`+re.source,"gi"),structured:{keys:X,value:re.source,element:!0},minimumLiteralLength:Pn},{name:"absolute-home-path",mutationRule:"absolute_home_path",category:"path",regex:$n,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(?:${se})\s*[:=]\s*`+Ee.source,"gi"),structured:{keys:se,value:Ee.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(?:${k})\s*[:=]\s*`+pe.source,"gi"),structured:{keys:k,value:pe.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:zn,literalValue:Z,baseline:{regex:new RegExp(String.raw`\b(?:${k})\s*[:=]\s*`+Z.source,"gi"),value:Z.source},rejectValue:/^(?:[\w.-]+\/)*id_(?:rsa|dsa|ecdsa|ed25519)(?:_sk)?(?:\.pub)?$/u,rejectStatementReference:/^[A-Z]+(?:_[A-Z]+)+$/u}],Vn=new Set(Bn);function _e(e){return{text:e}}function*is(e,n,t={}){if(t.decodeStrings!==!0){yield*me(e,n);return}const r=t.decoded?.text===n?t.decoded:_e(n);yield*Se(e,r,0)}const qn=3;function*me(e,n){if(e.mutationRule==="absolute_home_path"){yield*Cn(n,e.regex);return}for(const t of ye(e))yield*dt(t,n),t.structured&&(yield*zr(t,t.structured,n))}const Hn=/\beyJ/g,Wn=/[A-Za-z0-9_-]/u;function Gn(e){return e.regex.source===U.source&&e.regex.flags===U.flags&&e.minimumLiteralLength===void 0&&e.minimumEntropy===void 0&&e.literalValue===void 0&&e.rejectValue===void 0&&e.rejectStatementReference===void 0}function*jn(e,n){const t=new RegExp(Hn),r=new RegExp(e.source,"y");for(let s=t.exec(n);s!==null;s=t.exec(n)){r.lastIndex=s.index;const i=r.exec(n);if(i!==null){yield{index:s.index},t.lastIndex=s.index+i[0].length;continue}let u=s.index+3;for(;u<n.length&&Wn.test(n[u]);)u+=1;t.lastIndex=u}}function*Se(e,n,t){yield*me(e,n.text),t<qn&&(yield*Yn(e,n,t))}function*Yn(e,n,t){for(const r of nt(e,n))for(const s of Se(e,r.decoded,t+1)){const i={index:r.start,normalizations:[...new Set(["json_unescape",...s.normalizations??[]])]};s.normalization_incomplete&&(i.normalization_incomplete=!0),yield i}}const Jn=7;function Qn(e){for(let n=0;n<e.length;n+=1){const t=e.charCodeAt(n);if(t>127||t===37||t===92)return!1}return!0}const Xn=e=>e.length>=Jn||!Qn(e),et=()=>!0;function nt(e,n){return Vn.has(e)?n.spans??=Ae(n.text,Xn):n.allSpans??=Ae(n.text,et)}function tt(e){try{return JSON.parse(e)}catch{return}}function Ae(e,n){if(!e.includes("\\"))return[];const t=[];for(const{start:r,end:s}of rt(e)){const i=tt(e.slice(r,s+1));i!==void 0&&n(i)&&t.push({start:r,decoded:_e(i)})}return t}const he=e=>e===`
3
+ `||e==="\r";function*rt(e){let n=-1,t=!1;for(let r=0;r<e.length;r+=1){const s=e[r];he(s)?(n=-1,t=!1):s==="\\"?(t=!0,r+1<e.length&&!he(e[r+1])&&(r+=1)):s==='"'&&(n>=0&&t&&(yield{start:n,end:r}),n=r,t=!1)}}const Re=new WeakMap;function ye(e){const n=e.baseline;if(n===void 0)return[e];let t=Re.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}),Re.set(e,t)),[e,t]}function st(e,n){const t=e[n-1]==="#"||e[n-1]==="!"?n-1:n;return e[t-1]==="{"&&e[t-2]==="$"}const v=new WeakSet,$e=new WeakMap,it=4096;function ut(e,n,t){const r=[],s=[],i=n+t.length;return Ne(e,n,i,s,r),Ne(e,i,Math.min(e.length,i+it),s),r}function Ne(e,n,t,r,s){for(let i=n;i<t&&(s!==void 0||r.length>0);i+=1){const u=r.at(-1);if(e[i]==="$"&&(e[i+1]==="{"||e[i+1]==="(")&&u?.quoted!=="'"){const o={open:i,close:t,command:e[i+1]==="(",quoted:[]};s?.push(o),r.push({span:o,closer:e[i+1]==="{"?"}":")"}),i+=1}else u!==void 0&&(i=ot(e,i,r))}}function ot(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 ct(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 at(e,n){let t=0,r=e.quoted.length-1;for(;t<=r;){const s=t+r>>1,[i,u]=e.quoted[s];if(n<i)r=s-1;else if(n>u)t=s+1;else return!0}return!1}const be=/\$[({A-Za-z_]|</u,x=new WeakMap;function*dt(e,n){if(Gn(e)){yield*jn(e.regex,n);return}const t=new RegExp(e.regex),r=ft(e);let s,i;for(let u=t.exec(n);u!==null;u=Te(t,n,u)){let o=u;if(e.minimumLiteralLength!==void 0){i??=Ye(n);const c=u.index+u[0].length,a=c-u[1].length,d=tn(i,a,c);d>a&&(d<c&&(o=rn(u,d),t.lastIndex=d),x.set(o,d))}D(e,o)?yield{index:o.index}:r!==void 0&&be.test(o[1])&&(s??=new RegExp(t),yield*lt(e,s,n,o,r==="deep"))}}function Te(e,n,t){return t[0]===""&&(e.lastIndex=K(e,n,t.index)),e.exec(n)}function K(e,n,t){const r=e.unicode||e.flags.includes("v");return t+(r&&(n.codePointAt(t)??0)>65535?2:1)}function ft(e){return e.minimumLiteralLength===void 0?void 0:e.minimumEntropy===void 0&&e.literalValue===void 0&&e.rejectValue===void 0?"deep":"shallow"}function*lt(e,n,t,r,s){const i=r.index+r[0].length;n.lastIndex=i-r[1].length;let u;for(let o=n.exec(t);o!==null&&o.index<i;o=Te(n,t,o)){if(st(t,o.index)){n.lastIndex=K(n,t,o.index);continue}u??=ct(ut(t,i-r[1].length,r[1]));const c=u(o.index);c!==void 0&&($e.set(o,c.close),c.command&&!at(c,o.index)&&v.add(o)),D(e,o)?yield{index:o.index}:s&&be.test(o[1])&&(n.lastIndex=Math.max(K(n,t,o.index),o.index+o[0].length-o[1].length))}}const xe=new Map,O=/[\r\n\u2028\u2029]/u;function F(e){const n=`${e.keys}\0${e.value}\0${e.element===!0}`;let t=xe.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")}}:{}},xe.set(n,t)),t}function Oe(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 Ie(e,n){return Oe(e,n).end}function Le(e,n,t){return e.at(-1)==="}"?t:n}function gt(e,n,t,r=t){const s=[];let i=!1;for(let u=n;u<e.length;u+=1){const o=e[u];switch(o){case"[":case"{":s.push(o==="["?"]":"}"),i=o==="{";break;case"]":case"}":if(s.pop()!==o||s.length===0)return{found:!1,end:u+1};i=!1;break;case",":i=s.at(-1)==="}";break;case":":i=!1;break;case'"':case"'":if(!i&&Le(s,t,r)(u))return{found:!0,end:u};u=Ie(e,u)-1;break;default:break}}return{found:!1,end:e.length}}const B=/[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?/y,pt=new Set(["maximum","minimum","exclusiveMaximum","exclusiveMinimum","multipleOf","maxLength","minLength","maxItems","minItems","maxProperties","minProperties","maxContains","minContains","exp","iat","nbf","expires_at","expires_in","issued_at","not_before","created_at","updated_at","expiresAt","expiresIn","issuedAt","notBefore","createdAt","updatedAt"]);function Ce(e){return pt.has(e)}function $(e){return e===" "||e===" "||e===`
4
+ `||e==="\r"}function Et(e,n){if(B.lastIndex=n,!B.test(e))return-1;const t=B.lastIndex;let r=t;for(;r<e.length&&$(e[r]);)r+=1;const s=e[r];return s===void 0||s===","||s==="]"||s==="}"?t:-1}function _t(e,n,t,r){const s={closers:[],valueStart:!1,valueEnded:!1,inKey:!1,colonSeen:!1,tokenStart:-1,tokenEnd:-1,quotedKey:void 0,memberKey:void 0,found:[],exempt:[]};for(let i=n;i<e.length;i+=1){if($(e[i]))continue;const u=$t(e,i,s)?"yaml":Nt(e,i,s);if(u==="yaml"||u==="end")return mt(e,n,s,u,i);if(u==="structure")continue;const o=Ct(e,i,s);if(o.yamlOnly)return{found:!1,end:i};o.judge&&Lt(s,o.metadata,i,Le(s.closers,t,r)),i=o.end-1}return{found:!1,end:e.length}}function mt(e,n,t,r,s){if(r==="yaml")return{found:!1,end:s};if(t.found.length===0&&t.exempt.length===0)return{found:!1,end:s+1};const i=o=>o.map(c=>c-n);return{found:!Ze(e,s)&&we(e.slice(n,s+1),i(t.found),i(t.exempt)),end:s+1}}const St=pn(import.meta.url);let I;function At(){const{parseDocument:e,isMap:n,isSeq:t,isPair:r,isScalar:s}=St("yaml");return Object.freeze({parseDocument:e,isMap:n,isSeq:t,isPair:r,isScalar:s})}function we(e,n,t=[]){if(De(e))return n.length>0;I??=At();const r=I.parseDocument(e,{strict:!0,uniqueKeys:!1,prettyErrors:!1});if(r.errors.some(({code:i})=>i!=="RESOURCE_EXHAUSTION")||ze(I,r.contents))return!1;const s=ht(I,r.contents,[...n,...t],e.length);return r.errors.length>0?s.counts||!s.resolved?"incomplete":!1:s.counts}function ht(e,n,t,r){const s=new Set(t),i=new Uint8Array(r),u=(c,a)=>e.isScalar(c)&&typeof c.value=="number"&&s.has(c.range[0])&&!Ce(e.isScalar(a)?String(a.value):"");let o=!1;for(const c of Me(e,n))e.isScalar(c)?i.fill(1,c.range[0],c.range[1]):e.isPair(c)?o||=u(c.value,c.key):e.isSeq(c)&&(o||=c.items.some(a=>u(a,void 0)));return{counts:o,resolved:t.every(c=>i[c]===1)}}function*Me(e,n){const t=[n];for(;t.length>0;){const r=t.pop();if(yield r,e.isMap(r)||e.isSeq(r))for(const s of r.items)t.push(s);else e.isPair(r)&&t.push(r.key,r.value)}}function De(e){const n=Rt(e);return n!==void 0&&Pe(n)}function Pe(e){try{return JSON.parse(e),!0}catch{return!1}}function Rt(e){let n=-1,t="",r=0;for(let s=0;s<e.length;s+=1){const i=e[s];if(i==="\\")s+=1;else if(i==='"'&&n<0)n=s;else if(i==='"'){if(s-n>ke){if(!Pe(e.slice(n,s+1)))return;t+=`${e.slice(r,n)}""`,r=s+1}n=-1}}return r===0?e:t+e.slice(r)}function ze(e,n){for(const t of Me(e,n))if(e.isMap(t)&&yt(e,t))return!0;return!1}const ke=1024;function yt(e,n){const t=new Set,r=new Set;for(const{key:s}of n.items){const i=e.isScalar(s)?s.value:s,u=typeof i=="string"&&i.length>=ke,o=u?r:t,c=u?gn("sha256").update(i,"utf16le").digest("base64"):i;if(o.has(c))return!0;o.add(c)}return!1}function $t(e,n,t){const r=e[n];if(r==="#")return $(e[n-1]);if(t.tokenStart>=0)return!1;if(r!=="?")return r==="&"||r==="*"||r==="!";const s=e[n+1];return s===void 0||$(s)||",]}[{".includes(s)}function L(e){e.tokenStart=-1,e.quotedKey=void 0,e.memberKey=void 0,e.valueEnded=!1}function Ze(e,n){let t=n+1;for(;t<e.length&&$(e[t]);)t+=1;return e[t]===":"}function Nt(e,n,t){const r=e[n];if(r==="["||r==="{")return xt(r,t);if(r==="]"||r==="}")return Ot(e,n,t);if(r===",")return bt(t);if(r===":"&&It(e,n,t))return Tt(e,t)}function bt(e){if(e.inKey?e.tokenStart<0:e.valueStart&&!e.colonSeen)return"yaml";const t=e.closers.at(-1)==="}";return L(e),e.inKey=t,e.valueStart=!t,e.colonSeen=!1,"structure"}function Tt(e,n){if(n.colonSeen)return"yaml";const t=n.quotedKey??(n.tokenStart<0?"":e.slice(n.tokenStart,n.tokenEnd));return n.quotedKey===void 0&&t==="<<"?"yaml":(L(n),n.memberKey=t,n.inKey=!1,n.valueStart=!0,n.colonSeen=!0,"structure")}function xt(e,n){return n.closers.length>0&&!n.valueStart?"yaml":(n.closers.push(e==="["?"]":"}"),n.inKey=e==="{",n.valueStart=e==="[",n.colonSeen=!1,L(n),"structure")}function Ot(e,n,t){return t.closers.pop()!==e[n]?"yaml":t.closers.length===0?"end":Ze(e,n)?"yaml":(t.inKey=!1,t.valueStart=!1,L(t),t.valueEnded=!0,"structure")}function It(e,n,t){const r=e[n+1];return t.quotedKey!==void 0||r===void 0||$(r)||",[]{}".includes(r)}function Lt(e,n,t,r){r(t)&&(n?e.exempt:e.found).push(t)}function Ct(e,n,t){const r=e[n];if(t.valueEnded)return{end:n+1,judge:!1,yamlOnly:!0,metadata:!1};const s=t.tokenStart<0;if(s&&(r==='"'||r==="'")){const u=Ie(e,n),o=wt(e.slice(n,u),e[u]);return t.tokenStart=n,t.quotedKey=o,t.tokenEnd=u,t.valueStart=!1,t.valueEnded=!0,{end:u,judge:!1,yamlOnly:o===void 0,metadata:!1}}if(r==="\\"||r==='"'||r==="'")return{end:n+1,judge:!1,yamlOnly:!0,metadata:!1};s&&(t.tokenStart=n),t.quotedKey=void 0;const i=t.valueStart&&s?Et(e,n):-1;return t.valueStart=!1,t.tokenEnd=i<0?n+1:i,{end:t.tokenEnd,judge:i>=0,yamlOnly:!1,metadata:Ce(t.memberKey??"")}}function wt(e,n){if(e[0]==='"')try{return JSON.parse(e)}catch{return}const t=e.length>=2&&e.endsWith("'");if(!(n==="'"||/[\\\r\n]/u.test(e)))return e.slice(1,t?-1:void 0)}const Mt=/\\(?: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,Dt={n:`
5
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"};function Pt(e,n){const t=e[0],r=e.slice(1,n?-1:void 0).replaceAll(Mt,u=>{const o=u[1];if((o==="u"||o==="x")&&u.length>2)return String.fromCharCode(Number.parseInt(u.slice(2),16));if(/^[0-7]$/u.test(o))return String.fromCharCode(Number.parseInt(u.slice(1),8));if(o==="U"&&u.length===10){const c=Number.parseInt(u.slice(2),16);return c<=1114111?String.fromCodePoint(c):"\uFFFD"}return Dt[o]??o}),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 zt(e,n,t,r){const s=Pt(t,r);return e[n]==="'"&&r?[s,{reading:t,...Ue(t,!0)}]:[s]}function Ue(e,n){return{original:e,bodyStart:1,bodyEnd:e.length-(n?1:0)}}const kt=64;function ve(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-kt);for(let i=n-1;i>=s;i-=1){const u=e[i];if(u===t)return"prefixed";if(u===`
6
+ `||u==="\r"||u==='"'||u==="'")return"malformed"}return"malformed"}function Ke(e,n,t,r=!1){const s=ar(e,t),i=(a,d,f)=>{n.lastIndex=d;const g=n.exec(a);if(g===null||O.test(g[0]))return null;const E=s(g),_=E.indices?.[1];return f!==void 0&&_!==void 0&&(E[1]=f.original.slice(Math.max(_[0],f.bodyStart),Math.min(_[1],f.bodyEnd)),C.add(E)),D(e,E)?E:null},u=a=>{if(t[a]!=='"'&&t[a]!=="'")return;const{end:d,terminated:f}=Oe(t,a),g=t.slice(a,d);if(!r&&!g.includes("\\"))return;if(O.test(g))return[];const E=zt(t,a,g,f).map(_=>i(_.reading,0,_)).filter(_=>_!==null);return t[a]==="'"?[...E,...o(a)]:E},o=a=>{const d=i(t,a);return d===null?[]:[d]},c=a=>u(a)??o(a);return{direct:a=>i(t,a)!==null,escaped:a=>(u(a)?.length??0)>0,accepts:a=>d=>c(d).some(f=>!(a&&/\s/u.test(Zt(e,f))))}}function Zt(e,n){return e.minimumLiteralLength===void 0?n[0]:Fe(n)}const C=new WeakSet;function Fe(e){const n=v.has(e)&&!m(N(e))?Vt(e[1]):void 0,t=n??e[1];if(n===void 0&&Kt(e,t))return"";const r=n!==void 0||Ht(e);return C.has(e)||m(N(e))?ln(t,r):ts(t,r)}const Ut=/^%[A-Za-z_]\w*%$/u,vt=/^(["']?)%[A-Za-z_]\w*%\1$/u;function Kt(e,n){if(!vt.test(n))return!1;if(C.has(e))return!0;const t=e.input,r=e.index+e[0].length;if(x.get(e)===r)return!0;let s=r;for(;s<t.length&&(t[s]===" "||t[s]===" ");)s+=1;return s===t.length||O.test(t[s])?!0:m(n[0])&&/[,;)}\]]/u.test(t[s])&&Bt(e)}const Ft=/(?:^|[\s{,[])(["'])[^"'\r\n]{1,256}\1\s*[:=]\s*$/u;function Bt(e){if(Be(e,!1)!==void 0)return!0;const n=e.input,t=e.index+e[0].length-e[1].length,r=n.slice(Math.max(0,t-Ve),t);return Ft.test(r)||/:[ \t]*$/u.test(r)}function Vt(e){for(let n=0;n<e.length;n+=1){const t=e[n];if(t==="'"||t==='"')n=un(e,n);else if(t==="$"&&(e[n+1]==="{"||e[n+1]==="("))n=Math.max(n,q(e,n)-1);else if(/[|&;<>]/u.test(t))return e.slice(0,n)}}const qt=/^[;,)}\]]{0,64}/u;function Ht(e){const n=e.input,t=e.index+e[0].length,r=m(N(e))&&m(n[t])?t+1:m(e[0].at(-1))?t:-1,s=r===-1?t:r,i=qt.exec(n.slice(s,s+We))[0].length,u=s+i;if(u===n.length||/\s/u.test(n[u])||Wt(e,s,t))return!0;if(r===-1||i===0)return!1;const o=Be(e,r===t+1),c=n.slice(u,u+40),a=/[}\]]/u.test(n.slice(s,u));return o!==void 0&&(qe.test(c)||(o==="element"||a)&&He.test(c))}function Wt(e,n,t){return $e.get(e)===n||v.has(e)&&/[|&;<>]/u.test(e.input[n])?!0:x.get(e)===t}function Be(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-Ve),r);return jt.test(s)?"element":Gt.test(s)?"key":void 0}const Ve=512,Gt=/[{,]\s*(["'])[^"'\r\n]{1,256}\1\s*[:=]\s*$/u,jt=/[[,]\s*$/u,qe=/^(?:["'`]|[{[](?:[\s"'`{[\]}]|$|(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)[\s,\]}]))/u,He=/^(?:-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)[\s,\]}]/u,We=64,R=0,V=1,Yt=2,Ge=/[\p{L}\p{N}_]/u;function je(e){return e===10||e===13}function Ye(e){return{content:e,index:0,state:R,opener:-1,escapes:!0,declined:!1}}function w(e){const{content:n}=e,t=e.index,r=n.charCodeAt(t);if(e.index=t+1,je(r))return e.state=R,e.escapes=!0,e.declined=!1,-1;if(r===92)return Jt(e,t),-1;if(r!==34&&r!==39)return-1;const s=r===34?V:Yt;return e.state===s?(e.state=R,e.escapes=!0,t):(e.state===R&&Qt(e,s,t),-1)}function Jt(e,n){const{content:t}=e;!e.escapes||n+1>=t.length||je(t.charCodeAt(n+1))||(e.index=n+2,e.state===R&&m(t[n+1])&&(e.declined=!0))}function Qt(e,n,t){const{content:r}=e;if(t>0&&Ge.test(r[t-1])&&!Xt.test(r.slice(Math.max(0,t-3),t))){e.declined=!0;return}e.state=n,e.opener=t,e.escapes=n===V||r[t-1]==="$"||nr(r,t)}const Xt=/(?:^|[^\p{L}\p{N}_])(?:[rRbBuUfF]|[rR][bBfF]|[bBfF][rR])$/u;function Je(e){return!e.declined}function Qe(e,n){for(;e.index<n;)w(e)}function er(e,n){const t=Xe(e,n),r=e[t];return{inContainer:r!==void 0&&/[[{,:]/u.test(r),attribute:r==="="&&rr(e,t)}}function Xe(e,n){let t=n-1;for(;t>=0&&/\s/u.test(e[t]);)t-=1;return t}function nr(e,n){return/[[{,:]/u.test(e.charAt(Xe(e,n)))}const tr=8192;function rr(e,n){const t=Math.max(0,n-tr);for(let r=n-1;r>=t;r-=1){const s=e[r];if(s===">")return!1;if(s==="<")return/[A-Za-z]/u.test(e.charAt(r+1));if(s==='"'||s==="'"){const i=e.lastIndexOf(s,r-1);if(i<t)return!1;r=i}}return!1}const sr=/[,:;)}\]]/u;function ir(e,n,t){let r=n+1;if(ur(e,r,t))return!0;const s=Math.min(e.length,r+We);for(;r<s&&sr.test(e[r]);)r+=1;if(r===n+1)return!1;for(;r<e.length&&(e[r]===" "||e[r]===" ");)r+=1;if(r===e.length||O.test(e[r]))return!0;if(!t.inContainer)return!1;const i=e.slice(r,r+or);return qe.test(i)||He.test(i)||cr.test(i)}function ur(e,n,t){return n===e.length||/\s/u.test(e[n])?!0:t.attribute&&(e[n]===">"||e.startsWith("/>",n))}const or=512,cr=/^[A-Za-z_][\w.-]{0,480}:(?:\s|$)/u,en=1024;function nn(e){const n=Ye(e),t=[{...n}];return r=>{for(;n.index<r;)n.index+1>=t.length*en&&t.push({...n}),w(n);const i={...n.index===r?n:t[Math.min(Math.floor(r/en),t.length-1)]};return Qe(i,r),i}}function ar(e,n){if(e.minimumLiteralLength===void 0)return r=>r;let t;return r=>{if(r.input!==n)return r;const s=r[1],i=r.index+r[0].length;if(!/["']/u.test(s.slice(1))&&!m(n.charAt(i)))return r;const u=i-s.length;t??=nn(n);const o=tn(t(u),u,i);if(o<=u)return r;const c=o<i?rn(r,o):r;return x.set(c,o),c}}function tn(e,n,t){Qe(e,n);const r=e.state;if(r===R||!Je(e))return-1;const{content:s}=e,i=e.opener,u=r===V?"'":'"',o={open:!1,placeholder:!1,references:[]},c=Math.min(t,s.length-1);for(;e.index<=c;){lr(o,s,e.index,u);const a=w(e);if(a!==-1){const d=o.open||o.placeholder||o.references.length>0;return pr(s,a,t,d)&&ir(s,a,er(s,i))?a:-1}if(e.state!==r)return-1}return-1}const dr=/^<[^<>\s]{0,254}>/u,fr=256;function lr(e,n,t,r){const s=n[t];e.open?s===r&&(e.open=!1):e.placeholder?s===">"&&(e.placeholder=!1):s==="$"&&(n[t+1]==="{"||n[t+1]==="(")?e.references.push(n[t+1]==="{"?"}":")"):s===e.references.at(-1)?e.references.pop():s==="<"&&dr.test(n.slice(t,t+fr))?e.placeholder=!0:s===r&&(e.open=gr(n,t))}function gr(e,n){return e[n]==='"'||!Ge.test(e[n-1])}function pr(e,n,t,r){return n>=t||!(r||/\s/u.test(e.charAt(n+1)))}function rn(e,n){const t=e.index+e[0].length-e[1].length,r=[e.input.slice(e.index,n),e.input.slice(t,n)];return Object.assign(r,{index:e.index,input:e.input,groups:void 0})}const Er=/^\s{0,16}\(/u,_r=/(?<![=!<>])=[ \t]{0,16}$/u;function N(e){return e.input[e.index+e[0].length-e[1].length-1]}function m(e){return e==='"'||e==="'"}const mr=/[$<"']/u;function Sr(e){if(C.has(e)||m(N(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]==="<"&&(Nr(e[1])||_r.test(e.input.slice(Math.max(0,t-18),t))||Tr.test(r)))return!0;const s=sn(e[1]),i=e[1][s]==="!"?e[1][s+1]:e[1][s];return br.test(i??"")||Er.test(r)}function sn(e){let n=0;for(let t=q(e,n);t!==-1;t=q(e,n))n=t;return n}function q(e,n){const t=e[n];if(t==="<")return Ar(e,n);if(t!=="$")return-1;const r=e[n+1];if(r==="{"||r==="(")return hr(e,n+1,r);M.lastIndex=n;const s=M.exec(e)?.[0];return s===void 0?-1:n+s.length}function Ar(e,n){const t=e.indexOf(">",n+1),r=e.indexOf("<",n+1);return t!==-1&&(r===-1||t<r)?t+1:-1}function hr(e,n,t){const r=t==="{"?"}":")";let s=0;for(let i=n;i<e.length;i+=1){const u=e[i];if(u==="\\")i+=1;else if(u==="'"||u==='"')i=un(e,i);else if(u===t)s+=1;else if(u===r&&--s===0)return i+1}return-1}function un(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 Rr=/^[\w$.[\]|&,{}:;?]+$/u,yr=/^(?:"[^"]*"|'[^']*'|-?\d+(?:\.\d+)?)(?:\|(?:"[^"]*"|'[^']*'|-?\d+(?:\.\d+)?|[A-Za-z_$][\w$.]*))*$/u,$r=/\b(?:string|number|boolean|bigint|symbol|any|unknown|object|never|void|undefined|null)\b/u;function Nr(e){const n=e.slice(1,e.indexOf(">"));return yr.test(n)?!0:Rr.test(n)?$r.test(n)||/[.|&[{]/u.test(n)||/^[A-Z][\w$]*$/u.test(n)&&(n.length===1||/[a-z]/u.test(n)):!1}const br=/[.+\-*/%=^&]/u,Tr=/^\s{0,16}(?:\?\.|\?\?|\|\||&&|[([])/u;function xr(e,n,t){if(t)return!1;const r=n.replaceAll('"',"'");return e.lastIndex=0,e.exec(`"${r}"`)?.[1]===r}function us(e,n){if(!e.structured)return;const t=`${JSON.stringify(n)}:`,r=F(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=ve(t,s.index,s[1]);if(i!=="malformed")return i}}const Or=4097,on=10n**BigInt(Or-1);function Ir(e){if(typeof e=="bigint"){if(e>=on||e<=-on)throw new RangeError("bigint too large to judge");return e.toString()}return typeof e=="number"?Number.isFinite(e)?JSON.stringify(e):void 0:JSON.stringify(e).replaceAll("\u2028","\\u2028").replaceAll("\u2029","\\u2029")}function os(e,n,t){if(!e.structured)return!1;const r=Ir(n);return r===void 0?!1:ye(e).some(s=>Ke(s,F(s.structured).value,r,!0).accepts(t)(0))}function*Lr(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,u=Cr(e,n,i);if(u===void 0){r.lastIndex=s.index+1;continue}t(n.slice(i,u.start).trim())&&(yield{index:s.index}),r.lastIndex=u.end}}function Cr(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 wr(e,n){const{content:t}=e;e.lexerAt??=nn(t);const r=e.lexerAt(n);if(r.state===R)return;if(!Je(r))return"ambiguous";const s=e.found.get(r.opener);if(s!==void 0)return s;const{opener:i,state:u,escapes:o}=r;let c=t.length;for(;r.index<t.length;){const d=w(r);if(d!==-1||r.state!==u){c=d!==-1?d:r.index;break}}const a={opener:i,end:c,escaped:o&&t.slice(i,c).includes("\\")};return e.found.set(i,a),a}function Mr(e,n,t,r){let s=!1;if(!H(r.walkedEnd,n,t)){const u=gt(e,n,r.accepts,r.judge.accepts(!0));r.walkedEnd[t?"compact":"exact"]=u.end,s=u.found}const i=Dr(n,t,r,!s);return i==="incomplete"?i:s||i}function Dr(e,n,t,r){const s=an(t,e);if(s===void 0)return!1;const i=cn(t.numberRanges,s.base),u=cn(t.probedRanges,s.base);if(H(i,e,n)||!r&&H(u,e,n))return!1;const o=a=>d=>a(d+s.base),c=_t(s.strings.content,e-s.base,o(t.accepts),o(t.judge.accepts(!0)));return(r?i:u)[n?"compact":"exact"]=c.end+s.base,c.found}function cn(e,n){let t=e.get(n);return t===void 0&&(t={exact:0,compact:0},e.set(n,t)),t}function an(e,n,t=e.strings,r=0){const s=wr(t,n-r);if(s===void 0)return{strings:t,base:r};if(s==="ambiguous"||s.escaped)return;const i=r+s.opener+1;let u=e.bodies.get(i);return u===void 0&&(u={content:t.content.slice(s.opener+1,s.end),found:new Map},e.bodies.set(i,u)),an(e,n,u,i)}function H(e,n,t){return n<e.exact||t&&n<e.compact}function Pr(e,n,t,r){return(t||e.escaped(r)&&!e.direct(r))&&n(r)}function*zr(e,n,t){const r=F(n),s=Ke(e,r.value,t),i=new RegExp(r.key),u={exact:0,compact:0},o=new Map,c=new Map,a={content:t,found:new Map},d=new Map;for(let f=i.exec(t);f;f=i.exec(t)){const g=f[1],E=ve(t,f.index,g);if(E==="malformed")continue;const _=E==="prefixed",G=s.accepts(_),P=f.index+f[0].length,j=t[P];if(j==="["||j==="{"){const Y=Mr(t,P,_,{judge:s,accepts:G,walkedEnd:u,numberRanges:o,probedRanges:c,strings:a,bodies:d});Y&&(yield Y==="incomplete"?{index:f.index,normalization_incomplete:!0}:{index:f.index})}else Pr(s,G,g,P)&&(yield{index:f.index})}r.element&&(yield*Lr(r.element,t,Zr(e,n,r)))}const kr=8;function Zr(e,n,t){if(!n.elementValue){const r=e.minimumLiteralLength??kr;return s=>!Ut.test(s.trim())&&ln(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,D(e,i))}}function Ur(e,n,t){const r=n.index+n[0].length;return/^[ \t]*;/u.test(n.input.slice(r,r+64))&&!m(N(n))&&e.test(t)}function vr(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 W(e,n){e.raw+=n,e.literal+=n}function Kr(e,n,t){const r=e[n+1];if(e[n]!=="$"||r!=="{"&&r!=="(")return-1;const s=r==="{"?e.slice(n+2,n+2+jr(e,n+2)):"",i=t[0],u=t.length===1&&i.quote!==void 0&&i.literal.length===i.pieceStart;return t.push({close:r==="{"?"}":")",keep:s!=="",raw:`$${r}${s}`,literal:"",opensPiece:u}),n+2+s.length}const Fr=/[A-Za-z_]/u,Br=/\w/u,Vr=/[{(A-Za-z_]/u,M=/\$[A-Za-z_]\w*/y,qr=/^_*[A-Z][A-Z0-9_]*$/u,Hr=/^\$[A-Za-z_]\w*$/u,Wr=/^(["'])\$[A-Za-z_]\w*\1$/u;function Gr(e,n,t){M.lastIndex=n;const r=M.exec(e)?.[0];return r===void 0?-1:(t.literal===""&&qr.test(r.slice(1))?t.raw+=r:W(t,r),n+r.length)}function jr(e,n){if(!Fr.test(e[n]??""))return 0;let t=n+1;for(;t<e.length&&Br.test(e[t]);)t+=1;e[t]===":"&&(t+=1);const r=e[t];return r==="-"||r==="="||r==="+"?t+1-n:0}function Yr(e,n){const t=e.pop(),r=e.at(-1);r.raw+=`${t.raw}${n}`,t.keep&&(r.literal+=t.literal)}const dn=/[^$<"'\\})]+/y,Jr='$`"\\\n';function Qr(e,n){return e===`
7
+ `?"":n==='"'&&!Jr.includes(e)?`\\${e}`:e}function Xr(e,n,t){const r=e[n],s=t.quote;if(s==='"'&&r==="$"&&Vr.test(e[n+1]??""))return-1;let i=1,u=r;if(r==="\\"&&s!=="'"&&n+1<e.length)i=2,u=Qr(e[n+1],s);else if(s===void 0){if(r!=='"'&&r!=="'")return-1;t.quote=r,u=""}else r===s&&(t.quote=void 0,u="");return t.raw+=e.slice(n,n+i),t.keep&&(t.literal+=u),n+i}function es(e,n,t,r,s){const i=t.at(-1);dn.lastIndex=n;const u=dn.exec(e)?.[0];if(u!==void 0)return W(i,u),n+u.length;if(t.length>1){const g=Xr(e,n,i);if(g!==-1)return g}else if(r&&ns(e[n],i))return n+1;const o=Kr(e,n,t);if(o!==-1)return o;const c=t.at(-1),a=e[n],d=s&&a==="$"?Gr(e,n,c):-1;if(d!==-1)return d;if(t.length>1&&a===c.close)return Yr(t,a),n+1;const f=a==="<"?vr(e,n):-1;return f!==-1?(c.raw+=e.slice(n,f+1),f+1):(W(c,a),n+1)}function ns(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 fn(e,n,t){if(t&&(Hr.test(e)||n&&Wr.test(e)))return"";const r={close:"}",keep:!0,raw:"",literal:""},s=[r];for(let i=0;i<e.length;)i=es(e,i,s,n,t);for(let i=s.length-1;i>0;i-=1){const u=s[i],o=s[i-1];o.raw+=u.raw,n&&i===1&&u.opensPiece===!0||(o.literal+=u.raw)}return r.literal}function ln(e,n=!0){return fn(e,!1,n)}function ts(e,n=!0){return fn(e,!0,n)}function D(e,n){const t=e.minimumLiteralLength===void 0?n[1]:Fe(n);if(e.minimumLiteralLength!==void 0&&t.length<e.minimumLiteralLength||e.literalValue&&mr.test(n[1])&&!xr(e.literalValue,t,Sr(n))||e.rejectValue?.test(t)===!0||e.rejectStatementReference&&Ur(e.rejectStatementReference,n,t))return!1;if(e.minimumEntropy===void 0)return!0;const r=[...t],s=new Map;for(const u of r)s.set(u,(s.get(u)??0)+1);let i=0;for(const u of s.values()){const o=u/r.length;i-=o*Math.log2(o)}return i>=e.minimumEntropy}const cs={leadingReferencesEnd:sn,parsesAsJson:De,repeatsKey:ze,confirmsNumbers:we};export{$n as PRIVATE_HOME_PATH_PATTERN,Bn as SECRET_RULES,cs as _testOnly,D as acceptsSecretMatch,os as acceptsStructuredValue,_e as createSecretDecodedText,ln as expandRuntimeReferences,Cn as findPrivateHomePathMatches,is as findSecretRuleMatches,Ce as isNumericMetadataKey,ts as literalAfterReferences,us as structuredKeyShape};
6
8
  //# sourceMappingURL=secret-rules.js.map
@@ -1,2 +1,2 @@
1
- import{EXECUTABLE_COMMAND_ALIASES as b,PM_COMMAND_ALIAS_CONTRACTS as P,renderPmCommandAliasMigrationHint as B,resolvePmCommandAlias as $}from"./cli-contracts/command-aliases.js";import{hasSubcommandFlagContractsForCommand as G,resolveSubcommandFlagContractsForCommand as k}from"./cli-contracts/flag-contracts.js";import{levenshteinDistanceWithinLimit as M}from"../core/shared/levenshtein.js";import{EXIT_CODE as y}from"../core/shared/constants.js";import{PmCliError as L}from"../core/shared/errors.js";import{findPmNamespacedCommand as z,resolvePmCommandOperation as W}from"./cli-contracts/command-aliases.js";import{normalizeItemAddressInvocation as R}from"./agent/item-addressing.js";import{BOOTSTRAP_BOOLEAN_FLAGS as x,GLOBAL_VALUE_CONSUMING_FLAGS as h,consumesBootstrapValue as w,findBootstrapCommandTokenIndex as q,isInlineGlobalValueToken as U,parseBootstrapCommandName as D}from"./cli-contracts/bootstrap-command-scanner.js";const j=new Set(["--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),K=new Set(["toon","json"]);function X(e,t,n){const o=e[t];if(x.has(o))return n.booleanFlags.add(o),1;const s=o.indexOf("="),i=s>0?o.slice(0,s):o;if(!h.has(i))return 1;const a=s>0?o.slice(s+1):void 0,u=a===void 0&&w(i,e[t+1]),r=a??(u?e[t+1]:void 0);return i==="--author"?n.author=r??"":typeof r=="string"&&r.length>0&&(j.has(i)?n.outputValues:n.pathValues).set(i,r),u?2:1}function Y(e){return e.outputValues.get("--output-format")!=="toon"&&(e.booleanFlags.has("--json")||e.outputValues.get("--output-format")==="json"||e.pathValues.get("--format")?.trim().toLowerCase()==="json")}function H(e){const t={booleanFlags:new Set,outputValues:new Map,pathValues:new Map};let n=0;for(;n<e.length&&e[n]!=="--";)n+=X(e,n,t);return{path:t.pathValues.get("--pm-path")??t.pathValues.get("--path"),noExtensions:t.booleanFlags.has("--no-extensions")||["history attest","history-attest"].includes(O(e)??""),noPager:t.booleanFlags.has("--no-pager"),json:Y(t),quiet:t.booleanFlags.has("--quiet"),lean:t.booleanFlags.has("--lean"),tokenAccounting:t.booleanFlags.has("--token-accounting"),...t.booleanFlags.has("--output-row-contract")?{outputRowContract:!0}:{},...t.outputValues.get("--output-include")===void 0?{}:{outputInclude:t.outputValues.get("--output-include")},...t.outputValues.get("--output-limit")===void 0?{}:{outputLimit:t.outputValues.get("--output-limit")},...t.outputValues.get("--output-budget")===void 0?{}:{outputBudget:t.outputValues.get("--output-budget")},...K.has(t.outputValues.get("--output-format"))?{outputFormat:t.outputValues.get("--output-format")}:{},...t.outputValues.get("--output-session")===void 0?{}:{outputSession:t.outputValues.get("--output-session")},...t.outputValues.get("--output-cursor")===void 0?{}:{outputCursor:t.outputValues.get("--output-cursor")},...t.author===""?{authorMissingValue:!0}:t.author!==void 0?{author:t.author}:{}}}function S(e){const t=[];let n=0;for(;n<e.length;){const o=e[n];if(o==="--")break;if(x.has(o)||o==="--profile"||o==="--id-only"||o==="--full-changed-fields"||o==="--explain"){n+=1;continue}if(h.has(o)){n+=w(o,e[n+1])?2:1;continue}if(U(o)){n+=1;continue}t.push(o),n+=1}return t}function Z(e){const t=S(e);if(t[0]?.trim().toLowerCase()==="help"){const i=[];for(let a=1;a<t.length;a+=1){const u=t[a];if(u.startsWith("-"))break;i.push(u.trim().toLowerCase())}return{requested:!0,commandPathTokens:i}}if(t.findIndex(i=>i==="--help"||i==="-h")<0)return{requested:!1,commandPathTokens:[]};const s=[];for(const i of t){if(i.startsWith("-"))break;s.push(i.trim().toLowerCase())}return{requested:!0,commandPathTokens:s}}function m(e){return q(e)}function J(e){return D(e)}function v(e,t){return t.noPager?!0:process.stdout.isTTY===!0?!1:Z(e).requested}function Ve(e){const t=["PAGER","MANPAGER","GIT_PAGER","LESS"],n=t.map(i=>process.env[i]),o=()=>{for(const[i,a]of t.entries()){const u=n[i];u===void 0?delete process.env[a]:process.env[a]=u}},s=H(e);return v(e,s)&&(process.env.PAGER="cat",process.env.MANPAGER="cat",process.env.GIT_PAGER="cat",(typeof process.env.LESS!="string"||process.env.LESS.trim().length===0)&&(process.env.LESS="FRX")),o}const Q=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function ee(e){const t=e.indexOf("--");return(t===-1?e:e.slice(0,t)).some(n=>/^(?:--)?fields(?:[=:]|$)/iu.test(n))}function te(e){const t=m(e);if(t===void 0||e[t]!=="extension")return[...e];const n=e[t+1];if(!n||n.startsWith("-"))return[...e];if(!Q.has(n))return[...e];if(e.includes("--help")||e.includes("-h"))return[...e];if((n==="explore"||n==="manage")&&ee(e.slice(t+2)))return[...e];const o=`--${n}`;return e.includes(o)?[...e]:[...e.slice(0,t+1),o,...e.slice(t+2)]}const ne=new Set(["pm","pm-cli"]);function oe(e,t){const n=m(e);if(n===void 0)return e;const o=e[n];return ne.has(o.trim().toLowerCase())?(t.push({from:o,to:[],reason:"executable_alias",confidence:"high"}),[...e.slice(0,n),...e.slice(n+1)]):e}function se(e,t){let n=m(e);if(n!==void 0&&e[n]==="help"){const u=m(e.slice(n+1));n=u===void 0?void 0:n+1+u}if(n===void 0)return e;const o=e[n],s=b[o.trim().toLowerCase()];if(!s)return e;const i=s.split(" "),a=[...e.slice(0,n),...i,...e.slice(n+1)];return t.push({from:o,to:i,reason:"command_alias",confidence:"high"}),a}function g(e){return e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function A(e){return g(e).replace(/-/g,"")}function T(e,t,n){const o=e.get(t);if(o===void 0){e.set(t,n);return}o!==n&&e.set(t,null)}function I(e){const t=[],n=o=>{typeof o=="string"&&o.startsWith("--")&&t.push(o)};n(e.flag);for(const o of e.aliases??[])n(o);return t}function _(e,t){const n=t??k(e),o=new Map,s=new Map,i=new Map,a=new Set;for(const u of n){const r=I(u);if(r.length===0)continue;const c=`--${g(r[0])}`;for(const f of r)T(o,g(f),c),T(s,A(f),c);const l=A(c);i.has(c)||i.set(c,l),u.list===!0&&a.add(c)}return{canonicalByNormalized:o,canonicalByCompact:s,canonicalComparables:[...i.entries()].map(([u,r])=>({canonicalFlag:u,comparable:r})),listCanonicalFlags:a}}function C(e,t){const n=g(e),o=t.canonicalByNormalized.get(n);if(typeof o=="string")return{flag:o,reason:"flag_alias",confidence:"high"};const s=n.replace(/-/g,""),i=t.canonicalByCompact.get(s);if(typeof i=="string")return{flag:i,reason:"flag_alias",confidence:"high"};const a=s.length>=8?2:1;let u=Number.POSITIVE_INFINITY,r,c=!1;for(const l of t.canonicalComparables){const f=M(s,l.comparable,a);if(f!==null){if(f<u){u=f,r=l.canonicalFlag,c=!1;continue}f===u&&r!==l.canonicalFlag&&(c=!0)}}return!r||c||!Number.isFinite(u)||u<=0?null:{flag:r,reason:"flag_typo",confidence:u>=2?"medium":"high"}}function Ee(e){const t=[`${e}s`];return e.endsWith("y")&&e.length>1&&t.push(`${e.slice(0,-1)}ies`),t}function ie(e,t=!1){if(t||e.includes("://"))return null;const n=e.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);if(!n)return null;const o=n[1],s=n[3];return s.length===0||n[2]===":"&&/\s/u.test(e)?null:{key:o,value:s}}function V(e,t,n=!1){if(n||!e.startsWith("--"))return{tokens:[e]};const o=e.indexOf("="),s=o>=0?e.slice(0,o):e,i=o>=0?e.slice(o+1):void 0,a=C(s,t);if(!a)return{tokens:[e]};const u=i===void 0?a.flag:`${a.flag}=${i}`;return u===e?{tokens:[e]}:{tokens:[u],event:{from:e,to:[u],reason:a.reason,confidence:a.confidence}}}function E(e){const t=new Set;let n=!1;for(let o=0;o<e.length;o+=1){if(n){t.add(o),n=!1;continue}const s=e[o];n=s==="--path"||s==="--pm-path"}return t}function ae(e){if(!e.startsWith("--"))return null;const t=e.indexOf("=");return t<0?{flag:e}:{flag:e.slice(0,t),inlineValue:e.slice(t+1)}}function ue(e,t,n){n.push(e[t]);const o=e[t+1];return typeof o=="string"&&o!=="--"?(n.push(o),t+2):t+1}function re(e,t,n,o){if(n.inlineValue!==void 0)return{originalTokens:[e[t]],value:n.inlineValue,consumed:1};const s=[];let i=t+1;for(;i<e.length&&e[i]!=="--"&&!e[i].startsWith("-")&&(s.length===0||o.has(n.flag));)s.push(e[i]),i+=1;const a=s.length===0?1:1+s.length;return{originalTokens:e.slice(t,t+a),value:s.length===0?void 0:s.join(","),consumed:a}}function ce(e,t,n,o){const s=e.get(n);if(s){s.values.push(o.value),s.occurrences+=1;return}e.set(n,{outputIndex:t.length,originalTokens:o.originalTokens,values:[o.value],occurrences:1}),t.push(null)}function le(e,t){const n=[],o=[];for(const[s,i]of e){if(!(i.occurrences>=2||t.has(s)&&i.originalTokens.length>2)){o.push({outputIndex:i.outputIndex,tokens:i.originalTokens});continue}const u=`${s}=${i.values.join(",")}`;o.push({outputIndex:i.outputIndex,tokens:[u]}),n.push({from:`${s} (x${i.occurrences})`,to:[u],reason:"list_merge",confidence:"high"})}return{events:n,splices:o}}function fe(e,t){t.sort((n,o)=>o.outputIndex-n.outputIndex);for(const n of t)e.splice(n.outputIndex,1,...n.tokens)}function pe(e,t,n=new Set,o=new Set){if(t.size===0)return{argv:[...e],events:[]};const s=[],i=new Map;let a=0;for(;a<e.length;){const c=e[a];if(c==="--"){s.push(...e.slice(a));break}if(n.has(c)){a=ue(e,a,s);continue}const l=ae(c);if(!l||!t.has(l.flag)){s.push(c),a+=1;continue}const f=re(e,a,l,o);if(f.value===void 0){s.push(c),a+=f.consumed;continue}ce(i,s,l.flag,{originalTokens:f.originalTokens,value:f.value}),a+=f.consumed}const{events:u,splices:r}=le(i,o);return fe(s,r),{argv:s,events:u}}const F=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function de(e,t){if(e!=="test"||t.length<2)return!1;const n=t[t.length-1],o=t[t.length-2],s=F.get(o);return s!==void 0&&s.has(n)}function he(e,t,n){if(t!=="test")return e;const o=[];let s=0;for(;s<e.length;){const i=e[s];if(i==="--")return o.push(...e.slice(s)),o;const a=F.get(i),u=a?e[s+1]:void 0;if(!a||typeof u!="string"||!a.has(u)){o.push(i),s+=1;continue}let r=s+2;for(;r<e.length&&!e[r].startsWith("-");)r+=1;if(r-(s+2)!==1){o.push(i),s+=1;continue}const c=e[s+2],l=`${u}=${c}`;o.push(i,l),n.push({from:`${i} ${u} ${c}`,to:[i,l],reason:"bare_key_value",confidence:"high"}),s+=3}return o}function me(e,t,n,o){const s=[],i=E(e);for(let a=0;a<e.length;a+=1){const u=e[a];if(u==="--"){s.push(...e.slice(a));break}const r=i.has(a),c=s[s.length-1];if(u.startsWith("--")){const d=V(u,t,r);s.push(...d.tokens),d.event&&o.push(d.event);continue}const l=ie(u,r);if(!l||typeof c=="string"&&c.startsWith("-")&&!c.includes("=")||["search","comments","notes","learnings"].includes(n)||de(n,s)){s.push(u);continue}const f=C(l.key,t);if(!f){s.push(u);continue}const p=l.value.startsWith("-")?[`${f.flag}=${l.value}`]:[f.flag,l.value];s.push(...p),o.push({from:u,to:p,reason:"bare_key_value",confidence:f.confidence})}return s}function ge(e){for(let t=0;t<e.length;t+=1){const n=e[t];if(n==="--")break;if(n==="--verify"){const o=e[t+1];if(o===void 0||o==="--")throw new L("history attest --verify requires a bundle file.",y.USAGE);e.splice(t,2,`--verify=${o}`)}else(h.has(n)||n==="--output"||n==="--hash-algorithm")&&(t+=1)}}function xe(e,t){if(!e.some(o=>o==="--help"||o==="-h"))return;const n=new Set(k(t).flatMap(o=>[o.flag,...o.aliases??[],...o.short===void 0?[]:[o.short]]));for(let o=0;o<e.length;o+=1){const s=e[o];if(s==="--")break;s!=="--help"&&s!=="-h"||n.has(e[o-1])&&!x.has(e[o-1])&&(e[o-1]=s)}}function Fe(e){const t=[],n=oe(e,t),o=te(n);(o.length!==n.length||o.some((d,N)=>d!==n[N]))&&t.push({from:n.join(" "),to:[...o],reason:"legacy_extension_action",confidence:"high"});const s=se(o,t),i=R(s);if(i.conflict)throw new L("Provide the item id either positionally or with --id, not both.",y.USAGE);i.changed&&t.push({from:`--id ${i.itemId}`,to:[i.itemId],reason:"item_id_alias",confidence:"high"});const a=J(i.argv),u=O(i.argv),r=W(u??a??""),c=_(u??a),l=me(i.argv,c,r,t),f=he(l,r,t),p=pe(f,c.listCanonicalFlags,h,a==="create"?new Set(["--tags"]):new Set);for(const d of p.events)t.push(d);return xe(p.argv,u??a),u==="history attest"&&ge(p.argv),{argv:p.argv,commandName:a,trace:t}}const Te=new Set(["--capability","--gh","--github","--ref","--output","--detail"]);function Ce(e){for(let t=0;t<e.length;t+=1){const n=e[t];if(!n.startsWith("-"))return n;(Te.has(n)||h.has(n))&&(t+=1)}}function Oe(e){for(let t=0;t<e.length;t+=1){const n=e[t];if(n==="--")return[...e.slice(0,t),...e.slice(t+1)];if(!n.startsWith("-"))break;h.has(n)&&(t+=1)}return[...e]}function be(e,t){const n=Ce(t);if(n===void 0||n===t[0])return n;const o=n.trim().toLowerCase();return G(`${e} ${o}`)||e!=="extension"&&o==="upgrade"?n:void 0}function O(e){const t=m(e),n=S(t===void 0?e:e.slice(t)),o=n[0]?.trim().toLowerCase(),s=(o==="extension"||o==="package"||o==="packages"?be(o,n.slice(1)):n[1])?.trim().toLowerCase(),i=z(n);return i?i.canonical:(o==="extension"||o==="package"||o==="packages")&&typeof s=="string"&&s.length>0&&!s.startsWith("-")?`${o} ${s}`:o}function Ne(e){for(let t=0;t<e.length;t+=1){const n=e[t];if(n==="--")break;if(n==="--type"){const o=e[t+1];if(typeof o=="string"&&o.trim().length>0)return o.trim();continue}if(n.startsWith("--type=")){const o=n.slice(7).trim();if(o.length>0)return o}}}const Pe={buildFlagLookup:_,collectBootstrapPathValueIndices:E,collectLongFlagCandidates:I,markUnambiguousFlag:T,normalizeLongOptionToken:V,resolveCanonicalFlag:C};export{b as EXECUTABLE_COMMAND_ALIASES,P as PM_COMMAND_ALIAS_CONTRACTS,Pe as _testOnly,Ve as applyBootstrapPagerPolicy,pe as coalesceRepeatedListFlags,m as findBootstrapCommandTokenIndex,Ee as listAliasPluralKeys,he as mergeLinkedTestTwoTokenEntries,Fe as normalizeBootstrapInvocation,te as normalizeLegacyExtensionActionSyntax,J as parseBootstrapCommandName,H as parseBootstrapGlobalOptions,Z as parseBootstrapHelpRequest,Ne as parseBootstrapTypeValue,Oe as removeLeadingCommandTerminator,B as renderPmCommandAliasMigrationHint,Ce as resolveLifecycleVerb,$ as resolvePmCommandAlias,S as stripGlobalBootstrapTokens};
1
+ import{EXECUTABLE_COMMAND_ALIASES as b,PM_COMMAND_ALIAS_CONTRACTS as P,renderPmCommandAliasMigrationHint as B,resolvePmCommandAlias as $}from"./cli-contracts/command-aliases.js";import{hasSubcommandFlagContractsForCommand as G,resolveSubcommandFlagContractsForCommand as k}from"./cli-contracts/flag-contracts.js";import{levenshteinDistanceWithinLimit as M}from"../core/shared/levenshtein.js";import{EXIT_CODE as y}from"../core/shared/constants.js";import{PmCliError as L}from"../core/shared/errors.js";import{findPmNamespacedCommand as z,resolvePmCommandOperation as W}from"./cli-contracts/command-aliases.js";import{normalizeItemAddressInvocation as R}from"./agent/item-addressing.js";import{BOOTSTRAP_BOOLEAN_FLAGS as x,GLOBAL_VALUE_CONSUMING_FLAGS as h,consumesBootstrapValue as w,findBootstrapCommandTokenIndex as q,isInlineGlobalValueToken as U,parseBootstrapCommandName as D}from"./cli-contracts/bootstrap-command-scanner.js";const j=new Set(["--output-include","--output-limit","--output-budget","--output-format","--output-session","--output-cursor"]),K=new Set(["toon","json"]);function X(e,t,n){const o=e[t];if(x.has(o))return n.booleanFlags.add(o),1;const s=o.indexOf("="),i=s>0?o.slice(0,s):o;if(!h.has(i))return 1;const a=s>0?o.slice(s+1):void 0,u=a===void 0&&w(i,e[t+1]),r=a??(u?e[t+1]:void 0);return i==="--author"?n.author=r??"":typeof r=="string"&&r.length>0&&(j.has(i)?n.outputValues:n.pathValues).set(i,r),u?2:1}function Y(e){return e.outputValues.get("--output-format")!=="toon"&&(e.booleanFlags.has("--json")||e.outputValues.get("--output-format")==="json"||e.pathValues.get("--format")?.trim().toLowerCase()==="json")}function H(e){const t={booleanFlags:new Set,outputValues:new Map,pathValues:new Map};let n=0;for(;n<e.length&&e[n]!=="--";)n+=X(e,n,t);return{path:t.pathValues.get("--pm-path")??t.pathValues.get("--path"),noExtensions:t.booleanFlags.has("--no-extensions")||["history attest","history-attest"].includes(O(e)??""),noPager:t.booleanFlags.has("--no-pager"),json:Y(t),quiet:t.booleanFlags.has("--quiet"),lean:t.booleanFlags.has("--lean"),tokenAccounting:t.booleanFlags.has("--token-accounting"),...t.booleanFlags.has("--output-row-contract")?{outputRowContract:!0}:{},...t.outputValues.get("--output-include")===void 0?{}:{outputInclude:t.outputValues.get("--output-include")},...t.outputValues.get("--output-limit")===void 0?{}:{outputLimit:t.outputValues.get("--output-limit")},...t.outputValues.get("--output-budget")===void 0?{}:{outputBudget:t.outputValues.get("--output-budget")},...K.has(t.outputValues.get("--output-format"))?{outputFormat:t.outputValues.get("--output-format")}:{},...t.outputValues.get("--output-session")===void 0?{}:{outputSession:t.outputValues.get("--output-session")},...t.outputValues.get("--output-cursor")===void 0?{}:{outputCursor:t.outputValues.get("--output-cursor")},...t.author===""?{authorMissingValue:!0}:t.author!==void 0?{author:t.author}:{}}}function S(e){const t=[];let n=0;for(;n<e.length;){const o=e[n];if(o==="--")break;if(x.has(o)||o==="--profile"||o==="--id-only"||o==="--full-changed-fields"||o==="--explain"){n+=1;continue}if(h.has(o)){n+=w(o,e[n+1])?2:1;continue}if(U(o)){n+=1;continue}t.push(o),n+=1}return t}function Z(e){const t=S(e);if(t[0]?.trim().toLowerCase()==="help"){const i=[];for(let a=1;a<t.length;a+=1){const u=t[a];if(u.startsWith("-"))break;i.push(u.trim().toLowerCase())}return{requested:!0,commandPathTokens:i}}if(t.findIndex(i=>i==="--help"||i==="-h")<0)return{requested:!1,commandPathTokens:[]};const s=[];for(const i of t){if(i.startsWith("-"))break;s.push(i.trim().toLowerCase())}return{requested:!0,commandPathTokens:s}}function m(e){return q(e)}function J(e){return D(e)}function v(e,t){return t.noPager?!0:process.stdout.isTTY===!0?!1:Z(e).requested}function Ve(e){const t=["PAGER","MANPAGER","GIT_PAGER","LESS"],n=t.map(i=>process.env[i]),o=()=>{for(const[i,a]of t.entries()){const u=n[i];u===void 0?delete process.env[a]:process.env[a]=u}},s=H(e);return v(e,s)&&(process.env.PAGER="cat",process.env.MANPAGER="cat",process.env.GIT_PAGER="cat",(typeof process.env.LESS!="string"||process.env.LESS.trim().length===0)&&(process.env.LESS="FRX")),o}const Q=new Set(["install","uninstall","explore","manage","doctor","adopt","adopt-all","activate","deactivate"]);function ee(e){const t=e.indexOf("--");return(t===-1?e:e.slice(0,t)).some(n=>/^(?:--)?fields(?:[=:]|$)/iu.test(n))}function te(e){const t=m(e);if(t===void 0||e[t]!=="extension")return[...e];const n=e[t+1];if(!n||n.startsWith("-"))return[...e];if(!Q.has(n))return[...e];if(e.includes("--help")||e.includes("-h"))return[...e];if((n==="explore"||n==="manage")&&ee(e.slice(t+2)))return[...e];const o=`--${n}`;return e.includes(o)?[...e]:[...e.slice(0,t+1),o,...e.slice(t+2)]}const ne=new Set(["pm","pm-cli"]);function oe(e,t){const n=m(e);if(n===void 0)return e;const o=e[n];return ne.has(o.trim().toLowerCase())?(t.push({from:o,to:[],reason:"executable_alias",confidence:"high"}),[...e.slice(0,n),...e.slice(n+1)]):e}function se(e,t){let n=m(e);if(n!==void 0&&e[n]==="help"){const u=m(e.slice(n+1));n=u===void 0?void 0:n+1+u}if(n===void 0)return e;const o=e[n],s=b[o.trim().toLowerCase()];if(!s)return e;const i=s.split(" "),a=[...e.slice(0,n),...i,...e.slice(n+1)];return t.push({from:o,to:i,reason:"command_alias",confidence:"high"}),a}function g(e){return e.replace(/^--?/,"").replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function A(e){return g(e).replace(/-/g,"")}function T(e,t,n){const o=e.get(t);if(o===void 0){e.set(t,n);return}o!==n&&e.set(t,null)}function I(e){const t=[],n=o=>{typeof o=="string"&&o.startsWith("--")&&t.push(o)};n(e.flag);for(const o of e.aliases??[])n(o);return t}function _(e,t){const n=t??k(e),o=new Map,s=new Map,i=new Map,a=new Set;for(const u of n){const r=I(u);if(r.length===0)continue;const c=`--${g(r[0])}`;for(const f of r)T(o,g(f),c),T(s,A(f),c);const l=A(c);i.has(c)||i.set(c,l),u.list===!0&&a.add(c)}return{canonicalByNormalized:o,canonicalByCompact:s,canonicalComparables:[...i.entries()].map(([u,r])=>({canonicalFlag:u,comparable:r})),listCanonicalFlags:a}}function C(e,t){const n=g(e),o=t.canonicalByNormalized.get(n);if(typeof o=="string")return{flag:o,reason:"flag_alias",confidence:"high"};const s=n.replace(/-/g,""),i=t.canonicalByCompact.get(s);if(typeof i=="string")return{flag:i,reason:"flag_alias",confidence:"high"};const a=s.length>=8?2:1;let u=Number.POSITIVE_INFINITY,r,c=!1;for(const l of t.canonicalComparables){const f=M(s,l.comparable,a);if(f!==null){if(f<u){u=f,r=l.canonicalFlag,c=!1;continue}f===u&&r!==l.canonicalFlag&&(c=!0)}}return!r||c||!Number.isFinite(u)||u<=0?null:{flag:r,reason:"flag_typo",confidence:u>=2?"medium":"high"}}function Ee(e){const t=[`${e}s`];return e.endsWith("y")&&e.length>1&&t.push(`${e.slice(0,-1)}ies`),t}function ie(e,t=!1){if(t||e.includes("://"))return null;const n=e.match(/^([A-Za-z][A-Za-z0-9_-]{1,63})([:=])(.*)$/);if(!n)return null;const o=n[1],s=n[3];return s.length===0||n[2]===":"&&/\s/u.test(e)?null:{key:o,value:s}}function V(e,t,n=!1){if(n||!e.startsWith("--"))return{tokens:[e]};const o=e.indexOf("="),s=o>=0?e.slice(0,o):e,i=o>=0?e.slice(o+1):void 0,a=C(s,t);if(!a)return{tokens:[e]};const u=i===void 0?a.flag:`${a.flag}=${i}`;return u===e?{tokens:[e]}:{tokens:[u],event:{from:e,to:[u],reason:a.reason,confidence:a.confidence}}}function E(e){const t=new Set;let n=!1;for(let o=0;o<e.length;o+=1){if(n){t.add(o),n=!1;continue}const s=e[o];n=s==="--path"||s==="--pm-path"}return t}function ae(e){if(!e.startsWith("--"))return null;const t=e.indexOf("=");return t<0?{flag:e}:{flag:e.slice(0,t),inlineValue:e.slice(t+1)}}function ue(e,t,n){n.push(e[t]);const o=e[t+1];return typeof o=="string"&&o!=="--"?(n.push(o),t+2):t+1}function re(e,t,n,o){if(n.inlineValue!==void 0)return{originalTokens:[e[t]],value:n.inlineValue,consumed:1};const s=[];let i=t+1;for(;i<e.length&&e[i]!=="--"&&!e[i].startsWith("-")&&(s.length===0||o.has(n.flag));)s.push(e[i]),i+=1;const a=s.length===0?1:1+s.length;return{originalTokens:e.slice(t,t+a),value:s.length===0?void 0:s.join(","),consumed:a}}function ce(e,t,n,o){const s=e.get(n);if(s){s.values.push(o.value),s.occurrences+=1;return}e.set(n,{outputIndex:t.length,originalTokens:o.originalTokens,values:[o.value],occurrences:1}),t.push(null)}function le(e,t){const n=[],o=[];for(const[s,i]of e){if(!(i.occurrences>=2||t.has(s)&&i.originalTokens.length>2)){o.push({outputIndex:i.outputIndex,tokens:i.originalTokens});continue}const u=`${s}=${i.values.join(",")}`;o.push({outputIndex:i.outputIndex,tokens:[u]}),n.push({from:`${s} (x${i.occurrences})`,to:[u],reason:"list_merge",confidence:"high"})}return{events:n,splices:o}}function fe(e,t){t.sort((n,o)=>o.outputIndex-n.outputIndex);for(const n of t)e.splice(n.outputIndex,1,...n.tokens)}function pe(e,t,n=new Set,o=new Set){if(t.size===0)return{argv:[...e],events:[]};const s=[],i=new Map;let a=0;for(;a<e.length;){const c=e[a];if(c==="--"){s.push(...e.slice(a));break}if(n.has(c)){a=ue(e,a,s);continue}const l=ae(c);if(!l||!t.has(l.flag)){s.push(c),a+=1;continue}const f=re(e,a,l,o);if(f.value===void 0){s.push(c),a+=f.consumed;continue}ce(i,s,l.flag,{originalTokens:f.originalTokens,value:f.value}),a+=f.consumed}const{events:u,splices:r}=le(i,o);return fe(s,r),{argv:s,events:u}}const F=new Map([["--add",new Set(["command","cmd","path"])],["--remove",new Set(["command","path"])]]);function de(e,t){if(e!=="test"||t.length<2)return!1;const n=t[t.length-1],o=t[t.length-2],s=F.get(o);return s!==void 0&&s.has(n)}function he(e,t,n){if(t!=="test")return e;const o=[];let s=0;for(;s<e.length;){const i=e[s];if(i==="--")return o.push(...e.slice(s)),o;const a=F.get(i),u=a?e[s+1]:void 0;if(!a||typeof u!="string"||!a.has(u)){o.push(i),s+=1;continue}let r=s+2;for(;r<e.length&&!e[r].startsWith("-");)r+=1;if(r-(s+2)!==1){o.push(i),s+=1;continue}const c=e[s+2],l=`${u}=${c}`;o.push(i,l),n.push({from:`${i} ${u} ${c}`,to:[i,l],reason:"bare_key_value",confidence:"high"}),s+=3}return o}function me(e,t,n,o){const s=[],i=E(e);for(let a=0;a<e.length;a+=1){const u=e[a];if(u==="--"){s.push(...e.slice(a));break}const r=i.has(a),c=s[s.length-1];if(u.startsWith("--")){const d=V(u,t,r);s.push(...d.tokens),d.event&&o.push(d.event);continue}const l=ie(u,r);if(!l||typeof c=="string"&&c.startsWith("-")&&!c.includes("=")||["search","comments","notes","learnings"].includes(n)||de(n,s)){s.push(u);continue}const f=C(l.key,t);if(!f){s.push(u);continue}const p=l.value.startsWith("-")?[`${f.flag}=${l.value}`]:[f.flag,l.value];s.push(...p),o.push({from:u,to:p,reason:"bare_key_value",confidence:f.confidence})}return s}function ge(e){for(let t=0;t<e.length;t+=1){const n=e[t];if(n==="--")break;if(n==="--verify"){const o=e[t+1];if(o===void 0||o==="--")throw new L("history attest --verify requires a bundle file.",y.USAGE);e.splice(t,2,`--verify=${o}`)}else(h.has(n)||n==="--output"||n==="--hash-algorithm")&&(t+=1)}}function xe(e,t){if(!e.some(o=>o==="--help"||o==="-h"))return;const n=new Set(k(t).flatMap(o=>[o.flag,...o.aliases??[],...o.short===void 0?[]:[o.short]]));for(let o=0;o<e.length;o+=1){const s=e[o];if(s==="--")break;s!=="--help"&&s!=="-h"||n.has(e[o-1])&&!x.has(e[o-1])&&(e[o-1]=s)}}function Fe(e){const t=[],n=oe(e,t),o=te(n);(o.length!==n.length||o.some((d,N)=>d!==n[N]))&&t.push({from:n.join(" "),to:[...o],reason:"legacy_extension_action",confidence:"high"});const s=se(o,t),i=R(s);if(i.conflict)throw new L("Provide the item id either positionally or with --id, not both.",y.USAGE);i.changed&&t.push({from:`--id ${i.itemId}`,to:[i.itemId],reason:"item_id_alias",confidence:"high"});const a=J(i.argv),u=O(i.argv),r=W(u??a??""),c=_(u??a),l=me(i.argv,c,r,t),f=he(l,r,t),p=pe(f,c.listCanonicalFlags,h,a==="create"?new Set(["--tags"]):new Set);for(const d of p.events)t.push(d);return xe(p.argv,u??a),u==="history attest"&&ge(p.argv),{argv:p.argv,commandName:a,trace:t}}const Te=new Set(["--capability","--gh","--github","--ref","--output","--detail"]);function Ce(e){for(let t=0;t<e.length;t+=1){const n=e[t];if(!n.startsWith("-"))return n;(Te.has(n)||h.has(n))&&(t+=1)}}function Oe(e){for(let t=0;t<e.length;t+=1){const n=e[t];if(n==="--")return[...e.slice(0,t),...e.slice(t+1)];if(!n.startsWith("-"))break;h.has(n)&&(t+=1)}return[...e]}function be(e,t){const n=Ce(t);if(n===void 0||n===t[0])return n;const o=n.trim().toLowerCase();return G(`${e} ${o}`)?n:void 0}function O(e){const t=m(e),n=S(t===void 0?e:e.slice(t)),o=n[0]?.trim().toLowerCase(),s=(o==="extension"||o==="package"||o==="packages"?be(o,n.slice(1)):n[1])?.trim().toLowerCase(),i=z(n);return i?i.canonical:(o==="extension"||o==="package"||o==="packages")&&typeof s=="string"&&s.length>0&&!s.startsWith("-")?`${o} ${s}`:o}function Ne(e){for(let t=0;t<e.length;t+=1){const n=e[t];if(n==="--")break;if(n==="--type"){const o=e[t+1];if(typeof o=="string"&&o.trim().length>0)return o.trim();continue}if(n.startsWith("--type=")){const o=n.slice(7).trim();if(o.length>0)return o}}}const Pe={buildFlagLookup:_,collectBootstrapPathValueIndices:E,collectLongFlagCandidates:I,markUnambiguousFlag:T,normalizeLongOptionToken:V,resolveCanonicalFlag:C};export{b as EXECUTABLE_COMMAND_ALIASES,P as PM_COMMAND_ALIAS_CONTRACTS,Pe as _testOnly,Ve as applyBootstrapPagerPolicy,pe as coalesceRepeatedListFlags,m as findBootstrapCommandTokenIndex,Ee as listAliasPluralKeys,he as mergeLinkedTestTwoTokenEntries,Fe as normalizeBootstrapInvocation,te as normalizeLegacyExtensionActionSyntax,J as parseBootstrapCommandName,H as parseBootstrapGlobalOptions,Z as parseBootstrapHelpRequest,Ne as parseBootstrapTypeValue,Oe as removeLeadingCommandTerminator,B as renderPmCommandAliasMigrationHint,Ce as resolveLifecycleVerb,$ as resolvePmCommandAlias,S as stripGlobalBootstrapTokens};
2
2
  //# sourceMappingURL=cli-bootstrap.js.map
@@ -55,6 +55,22 @@ export declare function withFlagAliasMetadata(flagContracts:CliFlagContract[]):C
55
55
  export declare function compactFlagAliasContracts(flagContracts:CliFlagContract[]):CliFlagContract[];
56
56
  /** Public contract for subcommand global flag contracts, shared by SDK and presentation-layer consumers. */
57
57
  export declare const SUBCOMMAND_GLOBAL_FLAG_CONTRACTS:CliFlagContract[];
58
+ /**
59
+ * Inventory paths the CLI dispatches statically, without lifecycle hooks
60
+ * (`list` is the inventory's alias, pm-gh1777). They never write items, so a
61
+ * revision guard is refused, and their only output budget is `unbounded`
62
+ * because the inventory cannot trim rows to fit.
63
+ */
64
+ export declare const STATIC_INVENTORY_COMMAND_PATHS:ReadonlySet<string>;
65
+ /** Command operations an optional package owns; core keeps only compatibility paths for them. */
66
+ export declare const PACKAGE_OWNED_COMMANDS:ReadonlySet<string>;
67
+ /**
68
+ * Whether a core command path publishes inherited host rows (pm-6vk110): it
69
+ * has its own flag table and is neither a package-owned compatibility path
70
+ * (calendar, guide) nor a bare namespace (item, ops). `pm contracts` and
71
+ * `pm help --json` both read this, so the two surfaces always agree.
72
+ */
73
+ export declare function hasCoreInheritedFlagSurface(command:string):boolean;
58
74
  /**
59
75
  * Host-owned flags an extension command accepts, marked `owner: "host"` because
60
76
  * they reach the handler through `context.global` (pm-gh1666). Read-output
@@ -64,6 +80,23 @@ export declare const SUBCOMMAND_GLOBAL_FLAG_CONTRACTS:CliFlagContract[];
64
80
  * is classified where it is reserved.
65
81
  */
66
82
  export declare function resolveExtensionCommandInheritedFlagContracts(options?:{readOutput?:boolean;}):CliFlagContract[];
83
+ /**
84
+ * Host-owned flags a core command accepts from the root program, as rows
85
+ * marked `owner: "host"` like an extension command's (pm-6vk110). They come
86
+ * from the same reserved table, with two differences that follow from how a
87
+ * core command runs: `--no-extensions` is listed, because a core command
88
+ * survives it, and the read-output controls are listed only when the path is
89
+ * a native read surface, judged by the resolver that refuses them elsewhere
90
+ * with `read_output_surface_unsupported`. `--expect-hash` is listed only when
91
+ * the caller reports the command admits a revision guard (the predicate behind
92
+ * `expect_hash_requires_mutation`). A host flag the command declares itself
93
+ * (`close --author`, the `--output-format` encoding row) stays in its own
94
+ * rows, so each spelling has one owner; the encoding row's `--format` alias is
95
+ * carried onto the host row where help lists it as inherited.
96
+ */
97
+ export declare function resolveCoreCommandInheritedFlagContracts(command:string,declaredSpellings?:Iterable<string>,options?:{expectHashAdmissible?:boolean;}):CliFlagContract[];
98
+ /** Every spelling a contract row owns: its flag, short form and aliases. */
99
+ export declare function cliFlagContractSpellings(contracts:readonly CliFlagContract[]):string[];
67
100
  /** Public contract for global flag contracts, shared by SDK and presentation-layer consumers. */
68
101
  export declare const GLOBAL_FLAG_CONTRACTS:CliFlagContract[];
69
102
  /** Public contract for list filter flag contracts, shared by SDK and presentation-layer consumers. */
@@ -78,6 +111,16 @@ export declare const NOTES_FLAG_CONTRACTS:CliFlagContract[];
78
111
  export declare const LEARNINGS_FLAG_CONTRACTS:CliFlagContract[];
79
112
  /** Public contract for files flag contracts, shared by SDK and presentation-layer consumers. */
80
113
  export declare const FILES_FLAG_CONTRACTS:CliFlagContract[];
114
+ /**
115
+ * `pm files discover <id>` (pm-9ke7h9): a preview of the file paths named in
116
+ * item text, which writes only with `--apply`.
117
+ */
118
+ export declare const FILES_DISCOVER_FLAG_CONTRACTS:CliFlagContract[];
119
+ /**
120
+ * `pm files lookup <paths...>` (pm-9ke7h9): the bounded reverse query. Its
121
+ * flags belong to this subcommand; `pm files <id>` refuses them.
122
+ */
123
+ export declare const FILES_LOOKUP_FLAG_CONTRACTS:CliFlagContract[];
81
124
  /** Public contract for docs flag contracts, shared by SDK and presentation-layer consumers. */
82
125
  export declare const DOCS_FLAG_CONTRACTS:CliFlagContract[];
83
126
  /** Public contract for history flag contracts, shared by SDK and presentation-layer consumers. */
@@ -248,6 +291,13 @@ export declare function resolvePmPositionalActionFlagContracts(actions?:readonly
248
291
  export declare const PM_POSITIONAL_ACTION_FLAG_CONTRACTS:(readonly[string,CliFlagContract[]])[];
249
292
  /** Returns whether a normalized command path owns a concrete core flag-contract row. Surface-less commands such as `help` intentionally return false, while positional virtual paths such as `workspace snapshot create` return true. */
250
293
  export declare function hasSubcommandFlagContractsForCommand(commandName:string|undefined):boolean;
294
+ /**
295
+ * Nested command paths with their own flag table: multi-word entries
296
+ * (`files lookup`, `workspace snapshot create`) and the extension and package
297
+ * lifecycle subcommands. Recovery uses them to name where a flag no top-level
298
+ * command declares is accepted (pm-9ke7h9).
299
+ */
300
+ export declare function listNestedSubcommandFlagContractPaths():string[];
251
301
  /** Resolves the flag contracts a given command (or list/extension subcommand) accepts, merged with the shared subcommand-global flags. Returns the global set for unknown or surface-less commands so completion and validation degrade gracefully. */
252
302
  export declare function resolveSubcommandFlagContractsForCommand(commandName:string|undefined):CliFlagContract[];
253
303
  /** Renders a space-separated, de-duplicated list of every flag spelling (short, canonical, and aliases) for shell-completion candidate generation, optionally appending the shared subcommand-global flags. */