@feiyoug/skill-lab 0.0.0 → 0.0.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 (465) hide show
  1. package/README.md +73 -0
  2. package/esm/analyzer/astgrep/client.d.ts +20 -8
  3. package/esm/analyzer/astgrep/client.d.ts.map +1 -1
  4. package/esm/analyzer/astgrep/client.js +58 -31
  5. package/esm/analyzer/config/default.d.ts +8 -0
  6. package/esm/analyzer/config/default.d.ts.map +1 -0
  7. package/esm/analyzer/config/default.js +91 -0
  8. package/esm/analyzer/config/helpers.d.ts +8 -0
  9. package/esm/analyzer/config/helpers.d.ts.map +1 -0
  10. package/esm/analyzer/config/helpers.js +72 -0
  11. package/esm/analyzer/config/mod.d.ts +4 -0
  12. package/esm/analyzer/config/mod.d.ts.map +1 -0
  13. package/esm/analyzer/config/mod.js +3 -0
  14. package/esm/analyzer/config/types.d.ts +58 -0
  15. package/esm/analyzer/config/types.d.ts.map +1 -0
  16. package/esm/analyzer/{config.js → config/types.js} +0 -28
  17. package/esm/analyzer/logging.d.ts +3 -0
  18. package/esm/analyzer/logging.d.ts.map +1 -0
  19. package/esm/analyzer/logging.js +6 -0
  20. package/esm/analyzer/mod.d.ts +12 -5
  21. package/esm/analyzer/mod.d.ts.map +1 -1
  22. package/esm/analyzer/mod.js +25 -12
  23. package/esm/analyzer/result.d.ts +35 -0
  24. package/esm/analyzer/result.d.ts.map +1 -0
  25. package/esm/analyzer/result.js +311 -0
  26. package/esm/analyzer/rules/bash/commands/mod.d.ts +1 -0
  27. package/esm/analyzer/rules/bash/commands/mod.d.ts.map +1 -1
  28. package/esm/analyzer/rules/bash/commands/mod.js +3 -0
  29. package/esm/analyzer/rules/bash/commands/pip.d.ts +3 -0
  30. package/esm/analyzer/rules/bash/commands/pip.d.ts.map +1 -0
  31. package/esm/analyzer/rules/bash/commands/pip.js +14 -0
  32. package/esm/analyzer/rules/bash/extractFileRefs.d.ts +1 -1
  33. package/esm/analyzer/rules/bash/extractFileRefs.d.ts.map +1 -1
  34. package/esm/analyzer/rules/bash/extractFileRefs.js +2 -2
  35. package/esm/analyzer/rules/bash/inline-command-classifier.d.ts +1 -1
  36. package/esm/analyzer/rules/bash/inline-command-classifier.d.ts.map +1 -1
  37. package/esm/analyzer/rules/bash/inline-command-classifier.js +4 -4
  38. package/esm/analyzer/rules/javascript/extractFileRefs.d.ts +3 -4
  39. package/esm/analyzer/rules/javascript/extractFileRefs.d.ts.map +1 -1
  40. package/esm/analyzer/rules/javascript/extractFileRefs.js +3 -4
  41. package/esm/analyzer/rules/markdown/extractCodeBlocks.d.ts.map +1 -1
  42. package/esm/analyzer/rules/markdown/extractCodeBlocks.js +6 -3
  43. package/esm/analyzer/rules/markdown/extractFileRefs.d.ts.map +1 -1
  44. package/esm/analyzer/rules/markdown/extractFileRefs.js +2 -0
  45. package/esm/analyzer/rules/python/extractFileRefs.d.ts +1 -1
  46. package/esm/analyzer/rules/python/extractFileRefs.d.ts.map +1 -1
  47. package/esm/analyzer/rules/python/extractFileRefs.js +2 -2
  48. package/esm/analyzer/steps/001-discovery/discover-files.d.ts +4 -0
  49. package/esm/analyzer/steps/001-discovery/discover-files.d.ts.map +1 -1
  50. package/esm/analyzer/steps/001-discovery/discover-files.js +18 -2
  51. package/esm/analyzer/steps/001-discovery/mod.d.ts.map +1 -1
  52. package/esm/analyzer/steps/001-discovery/mod.js +39 -9
  53. package/esm/analyzer/steps/002-permissions/mod.d.ts.map +1 -1
  54. package/esm/analyzer/steps/002-permissions/mod.js +156 -73
  55. package/esm/analyzer/steps/002-permissions/scan-file.d.ts +1 -1
  56. package/esm/analyzer/steps/002-permissions/scan-file.d.ts.map +1 -1
  57. package/esm/analyzer/steps/002-permissions/scan-file.js +40 -5
  58. package/esm/analyzer/steps/002-permissions/seed-frontmatter.js +2 -2
  59. package/esm/analyzer/steps/003-risks/dep-risks.d.ts +3 -0
  60. package/esm/analyzer/steps/003-risks/dep-risks.d.ts.map +1 -0
  61. package/esm/analyzer/steps/003-risks/dep-risks.js +74 -0
  62. package/esm/analyzer/steps/003-risks/helpers.d.ts +1 -0
  63. package/esm/analyzer/steps/003-risks/helpers.d.ts.map +1 -1
  64. package/esm/analyzer/steps/003-risks/helpers.js +1 -0
  65. package/esm/analyzer/steps/003-risks/mod.d.ts +3 -2
  66. package/esm/analyzer/steps/003-risks/mod.d.ts.map +1 -1
  67. package/esm/analyzer/steps/003-risks/mod.js +41 -4
  68. package/esm/analyzer/steps/003-risks/policy.d.ts +7 -0
  69. package/esm/analyzer/steps/003-risks/policy.d.ts.map +1 -0
  70. package/esm/analyzer/steps/003-risks/policy.js +23 -0
  71. package/esm/analyzer/steps/003-risks/rule-mapped.d.ts +2 -2
  72. package/esm/analyzer/steps/003-risks/rule-mapped.d.ts.map +1 -1
  73. package/esm/analyzer/steps/003-risks/rule-mapped.js +83 -2
  74. package/esm/analyzer/steps/003-risks/scoring.d.ts +9 -1
  75. package/esm/analyzer/steps/003-risks/scoring.d.ts.map +1 -1
  76. package/esm/analyzer/steps/003-risks/scoring.js +55 -42
  77. package/esm/analyzer/treesitter/client.d.ts +31 -0
  78. package/esm/analyzer/treesitter/client.d.ts.map +1 -0
  79. package/esm/analyzer/{treesiter → treesitter}/client.js +43 -39
  80. package/esm/analyzer/treesitter/registry.d.ts +73 -0
  81. package/esm/analyzer/treesitter/registry.d.ts.map +1 -0
  82. package/esm/analyzer/treesitter/registry.js +165 -0
  83. package/esm/analyzer/types.d.ts +14 -28
  84. package/esm/analyzer/types.d.ts.map +1 -1
  85. package/esm/deps/jsr.io/@deno-library/progress/1.5.1/deps.d.ts +3 -0
  86. package/esm/deps/jsr.io/@deno-library/progress/1.5.1/deps.d.ts.map +1 -0
  87. package/esm/deps/jsr.io/@deno-library/progress/1.5.1/deps.js +3 -0
  88. package/esm/deps/jsr.io/@deno-library/progress/1.5.1/mod.d.ts +93 -0
  89. package/esm/deps/jsr.io/@deno-library/progress/1.5.1/mod.d.ts.map +1 -0
  90. package/esm/deps/jsr.io/@deno-library/progress/1.5.1/mod.js +297 -0
  91. package/esm/deps/jsr.io/@deno-library/progress/1.5.1/multi.d.ts +84 -0
  92. package/esm/deps/jsr.io/@deno-library/progress/1.5.1/multi.d.ts.map +1 -0
  93. package/esm/deps/jsr.io/@deno-library/progress/1.5.1/multi.js +268 -0
  94. package/esm/deps/jsr.io/@deno-library/progress/1.5.1/time.d.ts +18 -0
  95. package/esm/deps/jsr.io/@deno-library/progress/1.5.1/time.d.ts.map +1 -0
  96. package/esm/deps/jsr.io/@deno-library/progress/1.5.1/time.js +45 -0
  97. package/esm/deps/jsr.io/@std/fmt/1.0.3/colors.d.ts +700 -0
  98. package/esm/deps/jsr.io/@std/fmt/1.0.3/colors.d.ts.map +1 -0
  99. package/esm/deps/jsr.io/@std/fmt/1.0.3/colors.js +903 -0
  100. package/esm/deps/jsr.io/@std/io/0.225.0/types.d.ts +146 -0
  101. package/esm/deps/jsr.io/@std/io/0.225.0/types.d.ts.map +1 -0
  102. package/esm/deps/jsr.io/@std/io/0.225.0/types.js +15 -0
  103. package/esm/deps/jsr.io/@std/io/0.225.0/write_all.d.ts +51 -0
  104. package/esm/deps/jsr.io/@std/io/0.225.0/write_all.d.ts.map +1 -0
  105. package/esm/deps/jsr.io/@std/io/0.225.0/write_all.js +61 -0
  106. package/esm/shared/deep_merge.d.ts +12 -0
  107. package/esm/shared/deep_merge.d.ts.map +1 -0
  108. package/esm/shared/deep_merge.js +49 -0
  109. package/esm/shared/mod.d.ts +1 -0
  110. package/esm/shared/mod.d.ts.map +1 -1
  111. package/esm/shared/mod.js +1 -0
  112. package/esm/shared/types/filetypes.d.ts +2 -2
  113. package/esm/shared/types/filetypes.d.ts.map +1 -1
  114. package/esm/shared/types/permissions.d.ts +1 -1
  115. package/esm/shared/types/permissions.d.ts.map +1 -1
  116. package/esm/shared/types/risks.d.ts +4 -1
  117. package/esm/shared/types/risks.d.ts.map +1 -1
  118. package/esm/skillreader/types.d.ts +2 -2
  119. package/esm/skillreader/types.d.ts.map +1 -1
  120. package/esm/skillreader/types.js +2 -2
  121. package/package.json +1 -1
  122. package/script/analyzer/astgrep/client.d.ts +20 -8
  123. package/script/analyzer/astgrep/client.d.ts.map +1 -1
  124. package/script/analyzer/astgrep/client.js +58 -64
  125. package/script/analyzer/config/default.d.ts +8 -0
  126. package/script/analyzer/config/default.d.ts.map +1 -0
  127. package/script/analyzer/config/default.js +94 -0
  128. package/script/analyzer/config/helpers.d.ts +8 -0
  129. package/script/analyzer/config/helpers.d.ts.map +1 -0
  130. package/script/analyzer/config/helpers.js +76 -0
  131. package/script/analyzer/config/mod.d.ts +4 -0
  132. package/script/analyzer/config/mod.d.ts.map +1 -0
  133. package/script/analyzer/config/mod.js +21 -0
  134. package/script/analyzer/config/types.d.ts +58 -0
  135. package/script/analyzer/config/types.d.ts.map +1 -0
  136. package/script/analyzer/{config.js → config/types.js} +1 -29
  137. package/script/analyzer/logging.d.ts +3 -0
  138. package/script/analyzer/logging.d.ts.map +1 -0
  139. package/script/analyzer/logging.js +9 -0
  140. package/script/analyzer/mod.d.ts +12 -5
  141. package/script/analyzer/mod.d.ts.map +1 -1
  142. package/script/analyzer/mod.js +35 -20
  143. package/script/analyzer/result.d.ts +35 -0
  144. package/script/analyzer/result.d.ts.map +1 -0
  145. package/script/analyzer/result.js +315 -0
  146. package/script/analyzer/rules/bash/commands/mod.d.ts +1 -0
  147. package/script/analyzer/rules/bash/commands/mod.d.ts.map +1 -1
  148. package/script/analyzer/rules/bash/commands/mod.js +3 -0
  149. package/script/analyzer/rules/bash/commands/pip.d.ts +3 -0
  150. package/script/analyzer/rules/bash/commands/pip.d.ts.map +1 -0
  151. package/script/analyzer/rules/bash/commands/pip.js +17 -0
  152. package/script/analyzer/rules/bash/extractFileRefs.d.ts +1 -1
  153. package/script/analyzer/rules/bash/extractFileRefs.d.ts.map +1 -1
  154. package/script/analyzer/rules/bash/extractFileRefs.js +2 -2
  155. package/script/analyzer/rules/bash/inline-command-classifier.d.ts +1 -1
  156. package/script/analyzer/rules/bash/inline-command-classifier.d.ts.map +1 -1
  157. package/script/analyzer/rules/bash/inline-command-classifier.js +4 -4
  158. package/script/analyzer/rules/javascript/extractFileRefs.d.ts +3 -4
  159. package/script/analyzer/rules/javascript/extractFileRefs.d.ts.map +1 -1
  160. package/script/analyzer/rules/javascript/extractFileRefs.js +3 -4
  161. package/script/analyzer/rules/markdown/extractCodeBlocks.d.ts.map +1 -1
  162. package/script/analyzer/rules/markdown/extractCodeBlocks.js +6 -3
  163. package/script/analyzer/rules/markdown/extractFileRefs.d.ts.map +1 -1
  164. package/script/analyzer/rules/markdown/extractFileRefs.js +2 -0
  165. package/script/analyzer/rules/python/extractFileRefs.d.ts +1 -1
  166. package/script/analyzer/rules/python/extractFileRefs.d.ts.map +1 -1
  167. package/script/analyzer/rules/python/extractFileRefs.js +2 -2
  168. package/script/analyzer/steps/001-discovery/discover-files.d.ts +4 -0
  169. package/script/analyzer/steps/001-discovery/discover-files.d.ts.map +1 -1
  170. package/script/analyzer/steps/001-discovery/discover-files.js +18 -2
  171. package/script/analyzer/steps/001-discovery/mod.d.ts.map +1 -1
  172. package/script/analyzer/steps/001-discovery/mod.js +77 -11
  173. package/script/analyzer/steps/002-permissions/mod.d.ts.map +1 -1
  174. package/script/analyzer/steps/002-permissions/mod.js +194 -75
  175. package/script/analyzer/steps/002-permissions/scan-file.d.ts +1 -1
  176. package/script/analyzer/steps/002-permissions/scan-file.d.ts.map +1 -1
  177. package/script/analyzer/steps/002-permissions/scan-file.js +40 -5
  178. package/script/analyzer/steps/002-permissions/seed-frontmatter.js +3 -3
  179. package/script/analyzer/steps/003-risks/dep-risks.d.ts +3 -0
  180. package/script/analyzer/steps/003-risks/dep-risks.d.ts.map +1 -0
  181. package/script/analyzer/steps/003-risks/dep-risks.js +77 -0
  182. package/script/analyzer/steps/003-risks/helpers.d.ts +1 -0
  183. package/script/analyzer/steps/003-risks/helpers.d.ts.map +1 -1
  184. package/script/analyzer/steps/003-risks/helpers.js +1 -0
  185. package/script/analyzer/steps/003-risks/mod.d.ts +3 -2
  186. package/script/analyzer/steps/003-risks/mod.d.ts.map +1 -1
  187. package/script/analyzer/steps/003-risks/mod.js +77 -4
  188. package/script/analyzer/steps/003-risks/policy.d.ts +7 -0
  189. package/script/analyzer/steps/003-risks/policy.d.ts.map +1 -0
  190. package/script/analyzer/steps/003-risks/policy.js +29 -0
  191. package/script/analyzer/steps/003-risks/rule-mapped.d.ts +2 -2
  192. package/script/analyzer/steps/003-risks/rule-mapped.d.ts.map +1 -1
  193. package/script/analyzer/steps/003-risks/rule-mapped.js +83 -2
  194. package/script/analyzer/steps/003-risks/scoring.d.ts +9 -1
  195. package/script/analyzer/steps/003-risks/scoring.d.ts.map +1 -1
  196. package/script/analyzer/steps/003-risks/scoring.js +55 -42
  197. package/script/analyzer/treesitter/client.d.ts +31 -0
  198. package/script/analyzer/treesitter/client.d.ts.map +1 -0
  199. package/script/analyzer/treesitter/client.js +136 -0
  200. package/script/analyzer/treesitter/registry.d.ts +73 -0
  201. package/script/analyzer/treesitter/registry.d.ts.map +1 -0
  202. package/script/analyzer/treesitter/registry.js +206 -0
  203. package/script/analyzer/types.d.ts +14 -28
  204. package/script/analyzer/types.d.ts.map +1 -1
  205. package/script/deps/jsr.io/@deno-library/progress/1.5.1/deps.d.ts +3 -0
  206. package/script/deps/jsr.io/@deno-library/progress/1.5.1/deps.d.ts.map +1 -0
  207. package/script/deps/jsr.io/@deno-library/progress/1.5.1/deps.js +10 -0
  208. package/script/deps/jsr.io/@deno-library/progress/1.5.1/mod.d.ts +93 -0
  209. package/script/deps/jsr.io/@deno-library/progress/1.5.1/mod.d.ts.map +1 -0
  210. package/script/deps/jsr.io/@deno-library/progress/1.5.1/mod.js +334 -0
  211. package/script/deps/jsr.io/@deno-library/progress/1.5.1/multi.d.ts +84 -0
  212. package/script/deps/jsr.io/@deno-library/progress/1.5.1/multi.d.ts.map +1 -0
  213. package/script/deps/jsr.io/@deno-library/progress/1.5.1/multi.js +305 -0
  214. package/script/deps/jsr.io/@deno-library/progress/1.5.1/time.d.ts +18 -0
  215. package/script/deps/jsr.io/@deno-library/progress/1.5.1/time.d.ts.map +1 -0
  216. package/script/deps/jsr.io/@deno-library/progress/1.5.1/time.js +48 -0
  217. package/script/deps/jsr.io/@std/fmt/1.0.3/colors.d.ts +700 -0
  218. package/script/deps/jsr.io/@std/fmt/1.0.3/colors.d.ts.map +1 -0
  219. package/script/deps/jsr.io/@std/fmt/1.0.3/colors.js +986 -0
  220. package/script/deps/jsr.io/@std/io/0.225.0/types.d.ts +146 -0
  221. package/script/deps/jsr.io/@std/io/0.225.0/types.d.ts.map +1 -0
  222. package/script/deps/jsr.io/@std/io/0.225.0/types.js +18 -0
  223. package/script/deps/jsr.io/@std/io/0.225.0/write_all.d.ts +51 -0
  224. package/script/deps/jsr.io/@std/io/0.225.0/write_all.d.ts.map +1 -0
  225. package/script/deps/jsr.io/@std/io/0.225.0/write_all.js +65 -0
  226. package/script/shared/deep_merge.d.ts +12 -0
  227. package/script/shared/deep_merge.d.ts.map +1 -0
  228. package/script/shared/deep_merge.js +53 -0
  229. package/script/shared/mod.d.ts +1 -0
  230. package/script/shared/mod.d.ts.map +1 -1
  231. package/script/shared/mod.js +1 -0
  232. package/script/shared/types/filetypes.d.ts +2 -2
  233. package/script/shared/types/filetypes.d.ts.map +1 -1
  234. package/script/shared/types/permissions.d.ts +1 -1
  235. package/script/shared/types/permissions.d.ts.map +1 -1
  236. package/script/shared/types/risks.d.ts +4 -1
  237. package/script/shared/types/risks.d.ts.map +1 -1
  238. package/script/skillreader/types.d.ts +2 -2
  239. package/script/skillreader/types.d.ts.map +1 -1
  240. package/script/skillreader/types.js +2 -2
  241. package/src/_dnt.polyfills.ts +27 -0
  242. package/src/_dnt.shims.ts +64 -0
  243. package/src/analyzer/astgrep/client.ts +184 -0
  244. package/src/analyzer/astgrep/mod.ts +2 -0
  245. package/src/analyzer/config/default.ts +98 -0
  246. package/src/analyzer/config/helpers.ts +107 -0
  247. package/src/analyzer/config/mod.ts +3 -0
  248. package/src/analyzer/config/types.ts +103 -0
  249. package/src/analyzer/logging.ts +8 -0
  250. package/src/analyzer/mod.ts +118 -0
  251. package/src/analyzer/result.ts +393 -0
  252. package/src/analyzer/rules/bash/astTypes.ts +5 -0
  253. package/src/analyzer/rules/bash/commands/bd.ts +23 -0
  254. package/src/analyzer/rules/bash/commands/cron.ts +21 -0
  255. package/src/analyzer/rules/bash/commands/docker.ts +37 -0
  256. package/src/analyzer/rules/bash/commands/eval.ts +52 -0
  257. package/src/analyzer/rules/bash/commands/generic.ts +16 -0
  258. package/src/analyzer/rules/bash/commands/gh.ts +21 -0
  259. package/src/analyzer/rules/bash/commands/git.ts +28 -0
  260. package/src/analyzer/rules/bash/commands/mod.ts +38 -0
  261. package/src/analyzer/rules/bash/commands/node.ts +64 -0
  262. package/src/analyzer/rules/bash/commands/openspec.ts +16 -0
  263. package/src/analyzer/rules/bash/commands/pip.ts +16 -0
  264. package/src/analyzer/rules/bash/commands/sudo.ts +21 -0
  265. package/src/analyzer/rules/bash/destructive.ts +28 -0
  266. package/src/analyzer/rules/bash/extractFileRefs.ts +101 -0
  267. package/src/analyzer/rules/bash/filesystem.ts +50 -0
  268. package/src/analyzer/rules/bash/injection.ts +21 -0
  269. package/src/analyzer/rules/bash/inline-command-classifier.ts +94 -0
  270. package/src/analyzer/rules/bash/mod.ts +23 -0
  271. package/src/analyzer/rules/bash/network.ts +64 -0
  272. package/src/analyzer/rules/bash/secret-detection.ts +43 -0
  273. package/src/analyzer/rules/javascript/astTypes.ts +8 -0
  274. package/src/analyzer/rules/javascript/extractFileRefs.ts +131 -0
  275. package/src/analyzer/rules/javascript/filesystem.ts +28 -0
  276. package/src/analyzer/rules/javascript/injection.ts +21 -0
  277. package/src/analyzer/rules/javascript/mod.ts +26 -0
  278. package/src/analyzer/rules/javascript/network.ts +27 -0
  279. package/src/analyzer/rules/javascript/secret-detection.ts +68 -0
  280. package/src/analyzer/rules/javascript/subprocess.ts +16 -0
  281. package/src/analyzer/rules/markdown/astTypes.ts +35 -0
  282. package/src/analyzer/rules/markdown/extractCodeBlocks.ts +101 -0
  283. package/src/analyzer/rules/markdown/extractFileRefs.ts +179 -0
  284. package/src/analyzer/rules/markdown/mod.ts +12 -0
  285. package/src/analyzer/rules/mod.ts +77 -0
  286. package/src/analyzer/rules/python/astTypes.ts +9 -0
  287. package/src/analyzer/rules/python/extractFileRefs.ts +92 -0
  288. package/src/analyzer/rules/python/mod.ts +15 -0
  289. package/src/analyzer/rules/python/network.ts +26 -0
  290. package/src/analyzer/rules/python/secret-detection.ts +30 -0
  291. package/src/analyzer/rules/shared/file-refs.ts +38 -0
  292. package/src/analyzer/rules/shared/network-evaluators.ts +107 -0
  293. package/src/analyzer/rules/shared/prompt-injection.ts +48 -0
  294. package/src/analyzer/rules/shared/secret-evaluators.ts +13 -0
  295. package/src/analyzer/rules/text/mod.ts +12 -0
  296. package/src/analyzer/rules/typescript/mod.ts +7 -0
  297. package/src/analyzer/steps/001-discovery/discover-files.ts +211 -0
  298. package/src/analyzer/steps/001-discovery/filter-files.ts +72 -0
  299. package/src/analyzer/steps/001-discovery/mod.ts +103 -0
  300. package/src/analyzer/steps/002-permissions/mod.ts +329 -0
  301. package/src/analyzer/steps/002-permissions/scan-file.ts +258 -0
  302. package/src/analyzer/steps/002-permissions/seed-frontmatter.ts +66 -0
  303. package/src/analyzer/steps/002-permissions/synthesize.ts +42 -0
  304. package/src/analyzer/steps/003-risks/dep-risks.ts +89 -0
  305. package/src/analyzer/steps/003-risks/helpers.ts +41 -0
  306. package/src/analyzer/steps/003-risks/mod.ts +86 -0
  307. package/src/analyzer/steps/003-risks/policy.ts +38 -0
  308. package/src/analyzer/steps/003-risks/rule-mapped.ts +206 -0
  309. package/src/analyzer/steps/003-risks/scoring.ts +117 -0
  310. package/src/analyzer/steps/mod.ts +3 -0
  311. package/src/analyzer/treesitter/client.ts +120 -0
  312. package/src/analyzer/treesitter/registry.ts +198 -0
  313. package/src/analyzer/types.ts +78 -0
  314. package/src/analyzer/utils/code-block-path.ts +33 -0
  315. package/src/analyzer/utils/id-generator.ts +59 -0
  316. package/src/analyzer/utils/secret-validator.ts +29 -0
  317. package/src/analyzer/utils/url-parser.ts +25 -0
  318. package/src/deps/jsr.io/@deno-library/progress/1.5.1/deps.ts +3 -0
  319. package/src/deps/jsr.io/@deno-library/progress/1.5.1/mod.ts +265 -0
  320. package/src/deps/jsr.io/@deno-library/progress/1.5.1/multi.ts +250 -0
  321. package/src/deps/jsr.io/@deno-library/progress/1.5.1/time.ts +69 -0
  322. package/src/deps/jsr.io/@std/fmt/1.0.3/colors.ts +1004 -0
  323. package/src/deps/jsr.io/@std/internal/1.0.12/_os.ts +15 -0
  324. package/src/deps/jsr.io/@std/internal/1.0.12/os.ts +7 -0
  325. package/src/deps/jsr.io/@std/io/0.225.0/types.ts +157 -0
  326. package/src/deps/jsr.io/@std/io/0.225.0/write_all.ts +65 -0
  327. package/src/deps/jsr.io/@std/path/1.1.4/_common/assert_path.ts +10 -0
  328. package/src/deps/jsr.io/@std/path/1.1.4/_common/basename.ts +53 -0
  329. package/src/deps/jsr.io/@std/path/1.1.4/_common/common.ts +26 -0
  330. package/src/deps/jsr.io/@std/path/1.1.4/_common/constants.ts +49 -0
  331. package/src/deps/jsr.io/@std/path/1.1.4/_common/dirname.ts +9 -0
  332. package/src/deps/jsr.io/@std/path/1.1.4/_common/format.ts +25 -0
  333. package/src/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.ts +12 -0
  334. package/src/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.ts +295 -0
  335. package/src/deps/jsr.io/@std/path/1.1.4/_common/normalize.ts +9 -0
  336. package/src/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.ts +74 -0
  337. package/src/deps/jsr.io/@std/path/1.1.4/_common/relative.ts +10 -0
  338. package/src/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.ts +25 -0
  339. package/src/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.ts +17 -0
  340. package/src/deps/jsr.io/@std/path/1.1.4/basename.ts +37 -0
  341. package/src/deps/jsr.io/@std/path/1.1.4/common.ts +35 -0
  342. package/src/deps/jsr.io/@std/path/1.1.4/constants.ts +18 -0
  343. package/src/deps/jsr.io/@std/path/1.1.4/dirname.ts +30 -0
  344. package/src/deps/jsr.io/@std/path/1.1.4/extname.ts +29 -0
  345. package/src/deps/jsr.io/@std/path/1.1.4/format.ts +30 -0
  346. package/src/deps/jsr.io/@std/path/1.1.4/from_file_url.ts +30 -0
  347. package/src/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.ts +94 -0
  348. package/src/deps/jsr.io/@std/path/1.1.4/is_absolute.ts +30 -0
  349. package/src/deps/jsr.io/@std/path/1.1.4/is_glob.ts +49 -0
  350. package/src/deps/jsr.io/@std/path/1.1.4/join.ts +31 -0
  351. package/src/deps/jsr.io/@std/path/1.1.4/join_globs.ts +42 -0
  352. package/src/deps/jsr.io/@std/path/1.1.4/mod.ts +217 -0
  353. package/src/deps/jsr.io/@std/path/1.1.4/normalize.ts +33 -0
  354. package/src/deps/jsr.io/@std/path/1.1.4/normalize_glob.ts +45 -0
  355. package/src/deps/jsr.io/@std/path/1.1.4/parse.ts +44 -0
  356. package/src/deps/jsr.io/@std/path/1.1.4/posix/_util.ts +10 -0
  357. package/src/deps/jsr.io/@std/path/1.1.4/posix/basename.ts +62 -0
  358. package/src/deps/jsr.io/@std/path/1.1.4/posix/constants.ts +15 -0
  359. package/src/deps/jsr.io/@std/path/1.1.4/posix/dirname.ts +72 -0
  360. package/src/deps/jsr.io/@std/path/1.1.4/posix/extname.ts +96 -0
  361. package/src/deps/jsr.io/@std/path/1.1.4/posix/format.ts +31 -0
  362. package/src/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.ts +25 -0
  363. package/src/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.ts +94 -0
  364. package/src/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.ts +25 -0
  365. package/src/deps/jsr.io/@std/path/1.1.4/posix/join.ts +46 -0
  366. package/src/deps/jsr.io/@std/path/1.1.4/posix/join_globs.ts +45 -0
  367. package/src/deps/jsr.io/@std/path/1.1.4/posix/normalize.ts +63 -0
  368. package/src/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.ts +43 -0
  369. package/src/deps/jsr.io/@std/path/1.1.4/posix/parse.ts +121 -0
  370. package/src/deps/jsr.io/@std/path/1.1.4/posix/relative.ts +103 -0
  371. package/src/deps/jsr.io/@std/path/1.1.4/posix/resolve.ts +71 -0
  372. package/src/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.ts +32 -0
  373. package/src/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.ts +21 -0
  374. package/src/deps/jsr.io/@std/path/1.1.4/relative.ts +32 -0
  375. package/src/deps/jsr.io/@std/path/1.1.4/resolve.ts +32 -0
  376. package/src/deps/jsr.io/@std/path/1.1.4/to_file_url.ts +30 -0
  377. package/src/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.ts +31 -0
  378. package/src/deps/jsr.io/@std/path/1.1.4/types.ts +40 -0
  379. package/src/deps/jsr.io/@std/path/1.1.4/windows/_util.ts +28 -0
  380. package/src/deps/jsr.io/@std/path/1.1.4/windows/basename.ts +54 -0
  381. package/src/deps/jsr.io/@std/path/1.1.4/windows/constants.ts +15 -0
  382. package/src/deps/jsr.io/@std/path/1.1.4/windows/dirname.ts +118 -0
  383. package/src/deps/jsr.io/@std/path/1.1.4/windows/extname.ts +90 -0
  384. package/src/deps/jsr.io/@std/path/1.1.4/windows/format.ts +31 -0
  385. package/src/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.ts +34 -0
  386. package/src/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.ts +92 -0
  387. package/src/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.ts +40 -0
  388. package/src/deps/jsr.io/@std/path/1.1.4/windows/join.ts +78 -0
  389. package/src/deps/jsr.io/@std/path/1.1.4/windows/join_globs.ts +46 -0
  390. package/src/deps/jsr.io/@std/path/1.1.4/windows/normalize.ts +136 -0
  391. package/src/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.ts +43 -0
  392. package/src/deps/jsr.io/@std/path/1.1.4/windows/parse.ts +184 -0
  393. package/src/deps/jsr.io/@std/path/1.1.4/windows/relative.ts +128 -0
  394. package/src/deps/jsr.io/@std/path/1.1.4/windows/resolve.ts +178 -0
  395. package/src/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.ts +38 -0
  396. package/src/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.ts +60 -0
  397. package/src/deps/jsr.io/@std/yaml/1.0.11/_chars.ts +55 -0
  398. package/src/deps/jsr.io/@std/yaml/1.0.11/_dumper_state.ts +841 -0
  399. package/src/deps/jsr.io/@std/yaml/1.0.11/_loader_state.ts +1780 -0
  400. package/src/deps/jsr.io/@std/yaml/1.0.11/_schema.ts +183 -0
  401. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/binary.ts +127 -0
  402. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/bool.ts +37 -0
  403. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/float.ts +112 -0
  404. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/int.ts +174 -0
  405. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/map.ts +17 -0
  406. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/merge.ts +13 -0
  407. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/nil.ts +27 -0
  408. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/omap.ts +30 -0
  409. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/pairs.ts +22 -0
  410. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/regexp.ts +33 -0
  411. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/seq.ts +13 -0
  412. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/set.ts +17 -0
  413. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/str.ts +12 -0
  414. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/timestamp.ts +101 -0
  415. package/src/deps/jsr.io/@std/yaml/1.0.11/_type/undefined.ts +23 -0
  416. package/src/deps/jsr.io/@std/yaml/1.0.11/_type.ts +49 -0
  417. package/src/deps/jsr.io/@std/yaml/1.0.11/_utils.ts +16 -0
  418. package/src/deps/jsr.io/@std/yaml/1.0.11/mod.ts +54 -0
  419. package/src/deps/jsr.io/@std/yaml/1.0.11/parse.ts +128 -0
  420. package/src/deps/jsr.io/@std/yaml/1.0.11/stringify.ts +118 -0
  421. package/src/shared/deep_merge.ts +73 -0
  422. package/src/shared/mod.ts +2 -0
  423. package/src/shared/types/filetypes.ts +101 -0
  424. package/src/shared/types/findings.ts +7 -0
  425. package/src/shared/types/mod.ts +6 -0
  426. package/src/shared/types/permissions.ts +17 -0
  427. package/src/shared/types/references.ts +62 -0
  428. package/src/shared/types/risks.ts +72 -0
  429. package/src/shared/types/syntaxNode.ts +7 -0
  430. package/src/skillreader/cloudStorage/mod.ts +170 -0
  431. package/src/skillreader/factory.ts +71 -0
  432. package/src/skillreader/fs/git.ts +153 -0
  433. package/src/skillreader/fs/mod.ts +84 -0
  434. package/src/skillreader/github/base.ts +162 -0
  435. package/src/skillreader/github/githubApi.ts +40 -0
  436. package/src/skillreader/github/githubRaw.ts +24 -0
  437. package/src/skillreader/github/mod.ts +45 -0
  438. package/src/skillreader/github/utils.ts +40 -0
  439. package/src/skillreader/manifest.ts +67 -0
  440. package/src/skillreader/mod.ts +26 -0
  441. package/src/skillreader/types.ts +150 -0
  442. package/src/skillreader/utils/frontmatter-parser.ts +72 -0
  443. package/src/skillreader/utils/http-range.ts +38 -0
  444. package/src/skillreader/utils/mod.ts +12 -0
  445. package/esm/analyzer/astgrep/registry.d.ts +0 -18
  446. package/esm/analyzer/astgrep/registry.d.ts.map +0 -1
  447. package/esm/analyzer/astgrep/registry.js +0 -71
  448. package/esm/analyzer/config.d.ts +0 -27
  449. package/esm/analyzer/config.d.ts.map +0 -1
  450. package/esm/analyzer/steps/003-risks/output.d.ts +0 -3
  451. package/esm/analyzer/steps/003-risks/output.d.ts.map +0 -1
  452. package/esm/analyzer/steps/003-risks/output.js +0 -16
  453. package/esm/analyzer/treesiter/client.d.ts +0 -26
  454. package/esm/analyzer/treesiter/client.d.ts.map +0 -1
  455. package/script/analyzer/astgrep/registry.d.ts +0 -18
  456. package/script/analyzer/astgrep/registry.d.ts.map +0 -1
  457. package/script/analyzer/astgrep/registry.js +0 -109
  458. package/script/analyzer/config.d.ts +0 -27
  459. package/script/analyzer/config.d.ts.map +0 -1
  460. package/script/analyzer/steps/003-risks/output.d.ts +0 -3
  461. package/script/analyzer/steps/003-risks/output.d.ts.map +0 -1
  462. package/script/analyzer/steps/003-risks/output.js +0 -19
  463. package/script/analyzer/treesiter/client.d.ts +0 -26
  464. package/script/analyzer/treesiter/client.d.ts.map +0 -1
  465. package/script/analyzer/treesiter/client.js +0 -165
@@ -0,0 +1,986 @@
1
+ "use strict";
2
+ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
3
+ // This module is browser compatible.
4
+ // A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors
5
+ // on npm.
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.setColorEnabled = setColorEnabled;
41
+ exports.getColorEnabled = getColorEnabled;
42
+ exports.reset = reset;
43
+ exports.bold = bold;
44
+ exports.dim = dim;
45
+ exports.italic = italic;
46
+ exports.underline = underline;
47
+ exports.inverse = inverse;
48
+ exports.hidden = hidden;
49
+ exports.strikethrough = strikethrough;
50
+ exports.black = black;
51
+ exports.red = red;
52
+ exports.green = green;
53
+ exports.yellow = yellow;
54
+ exports.blue = blue;
55
+ exports.magenta = magenta;
56
+ exports.cyan = cyan;
57
+ exports.white = white;
58
+ exports.gray = gray;
59
+ exports.brightBlack = brightBlack;
60
+ exports.brightRed = brightRed;
61
+ exports.brightGreen = brightGreen;
62
+ exports.brightYellow = brightYellow;
63
+ exports.brightBlue = brightBlue;
64
+ exports.brightMagenta = brightMagenta;
65
+ exports.brightCyan = brightCyan;
66
+ exports.brightWhite = brightWhite;
67
+ exports.bgBlack = bgBlack;
68
+ exports.bgRed = bgRed;
69
+ exports.bgGreen = bgGreen;
70
+ exports.bgYellow = bgYellow;
71
+ exports.bgBlue = bgBlue;
72
+ exports.bgMagenta = bgMagenta;
73
+ exports.bgCyan = bgCyan;
74
+ exports.bgWhite = bgWhite;
75
+ exports.bgBrightBlack = bgBrightBlack;
76
+ exports.bgBrightRed = bgBrightRed;
77
+ exports.bgBrightGreen = bgBrightGreen;
78
+ exports.bgBrightYellow = bgBrightYellow;
79
+ exports.bgBrightBlue = bgBrightBlue;
80
+ exports.bgBrightMagenta = bgBrightMagenta;
81
+ exports.bgBrightCyan = bgBrightCyan;
82
+ exports.bgBrightWhite = bgBrightWhite;
83
+ exports.rgb8 = rgb8;
84
+ exports.bgRgb8 = bgRgb8;
85
+ exports.rgb24 = rgb24;
86
+ exports.bgRgb24 = bgRgb24;
87
+ exports.stripAnsiCode = stripAnsiCode;
88
+ /**
89
+ * String formatters and utilities for dealing with ANSI color codes.
90
+ *
91
+ * > [!IMPORTANT]
92
+ * > If printing directly to the console, it's recommended to style console
93
+ * > output using CSS (guide
94
+ * > {@linkcode https://developer.mozilla.org/en-US/docs/Web/API/console#styling_console_output | here}).
95
+ *
96
+ * This module supports `NO_COLOR` environmental variable disabling any coloring
97
+ * if `NO_COLOR` is set.
98
+ *
99
+ * ```ts no-assert
100
+ * import {
101
+ * bgBlue,
102
+ * bgRgb24,
103
+ * bgRgb8,
104
+ * bold,
105
+ * italic,
106
+ * red,
107
+ * rgb24,
108
+ * rgb8,
109
+ * } from "@std/fmt/colors";
110
+ *
111
+ * console.log(bgBlue(italic(red(bold("Hello, World!")))));
112
+ *
113
+ * // also supports 8bit colors
114
+ *
115
+ * console.log(rgb8("Hello, World!", 42));
116
+ *
117
+ * console.log(bgRgb8("Hello, World!", 42));
118
+ *
119
+ * // and 24bit rgb
120
+ *
121
+ * console.log(rgb24("Hello, World!", {
122
+ * r: 41,
123
+ * g: 42,
124
+ * b: 43,
125
+ * }));
126
+ *
127
+ * console.log(bgRgb24("Hello, World!", {
128
+ * r: 41,
129
+ * g: 42,
130
+ * b: 43,
131
+ * }));
132
+ * ```
133
+ *
134
+ * @module
135
+ */
136
+ // deno-lint-ignore no-explicit-any
137
+ const dntShim = __importStar(require("../../../../../_dnt.shims.js"));
138
+ const { Deno } = dntShim.dntGlobalThis;
139
+ const noColor = typeof Deno?.noColor === "boolean"
140
+ ? Deno.noColor
141
+ : false;
142
+ let enabled = !noColor;
143
+ /**
144
+ * Enable or disable text color when styling.
145
+ *
146
+ * `@std/fmt/colors` automatically detects NO_COLOR environmental variable
147
+ * and disables text color. Use this API only when the automatic detection
148
+ * doesn't work.
149
+ *
150
+ * @example Usage
151
+ * ```ts no-assert
152
+ * import { setColorEnabled } from "@std/fmt/colors";
153
+ *
154
+ * // Disable text color
155
+ * setColorEnabled(false);
156
+ *
157
+ * // Enable text color
158
+ * setColorEnabled(true);
159
+ * ```
160
+ *
161
+ * @param value The boolean value to enable or disable text color
162
+ */
163
+ function setColorEnabled(value) {
164
+ if (Deno?.noColor) {
165
+ return;
166
+ }
167
+ enabled = value;
168
+ }
169
+ /**
170
+ * Get whether text color change is enabled or disabled.
171
+ *
172
+ * @example Usage
173
+ * ```ts no-assert
174
+ * import { getColorEnabled } from "@std/fmt/colors";
175
+ *
176
+ * console.log(getColorEnabled()); // true if enabled, false if disabled
177
+ * ```
178
+ * @returns `true` if text color is enabled, `false` otherwise
179
+ */
180
+ function getColorEnabled() {
181
+ return enabled;
182
+ }
183
+ /**
184
+ * Builds color code
185
+ * @param open
186
+ * @param close
187
+ */
188
+ function code(open, close) {
189
+ return {
190
+ open: `\x1b[${open.join(";")}m`,
191
+ close: `\x1b[${close}m`,
192
+ regexp: new RegExp(`\\x1b\\[${close}m`, "g"),
193
+ };
194
+ }
195
+ /**
196
+ * Applies color and background based on color code and its associated text
197
+ * @param str The text to apply color settings to
198
+ * @param code The color code to apply
199
+ */
200
+ function run(str, code) {
201
+ return enabled
202
+ ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}`
203
+ : str;
204
+ }
205
+ /**
206
+ * Reset the text modified.
207
+ *
208
+ * @example Usage
209
+ * ```ts no-assert
210
+ * import { reset } from "@std/fmt/colors";
211
+ *
212
+ * console.log(reset("Hello, world!"));
213
+ * ```
214
+ *
215
+ * @param str The text to reset
216
+ * @returns The text with reset color
217
+ */
218
+ function reset(str) {
219
+ return run(str, code([0], 0));
220
+ }
221
+ /**
222
+ * Make the text bold.
223
+ *
224
+ * @example Usage
225
+ * ```ts no-assert
226
+ * import { bold } from "@std/fmt/colors";
227
+ *
228
+ * console.log(bold("Hello, world!"));
229
+ * ```
230
+ *
231
+ * @param str The text to make bold
232
+ * @returns The bold text
233
+ */
234
+ function bold(str) {
235
+ return run(str, code([1], 22));
236
+ }
237
+ /**
238
+ * The text emits only a small amount of light.
239
+ *
240
+ * @example Usage
241
+ * ```ts no-assert
242
+ * import { dim } from "@std/fmt/colors";
243
+ *
244
+ * console.log(dim("Hello, world!"));
245
+ * ```
246
+ *
247
+ * @param str The text to dim
248
+ * @returns The dimmed text
249
+ *
250
+ * Warning: Not all terminal emulators support `dim`.
251
+ * For compatibility across all terminals, use {@linkcode gray} or {@linkcode brightBlack} instead.
252
+ */
253
+ function dim(str) {
254
+ return run(str, code([2], 22));
255
+ }
256
+ /**
257
+ * Make the text italic.
258
+ *
259
+ * @example Usage
260
+ * ```ts no-assert
261
+ * import { italic } from "@std/fmt/colors";
262
+ *
263
+ * console.log(italic("Hello, world!"));
264
+ * ```
265
+ *
266
+ * @param str The text to make italic
267
+ * @returns The italic text
268
+ */
269
+ function italic(str) {
270
+ return run(str, code([3], 23));
271
+ }
272
+ /**
273
+ * Make the text underline.
274
+ *
275
+ * @example Usage
276
+ * ```ts no-assert
277
+ * import { underline } from "@std/fmt/colors";
278
+ *
279
+ * console.log(underline("Hello, world!"));
280
+ * ```
281
+ *
282
+ * @param str The text to underline
283
+ * @returns The underlined text
284
+ */
285
+ function underline(str) {
286
+ return run(str, code([4], 24));
287
+ }
288
+ /**
289
+ * Invert background color and text color.
290
+ *
291
+ * @example Usage
292
+ * ```ts no-assert
293
+ * import { inverse } from "@std/fmt/colors";
294
+ *
295
+ * console.log(inverse("Hello, world!"));
296
+ * ```
297
+ *
298
+ * @param str The text to invert its color
299
+ * @returns The inverted text
300
+ */
301
+ function inverse(str) {
302
+ return run(str, code([7], 27));
303
+ }
304
+ /**
305
+ * Make the text hidden.
306
+ *
307
+ * @example Usage
308
+ * ```ts no-assert
309
+ * import { hidden } from "@std/fmt/colors";
310
+ *
311
+ * console.log(hidden("Hello, world!"));
312
+ * ```
313
+ *
314
+ * @param str The text to hide
315
+ * @returns The hidden text
316
+ */
317
+ function hidden(str) {
318
+ return run(str, code([8], 28));
319
+ }
320
+ /**
321
+ * Put horizontal line through the center of the text.
322
+ *
323
+ * @example Usage
324
+ * ```ts no-assert
325
+ * import { strikethrough } from "@std/fmt/colors";
326
+ *
327
+ * console.log(strikethrough("Hello, world!"));
328
+ * ```
329
+ *
330
+ * @param str The text to strike through
331
+ * @returns The text with horizontal line through the center
332
+ */
333
+ function strikethrough(str) {
334
+ return run(str, code([9], 29));
335
+ }
336
+ /**
337
+ * Set text color to black.
338
+ *
339
+ * @example Usage
340
+ * ```ts no-assert
341
+ * import { black } from "@std/fmt/colors";
342
+ *
343
+ * console.log(black("Hello, world!"));
344
+ * ```
345
+ *
346
+ * @param str The text to make black
347
+ * @returns The black text
348
+ */
349
+ function black(str) {
350
+ return run(str, code([30], 39));
351
+ }
352
+ /**
353
+ * Set text color to red.
354
+ *
355
+ * @example Usage
356
+ * ```ts no-assert
357
+ * import { red } from "@std/fmt/colors";
358
+ *
359
+ * console.log(red("Hello, world!"));
360
+ * ```
361
+ *
362
+ * @param str The text to make red
363
+ * @returns The red text
364
+ */
365
+ function red(str) {
366
+ return run(str, code([31], 39));
367
+ }
368
+ /**
369
+ * Set text color to green.
370
+ *
371
+ * @example Usage
372
+ * ```ts no-assert
373
+ * import { green } from "@std/fmt/colors";
374
+ *
375
+ * console.log(green("Hello, world!"));
376
+ * ```
377
+ *
378
+ * @param str The text to make green
379
+ * @returns The green text
380
+ */
381
+ function green(str) {
382
+ return run(str, code([32], 39));
383
+ }
384
+ /**
385
+ * Set text color to yellow.
386
+ *
387
+ * @example Usage
388
+ * ```ts no-assert
389
+ * import { yellow } from "@std/fmt/colors";
390
+ *
391
+ * console.log(yellow("Hello, world!"));
392
+ * ```
393
+ *
394
+ * @param str The text to make yellow
395
+ * @returns The yellow text
396
+ */
397
+ function yellow(str) {
398
+ return run(str, code([33], 39));
399
+ }
400
+ /**
401
+ * Set text color to blue.
402
+ *
403
+ * @example Usage
404
+ * ```ts no-assert
405
+ * import { blue } from "@std/fmt/colors";
406
+ *
407
+ * console.log(blue("Hello, world!"));
408
+ * ```
409
+ *
410
+ * @param str The text to make blue
411
+ * @returns The blue text
412
+ */
413
+ function blue(str) {
414
+ return run(str, code([34], 39));
415
+ }
416
+ /**
417
+ * Set text color to magenta.
418
+ *
419
+ * @example Usage
420
+ * ```ts no-assert
421
+ * import { magenta } from "@std/fmt/colors";
422
+ *
423
+ * console.log(magenta("Hello, world!"));
424
+ * ```
425
+ *
426
+ * @param str The text to make magenta
427
+ * @returns The magenta text
428
+ */
429
+ function magenta(str) {
430
+ return run(str, code([35], 39));
431
+ }
432
+ /**
433
+ * Set text color to cyan.
434
+ *
435
+ * @example Usage
436
+ * ```ts no-assert
437
+ * import { cyan } from "@std/fmt/colors";
438
+ *
439
+ * console.log(cyan("Hello, world!"));
440
+ * ```
441
+ *
442
+ * @param str The text to make cyan
443
+ * @returns The cyan text
444
+ */
445
+ function cyan(str) {
446
+ return run(str, code([36], 39));
447
+ }
448
+ /**
449
+ * Set text color to white.
450
+ *
451
+ * @example Usage
452
+ * ```ts no-assert
453
+ * import { white } from "@std/fmt/colors";
454
+ *
455
+ * console.log(white("Hello, world!"));
456
+ * ```
457
+ *
458
+ * @param str The text to make white
459
+ * @returns The white text
460
+ */
461
+ function white(str) {
462
+ return run(str, code([37], 39));
463
+ }
464
+ /**
465
+ * Set text color to gray.
466
+ *
467
+ * @example Usage
468
+ * ```ts no-assert
469
+ * import { gray } from "@std/fmt/colors";
470
+ *
471
+ * console.log(gray("Hello, world!"));
472
+ * ```
473
+ *
474
+ * @param str The text to make gray
475
+ * @returns The gray text
476
+ */
477
+ function gray(str) {
478
+ return brightBlack(str);
479
+ }
480
+ /**
481
+ * Set text color to bright black.
482
+ *
483
+ * @example Usage
484
+ * ```ts no-assert
485
+ * import { brightBlack } from "@std/fmt/colors";
486
+ *
487
+ * console.log(brightBlack("Hello, world!"));
488
+ * ```
489
+ *
490
+ * @param str The text to make bright black
491
+ * @returns The bright black text
492
+ */
493
+ function brightBlack(str) {
494
+ return run(str, code([90], 39));
495
+ }
496
+ /**
497
+ * Set text color to bright red.
498
+ *
499
+ * @example Usage
500
+ * ```ts no-assert
501
+ * import { brightRed } from "@std/fmt/colors";
502
+ *
503
+ * console.log(brightRed("Hello, world!"));
504
+ * ```
505
+ *
506
+ * @param str The text to make bright red
507
+ * @returns The bright red text
508
+ */
509
+ function brightRed(str) {
510
+ return run(str, code([91], 39));
511
+ }
512
+ /**
513
+ * Set text color to bright green.
514
+ *
515
+ * @example Usage
516
+ * ```ts no-assert
517
+ * import { brightGreen } from "@std/fmt/colors";
518
+ *
519
+ * console.log(brightGreen("Hello, world!"));
520
+ * ```
521
+ *
522
+ * @param str The text to make bright green
523
+ * @returns The bright green text
524
+ */
525
+ function brightGreen(str) {
526
+ return run(str, code([92], 39));
527
+ }
528
+ /**
529
+ * Set text color to bright yellow.
530
+ *
531
+ * @example Usage
532
+ * ```ts no-assert
533
+ * import { brightYellow } from "@std/fmt/colors";
534
+ *
535
+ * console.log(brightYellow("Hello, world!"));
536
+ * ```
537
+ *
538
+ * @param str The text to make bright yellow
539
+ * @returns The bright yellow text
540
+ */
541
+ function brightYellow(str) {
542
+ return run(str, code([93], 39));
543
+ }
544
+ /**
545
+ * Set text color to bright blue.
546
+ *
547
+ * @example Usage
548
+ * ```ts no-assert
549
+ * import { brightBlue } from "@std/fmt/colors";
550
+ *
551
+ * console.log(brightBlue("Hello, world!"));
552
+ * ```
553
+ *
554
+ * @param str The text to make bright blue
555
+ * @returns The bright blue text
556
+ */
557
+ function brightBlue(str) {
558
+ return run(str, code([94], 39));
559
+ }
560
+ /**
561
+ * Set text color to bright magenta.
562
+ *
563
+ * @example Usage
564
+ * ```ts no-assert
565
+ * import { brightMagenta } from "@std/fmt/colors";
566
+ *
567
+ * console.log(brightMagenta("Hello, world!"));
568
+ * ```
569
+ *
570
+ * @param str The text to make bright magenta
571
+ * @returns The bright magenta text
572
+ */
573
+ function brightMagenta(str) {
574
+ return run(str, code([95], 39));
575
+ }
576
+ /**
577
+ * Set text color to bright cyan.
578
+ *
579
+ * @example Usage
580
+ * ```ts no-assert
581
+ * import { brightCyan } from "@std/fmt/colors";
582
+ *
583
+ * console.log(brightCyan("Hello, world!"));
584
+ * ```
585
+ *
586
+ * @param str The text to make bright cyan
587
+ * @returns The bright cyan text
588
+ */
589
+ function brightCyan(str) {
590
+ return run(str, code([96], 39));
591
+ }
592
+ /**
593
+ * Set text color to bright white.
594
+ *
595
+ * @example Usage
596
+ * ```ts no-assert
597
+ * import { brightWhite } from "@std/fmt/colors";
598
+ *
599
+ * console.log(brightWhite("Hello, world!"));
600
+ * ```
601
+ *
602
+ * @param str The text to make bright white
603
+ * @returns The bright white text
604
+ */
605
+ function brightWhite(str) {
606
+ return run(str, code([97], 39));
607
+ }
608
+ /**
609
+ * Set background color to black.
610
+ *
611
+ * @example Usage
612
+ * ```ts no-assert
613
+ * import { bgBlack } from "@std/fmt/colors";
614
+ *
615
+ * console.log(bgBlack("Hello, world!"));
616
+ * ```
617
+ *
618
+ * @param str The text to make its background black
619
+ * @returns The text with black background
620
+ */
621
+ function bgBlack(str) {
622
+ return run(str, code([40], 49));
623
+ }
624
+ /**
625
+ * Set background color to red.
626
+ *
627
+ * @example Usage
628
+ * ```ts no-assert
629
+ * import { bgRed } from "@std/fmt/colors";
630
+ *
631
+ * console.log(bgRed("Hello, world!"));
632
+ * ```
633
+ *
634
+ * @param str The text to make its background red
635
+ * @returns The text with red background
636
+ */
637
+ function bgRed(str) {
638
+ return run(str, code([41], 49));
639
+ }
640
+ /**
641
+ * Set background color to green.
642
+ *
643
+ * @example Usage
644
+ * ```ts no-assert
645
+ * import { bgGreen } from "@std/fmt/colors";
646
+ *
647
+ * console.log(bgGreen("Hello, world!"));
648
+ * ```
649
+ *
650
+ * @param str The text to make its background green
651
+ * @returns The text with green background
652
+ */
653
+ function bgGreen(str) {
654
+ return run(str, code([42], 49));
655
+ }
656
+ /**
657
+ * Set background color to yellow.
658
+ *
659
+ * @example Usage
660
+ * ```ts no-assert
661
+ * import { bgYellow } from "@std/fmt/colors";
662
+ *
663
+ * console.log(bgYellow("Hello, world!"));
664
+ * ```
665
+ *
666
+ * @param str The text to make its background yellow
667
+ * @returns The text with yellow background
668
+ */
669
+ function bgYellow(str) {
670
+ return run(str, code([43], 49));
671
+ }
672
+ /**
673
+ * Set background color to blue.
674
+ *
675
+ * @example Usage
676
+ * ```ts no-assert
677
+ * import { bgBlue } from "@std/fmt/colors";
678
+ *
679
+ * console.log(bgBlue("Hello, world!"));
680
+ * ```
681
+ *
682
+ * @param str The text to make its background blue
683
+ * @returns The text with blue background
684
+ */
685
+ function bgBlue(str) {
686
+ return run(str, code([44], 49));
687
+ }
688
+ /**
689
+ * Set background color to magenta.
690
+ *
691
+ * @example Usage
692
+ * ```ts no-assert
693
+ * import { bgMagenta } from "@std/fmt/colors";
694
+ *
695
+ * console.log(bgMagenta("Hello, world!"));
696
+ * ```
697
+ *
698
+ * @param str The text to make its background magenta
699
+ * @returns The text with magenta background
700
+ */
701
+ function bgMagenta(str) {
702
+ return run(str, code([45], 49));
703
+ }
704
+ /**
705
+ * Set background color to cyan.
706
+ *
707
+ * @example Usage
708
+ * ```ts no-assert
709
+ * import { bgCyan } from "@std/fmt/colors";
710
+ *
711
+ * console.log(bgCyan("Hello, world!"));
712
+ * ```
713
+ *
714
+ * @param str The text to make its background cyan
715
+ * @returns The text with cyan background
716
+ */
717
+ function bgCyan(str) {
718
+ return run(str, code([46], 49));
719
+ }
720
+ /**
721
+ * Set background color to white.
722
+ *
723
+ * @example Usage
724
+ * ```ts no-assert
725
+ * import { bgWhite } from "@std/fmt/colors";
726
+ *
727
+ * console.log(bgWhite("Hello, world!"));
728
+ * ```
729
+ *
730
+ * @param str The text to make its background white
731
+ * @returns The text with white background
732
+ */
733
+ function bgWhite(str) {
734
+ return run(str, code([47], 49));
735
+ }
736
+ /**
737
+ * Set background color to bright black.
738
+ *
739
+ * @example Usage
740
+ * ```ts no-assert
741
+ * import { bgBrightBlack } from "@std/fmt/colors";
742
+ *
743
+ * console.log(bgBrightBlack("Hello, world!"));
744
+ * ```
745
+ *
746
+ * @param str The text to make its background bright black
747
+ * @returns The text with bright black background
748
+ */
749
+ function bgBrightBlack(str) {
750
+ return run(str, code([100], 49));
751
+ }
752
+ /**
753
+ * Set background color to bright red.
754
+ *
755
+ * @example Usage
756
+ * ```ts no-assert
757
+ * import { bgBrightRed } from "@std/fmt/colors";
758
+ *
759
+ * console.log(bgBrightRed("Hello, world!"));
760
+ * ```
761
+ *
762
+ * @param str The text to make its background bright red
763
+ * @returns The text with bright red background
764
+ */
765
+ function bgBrightRed(str) {
766
+ return run(str, code([101], 49));
767
+ }
768
+ /**
769
+ * Set background color to bright green.
770
+ *
771
+ * @example Usage
772
+ * ```ts no-assert
773
+ * import { bgBrightGreen } from "@std/fmt/colors";
774
+ *
775
+ * console.log(bgBrightGreen("Hello, world!"));
776
+ * ```
777
+ *
778
+ * @param str The text to make its background bright green
779
+ * @returns The text with bright green background
780
+ */
781
+ function bgBrightGreen(str) {
782
+ return run(str, code([102], 49));
783
+ }
784
+ /**
785
+ * Set background color to bright yellow.
786
+ *
787
+ * @example Usage
788
+ * ```ts no-assert
789
+ * import { bgBrightYellow } from "@std/fmt/colors";
790
+ *
791
+ * console.log(bgBrightYellow("Hello, world!"));
792
+ * ```
793
+ *
794
+ * @param str The text to make its background bright yellow
795
+ * @returns The text with bright yellow background
796
+ */
797
+ function bgBrightYellow(str) {
798
+ return run(str, code([103], 49));
799
+ }
800
+ /**
801
+ * Set background color to bright blue.
802
+ *
803
+ * @example Usage
804
+ * ```ts no-assert
805
+ * import { bgBrightBlue } from "@std/fmt/colors";
806
+ *
807
+ * console.log(bgBrightBlue("Hello, world!"));
808
+ * ```
809
+ *
810
+ * @param str The text to make its background bright blue
811
+ * @returns The text with bright blue background
812
+ */
813
+ function bgBrightBlue(str) {
814
+ return run(str, code([104], 49));
815
+ }
816
+ /**
817
+ * Set background color to bright magenta.
818
+ *
819
+ * @example Usage
820
+ * ```ts no-assert
821
+ * import { bgBrightMagenta } from "@std/fmt/colors";
822
+ *
823
+ * console.log(bgBrightMagenta("Hello, world!"));
824
+ * ```
825
+ *
826
+ * @param str The text to make its background bright magenta
827
+ * @returns The text with bright magenta background
828
+ */
829
+ function bgBrightMagenta(str) {
830
+ return run(str, code([105], 49));
831
+ }
832
+ /**
833
+ * Set background color to bright cyan.
834
+ *
835
+ * @example Usage
836
+ * ```ts no-assert
837
+ * import { bgBrightCyan } from "@std/fmt/colors";
838
+ *
839
+ * console.log(bgBrightCyan("Hello, world!"));
840
+ * ```
841
+ *
842
+ * @param str The text to make its background bright cyan
843
+ * @returns The text with bright cyan background
844
+ */
845
+ function bgBrightCyan(str) {
846
+ return run(str, code([106], 49));
847
+ }
848
+ /**
849
+ * Set background color to bright white.
850
+ *
851
+ * @example Usage
852
+ * ```ts no-assert
853
+ * import { bgBrightWhite } from "@std/fmt/colors";
854
+ *
855
+ * console.log(bgBrightWhite("Hello, world!"));
856
+ * ```
857
+ *
858
+ * @param str The text to make its background bright white
859
+ * @returns The text with bright white background
860
+ */
861
+ function bgBrightWhite(str) {
862
+ return run(str, code([107], 49));
863
+ }
864
+ /* Special Color Sequences */
865
+ /**
866
+ * Clam and truncate color codes
867
+ * @param n The input number
868
+ * @param max The number to truncate to
869
+ * @param min The number to truncate from
870
+ */
871
+ function clampAndTruncate(n, max = 255, min = 0) {
872
+ return Math.trunc(Math.max(Math.min(n, max), min));
873
+ }
874
+ /**
875
+ * Set text color using paletted 8bit colors.
876
+ * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
877
+ *
878
+ * @example Usage
879
+ * ```ts no-assert
880
+ * import { rgb8 } from "@std/fmt/colors";
881
+ *
882
+ * console.log(rgb8("Hello, world!", 42));
883
+ * ```
884
+ *
885
+ * @param str The text color to apply paletted 8bit colors to
886
+ * @param color The color code
887
+ * @returns The text with paletted 8bit color
888
+ */
889
+ function rgb8(str, color) {
890
+ return run(str, code([38, 5, clampAndTruncate(color)], 39));
891
+ }
892
+ /**
893
+ * Set background color using paletted 8bit colors.
894
+ * https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit
895
+ *
896
+ * @example Usage
897
+ * ```ts no-assert
898
+ * import { bgRgb8 } from "@std/fmt/colors";
899
+ *
900
+ * console.log(bgRgb8("Hello, world!", 42));
901
+ * ```
902
+ *
903
+ * @param str The text color to apply paletted 8bit background colors to
904
+ * @param color code
905
+ * @returns The text with paletted 8bit background color
906
+ */
907
+ function bgRgb8(str, color) {
908
+ return run(str, code([48, 5, clampAndTruncate(color)], 49));
909
+ }
910
+ /**
911
+ * Set text color using 24bit rgb.
912
+ * `color` can be a number in range `0x000000` to `0xffffff` or
913
+ * an `Rgb`.
914
+ *
915
+ * @example To produce the color magenta:
916
+ * ```ts no-assert
917
+ * import { rgb24 } from "@std/fmt/colors";
918
+ *
919
+ * rgb24("foo", 0xff00ff);
920
+ * rgb24("foo", {r: 255, g: 0, b: 255});
921
+ * ```
922
+ * @param str The text color to apply 24bit rgb to
923
+ * @param color The color code
924
+ * @returns The text with 24bit rgb color
925
+ */
926
+ function rgb24(str, color) {
927
+ if (typeof color === "number") {
928
+ return run(str, code([38, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 39));
929
+ }
930
+ return run(str, code([
931
+ 38,
932
+ 2,
933
+ clampAndTruncate(color.r),
934
+ clampAndTruncate(color.g),
935
+ clampAndTruncate(color.b),
936
+ ], 39));
937
+ }
938
+ /**
939
+ * Set background color using 24bit rgb.
940
+ * `color` can be a number in range `0x000000` to `0xffffff` or
941
+ * an `Rgb`.
942
+ *
943
+ * @example To produce the color magenta:
944
+ * ```ts no-assert
945
+ * import { bgRgb24 } from "@std/fmt/colors";
946
+ *
947
+ * bgRgb24("foo", 0xff00ff);
948
+ * bgRgb24("foo", {r: 255, g: 0, b: 255});
949
+ * ```
950
+ * @param str The text color to apply 24bit rgb to
951
+ * @param color The color code
952
+ * @returns The text with 24bit rgb color
953
+ */
954
+ function bgRgb24(str, color) {
955
+ if (typeof color === "number") {
956
+ return run(str, code([48, 2, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff], 49));
957
+ }
958
+ return run(str, code([
959
+ 48,
960
+ 2,
961
+ clampAndTruncate(color.r),
962
+ clampAndTruncate(color.g),
963
+ clampAndTruncate(color.b),
964
+ ], 49));
965
+ }
966
+ // https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js
967
+ const ANSI_PATTERN = new RegExp([
968
+ "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
969
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TXZcf-nq-uy=><~]))",
970
+ ].join("|"), "g");
971
+ /**
972
+ * Remove ANSI escape codes from the string.
973
+ *
974
+ * @example Usage
975
+ * ```ts no-assert
976
+ * import { stripAnsiCode, red } from "@std/fmt/colors";
977
+ *
978
+ * console.log(stripAnsiCode(red("Hello, world!")));
979
+ * ```
980
+ *
981
+ * @param string The text to remove ANSI escape codes from
982
+ * @returns The text without ANSI escape codes
983
+ */
984
+ function stripAnsiCode(string) {
985
+ return string.replace(ANSI_PATTERN, "");
986
+ }