@travisennis/acai 0.0.4 → 0.0.5

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 (316) hide show
  1. package/README.md +225 -6
  2. package/dist/api/exa/index.d.ts +177 -0
  3. package/dist/api/exa/index.d.ts.map +1 -0
  4. package/dist/api/exa/index.js +439 -0
  5. package/dist/cli.d.ts +3 -2
  6. package/dist/cli.d.ts.map +1 -0
  7. package/dist/commands/application-log-command.d.ts +1 -0
  8. package/dist/commands/application-log-command.d.ts.map +1 -0
  9. package/dist/commands/application-log-command.js +5 -3
  10. package/dist/commands/clear-command.d.ts +1 -0
  11. package/dist/commands/clear-command.d.ts.map +1 -0
  12. package/dist/commands/clear-command.js +2 -3
  13. package/dist/commands/compact-command.d.ts +1 -0
  14. package/dist/commands/compact-command.d.ts.map +1 -0
  15. package/dist/commands/compact-command.js +1 -1
  16. package/dist/commands/copy-command.d.ts +1 -0
  17. package/dist/commands/copy-command.d.ts.map +1 -0
  18. package/dist/commands/copy-command.js +3 -2
  19. package/dist/commands/edit-command.d.ts +1 -0
  20. package/dist/commands/edit-command.d.ts.map +1 -0
  21. package/dist/commands/edit-command.js +7 -5
  22. package/dist/commands/edit-prompt-command.d.ts +2 -1
  23. package/dist/commands/edit-prompt-command.d.ts.map +1 -0
  24. package/dist/commands/edit-prompt-command.js +15 -7
  25. package/dist/commands/exit-command.d.ts +13 -2
  26. package/dist/commands/exit-command.d.ts.map +1 -0
  27. package/dist/commands/exit-command.js +14 -2
  28. package/dist/commands/files-command.d.ts +1 -0
  29. package/dist/commands/files-command.d.ts.map +1 -0
  30. package/dist/commands/files-command.js +9 -8
  31. package/dist/commands/generate-rules-command.d.ts +1 -0
  32. package/dist/commands/generate-rules-command.d.ts.map +1 -0
  33. package/dist/commands/generate-rules-command.js +4 -3
  34. package/dist/commands/health-command.d.ts +3 -1
  35. package/dist/commands/health-command.d.ts.map +1 -0
  36. package/dist/commands/health-command.js +42 -5
  37. package/dist/commands/help-command.d.ts +1 -0
  38. package/dist/commands/help-command.d.ts.map +1 -0
  39. package/dist/commands/help-command.js +2 -3
  40. package/dist/commands/init-command.d.ts +1 -0
  41. package/dist/commands/init-command.d.ts.map +1 -0
  42. package/dist/commands/init-command.js +1 -2
  43. package/dist/commands/last-log-command.d.ts +1 -0
  44. package/dist/commands/last-log-command.d.ts.map +1 -0
  45. package/dist/commands/last-log-command.js +12 -17
  46. package/dist/commands/list-tools-command.d.ts +3 -0
  47. package/dist/commands/list-tools-command.d.ts.map +1 -0
  48. package/dist/commands/list-tools-command.js +61 -0
  49. package/dist/commands/manager.d.ts +7 -2
  50. package/dist/commands/manager.d.ts.map +1 -0
  51. package/dist/commands/manager.js +43 -6
  52. package/dist/commands/model-command.d.ts +1 -0
  53. package/dist/commands/model-command.d.ts.map +1 -0
  54. package/dist/commands/model-command.js +5 -5
  55. package/dist/commands/paste-command.d.ts +1 -0
  56. package/dist/commands/paste-command.d.ts.map +1 -0
  57. package/dist/commands/paste-command.js +6 -5
  58. package/dist/commands/prompt-command.d.ts +2 -1
  59. package/dist/commands/prompt-command.d.ts.map +1 -0
  60. package/dist/commands/prompt-command.js +62 -8
  61. package/dist/commands/reset-command.d.ts +1 -0
  62. package/dist/commands/reset-command.d.ts.map +1 -0
  63. package/dist/commands/reset-command.js +1 -1
  64. package/dist/commands/rules-command.d.ts +1 -0
  65. package/dist/commands/rules-command.d.ts.map +1 -0
  66. package/dist/commands/rules-command.js +5 -3
  67. package/dist/commands/save-command.d.ts +1 -0
  68. package/dist/commands/save-command.d.ts.map +1 -0
  69. package/dist/commands/save-command.js +1 -1
  70. package/dist/commands/shell-command.d.ts +3 -0
  71. package/dist/commands/shell-command.d.ts.map +1 -0
  72. package/dist/commands/shell-command.js +60 -0
  73. package/dist/commands/types.d.ts +9 -6
  74. package/dist/commands/types.d.ts.map +1 -0
  75. package/dist/commands/usage-command.d.ts +1 -0
  76. package/dist/commands/usage-command.d.ts.map +1 -0
  77. package/dist/commands/usage-command.js +2 -3
  78. package/dist/config.d.ts +22 -34
  79. package/dist/config.d.ts.map +1 -0
  80. package/dist/config.js +61 -15
  81. package/dist/conversation-analyzer.d.ts +2 -1
  82. package/dist/conversation-analyzer.d.ts.map +1 -0
  83. package/dist/dedent.d.ts +1 -0
  84. package/dist/dedent.d.ts.map +1 -0
  85. package/dist/execution/index.d.ts +112 -0
  86. package/dist/execution/index.d.ts.map +1 -0
  87. package/dist/execution/index.js +432 -0
  88. package/dist/formatting.d.ts +2 -13
  89. package/dist/formatting.d.ts.map +1 -0
  90. package/dist/formatting.js +5 -64
  91. package/dist/index.d.ts +1 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.js +14 -4
  94. package/dist/logger.d.ts +1 -0
  95. package/dist/logger.d.ts.map +1 -0
  96. package/dist/mentions.d.ts +4 -0
  97. package/dist/mentions.d.ts.map +1 -0
  98. package/dist/mentions.js +42 -10
  99. package/dist/messages.d.ts +8 -20
  100. package/dist/messages.d.ts.map +1 -0
  101. package/dist/messages.js +33 -53
  102. package/dist/middleware/audit-message.d.ts +1 -0
  103. package/dist/middleware/audit-message.d.ts.map +1 -0
  104. package/dist/middleware/index.d.ts +1 -0
  105. package/dist/middleware/index.d.ts.map +1 -0
  106. package/dist/middleware/rate-limit.d.ts +1 -0
  107. package/dist/middleware/rate-limit.d.ts.map +1 -0
  108. package/dist/models/ai-config.d.ts +1 -0
  109. package/dist/models/ai-config.d.ts.map +1 -0
  110. package/dist/models/anthropic-provider.d.ts +1 -0
  111. package/dist/models/anthropic-provider.d.ts.map +1 -0
  112. package/dist/models/deepseek-provider.d.ts +1 -0
  113. package/dist/models/deepseek-provider.d.ts.map +1 -0
  114. package/dist/models/google-provider.d.ts +1 -0
  115. package/dist/models/google-provider.d.ts.map +1 -0
  116. package/dist/models/groq-provider.d.ts +20 -0
  117. package/dist/models/groq-provider.d.ts.map +1 -0
  118. package/dist/models/groq-provider.js +31 -0
  119. package/dist/models/manager.d.ts +1 -0
  120. package/dist/models/manager.d.ts.map +1 -0
  121. package/dist/models/openai-provider.d.ts +2 -1
  122. package/dist/models/openai-provider.d.ts.map +1 -0
  123. package/dist/models/openrouter-provider.d.ts +31 -22
  124. package/dist/models/openrouter-provider.d.ts.map +1 -0
  125. package/dist/models/openrouter-provider.js +115 -1
  126. package/dist/models/providers.d.ts +4 -5
  127. package/dist/models/providers.d.ts.map +1 -0
  128. package/dist/models/providers.js +7 -3
  129. package/dist/models/xai-provider.d.ts +1 -0
  130. package/dist/models/xai-provider.d.ts.map +1 -0
  131. package/dist/parsing.d.ts +2 -1
  132. package/dist/parsing.d.ts.map +1 -0
  133. package/dist/prompts/manager.d.ts +14 -2
  134. package/dist/prompts/manager.d.ts.map +1 -0
  135. package/dist/prompts.d.ts +1 -0
  136. package/dist/prompts.d.ts.map +1 -0
  137. package/dist/prompts.js +15 -11
  138. package/dist/repl/display-tool-messages.d.ts +4 -0
  139. package/dist/repl/display-tool-messages.d.ts.map +1 -0
  140. package/dist/repl/display-tool-messages.js +55 -0
  141. package/dist/repl/display-tool-use.d.ts +14 -0
  142. package/dist/repl/display-tool-use.d.ts.map +1 -0
  143. package/dist/repl/display-tool-use.js +63 -0
  144. package/dist/repl/get-prompt-header.d.ts +8 -0
  145. package/dist/repl/get-prompt-header.d.ts.map +1 -0
  146. package/dist/repl/get-prompt-header.js +38 -0
  147. package/dist/repl/tool-call-repair.d.ts +4 -0
  148. package/dist/repl/tool-call-repair.d.ts.map +1 -0
  149. package/dist/repl/tool-call-repair.js +50 -0
  150. package/dist/repl-prompt.d.ts +1 -0
  151. package/dist/repl-prompt.d.ts.map +1 -0
  152. package/dist/repl.d.ts +8 -4
  153. package/dist/repl.d.ts.map +1 -0
  154. package/dist/repl.js +108 -252
  155. package/dist/terminal/ansi-styles.d.ts +77 -0
  156. package/dist/terminal/ansi-styles.d.ts.map +1 -0
  157. package/dist/terminal/ansi-styles.js +215 -0
  158. package/dist/terminal/checkbox-prompt.d.ts +36 -0
  159. package/dist/terminal/checkbox-prompt.d.ts.map +1 -0
  160. package/dist/terminal/checkbox-prompt.js +362 -0
  161. package/dist/terminal/default-theme.d.ts +6 -0
  162. package/dist/terminal/default-theme.d.ts.map +1 -0
  163. package/dist/terminal/default-theme.js +182 -0
  164. package/dist/terminal/east-asian-width.d.ts +8 -0
  165. package/dist/terminal/east-asian-width.d.ts.map +1 -0
  166. package/dist/terminal/east-asian-width.js +409 -0
  167. package/dist/terminal/editor-prompt.d.ts +10 -0
  168. package/dist/terminal/editor-prompt.d.ts.map +1 -0
  169. package/dist/terminal/editor-prompt.js +61 -0
  170. package/dist/terminal/errors.d.ts +19 -0
  171. package/dist/terminal/errors.d.ts.map +1 -0
  172. package/dist/terminal/errors.js +37 -0
  173. package/dist/terminal/formatting.d.ts +1 -11
  174. package/dist/terminal/formatting.d.ts.map +1 -0
  175. package/dist/terminal/formatting.js +4 -20
  176. package/dist/terminal/highlight/index.d.ts +53 -0
  177. package/dist/terminal/highlight/index.d.ts.map +1 -0
  178. package/dist/terminal/highlight/index.js +90 -0
  179. package/dist/terminal/highlight/theme.d.ts +233 -0
  180. package/dist/terminal/highlight/theme.d.ts.map +1 -0
  181. package/dist/terminal/highlight/theme.js +83 -0
  182. package/dist/terminal/index.d.ts +16 -9
  183. package/dist/terminal/index.d.ts.map +1 -0
  184. package/dist/terminal/index.js +42 -126
  185. package/dist/terminal/input-prompt.d.ts +16 -0
  186. package/dist/terminal/input-prompt.d.ts.map +1 -0
  187. package/dist/terminal/input-prompt.js +181 -0
  188. package/dist/terminal/markdown-utils.d.ts +1 -0
  189. package/dist/terminal/markdown-utils.d.ts.map +1 -0
  190. package/dist/terminal/markdown.d.ts +1 -0
  191. package/dist/terminal/markdown.d.ts.map +1 -0
  192. package/dist/terminal/markdown.js +17 -12
  193. package/dist/terminal/search-prompt.d.ts +20 -0
  194. package/dist/terminal/search-prompt.d.ts.map +1 -0
  195. package/dist/terminal/search-prompt.js +279 -0
  196. package/dist/terminal/select-prompt.d.ts +26 -0
  197. package/dist/terminal/select-prompt.d.ts.map +1 -0
  198. package/dist/terminal/select-prompt.js +298 -0
  199. package/dist/terminal/string-width.d.ts +7 -0
  200. package/dist/terminal/string-width.d.ts.map +1 -0
  201. package/dist/terminal/string-width.js +61 -0
  202. package/dist/terminal/strip-ansi.d.ts +2 -0
  203. package/dist/terminal/strip-ansi.d.ts.map +1 -0
  204. package/dist/terminal/strip-ansi.js +20 -0
  205. package/dist/terminal/style.d.ts +191 -0
  206. package/dist/terminal/style.d.ts.map +1 -0
  207. package/dist/terminal/style.js +259 -0
  208. package/dist/terminal/supports-color.d.ts +1 -0
  209. package/dist/terminal/supports-color.d.ts.map +1 -0
  210. package/dist/terminal/supports-hyperlinks.d.ts +1 -3
  211. package/dist/terminal/supports-hyperlinks.d.ts.map +1 -0
  212. package/dist/terminal/supports-hyperlinks.js +1 -1
  213. package/dist/terminal/types.d.ts +1 -37
  214. package/dist/terminal/types.d.ts.map +1 -0
  215. package/dist/terminal/wrap-ansi.d.ts +8 -0
  216. package/dist/terminal/wrap-ansi.d.ts.map +1 -0
  217. package/dist/terminal/wrap-ansi.js +190 -0
  218. package/dist/{token-utils.d.ts → tokens/counter.d.ts} +1 -0
  219. package/dist/tokens/counter.d.ts.map +1 -0
  220. package/dist/{token-utils.js → tokens/counter.js} +1 -1
  221. package/dist/tokens/manage-output.d.ts +34 -0
  222. package/dist/tokens/manage-output.d.ts.map +1 -0
  223. package/dist/tokens/manage-output.js +44 -0
  224. package/dist/{token-tracker.d.ts → tokens/tracker.d.ts} +1 -0
  225. package/dist/tokens/tracker.d.ts.map +1 -0
  226. package/dist/tool-executor.d.ts +28 -0
  227. package/dist/tool-executor.d.ts.map +1 -0
  228. package/dist/tool-executor.js +74 -0
  229. package/dist/tools/agent.d.ts +3 -2
  230. package/dist/tools/agent.d.ts.map +1 -0
  231. package/dist/tools/agent.js +7 -4
  232. package/dist/tools/bash-utils.d.ts +7 -0
  233. package/dist/tools/bash-utils.d.ts.map +1 -0
  234. package/dist/tools/bash-utils.js +212 -0
  235. package/dist/tools/bash.d.ts +9 -7
  236. package/dist/tools/bash.d.ts.map +1 -0
  237. package/dist/tools/bash.js +95 -212
  238. package/dist/tools/code-interpreter.d.ts +1 -1
  239. package/dist/tools/code-interpreter.d.ts.map +1 -0
  240. package/dist/tools/code-interpreter.js +31 -96
  241. package/dist/tools/delete-file.d.ts +5 -3
  242. package/dist/tools/delete-file.d.ts.map +1 -0
  243. package/dist/tools/delete-file.js +47 -33
  244. package/dist/tools/directory-tree.d.ts +10 -1
  245. package/dist/tools/directory-tree.d.ts.map +1 -0
  246. package/dist/tools/directory-tree.js +91 -8
  247. package/dist/tools/dynamic-tool-loader.d.ts +12 -0
  248. package/dist/tools/dynamic-tool-loader.d.ts.map +1 -0
  249. package/dist/tools/dynamic-tool-loader.js +280 -0
  250. package/dist/tools/dynamic-tool-parser.d.ts +20 -0
  251. package/dist/tools/dynamic-tool-parser.d.ts.map +1 -0
  252. package/dist/tools/dynamic-tool-parser.js +21 -0
  253. package/dist/tools/edit-file.d.ts +10 -2
  254. package/dist/tools/edit-file.d.ts.map +1 -0
  255. package/dist/tools/edit-file.js +117 -40
  256. package/dist/tools/file-editing-utils.d.ts +2 -0
  257. package/dist/tools/file-editing-utils.d.ts.map +1 -0
  258. package/dist/tools/file-editing-utils.js +135 -0
  259. package/dist/tools/filesystem-utils.d.ts +6 -21
  260. package/dist/tools/filesystem-utils.d.ts.map +1 -0
  261. package/dist/tools/filesystem-utils.js +96 -148
  262. package/dist/tools/git-utils.d.ts +1 -0
  263. package/dist/tools/git-utils.d.ts.map +1 -0
  264. package/dist/tools/grep.d.ts +5 -3
  265. package/dist/tools/grep.d.ts.map +1 -0
  266. package/dist/tools/grep.js +67 -27
  267. package/dist/tools/index.d.ts +10 -16
  268. package/dist/tools/index.d.ts.map +1 -0
  269. package/dist/tools/index.js +33 -22
  270. package/dist/tools/move-file.d.ts +1 -0
  271. package/dist/tools/move-file.d.ts.map +1 -0
  272. package/dist/tools/move-file.js +12 -5
  273. package/dist/tools/read-file.d.ts +2 -1
  274. package/dist/tools/read-file.d.ts.map +1 -0
  275. package/dist/tools/read-file.js +13 -6
  276. package/dist/tools/read-multiple-files.d.ts +2 -1
  277. package/dist/tools/read-multiple-files.d.ts.map +1 -0
  278. package/dist/tools/read-multiple-files.js +90 -9
  279. package/dist/tools/save-file.d.ts +5 -3
  280. package/dist/tools/save-file.d.ts.map +1 -0
  281. package/dist/tools/save-file.js +64 -36
  282. package/dist/tools/think.d.ts +1 -0
  283. package/dist/tools/think.d.ts.map +1 -0
  284. package/dist/tools/think.js +5 -1
  285. package/dist/tools/types.d.ts +14 -1
  286. package/dist/tools/types.d.ts.map +1 -0
  287. package/dist/tools/web-fetch.d.ts +4 -2
  288. package/dist/tools/web-fetch.d.ts.map +1 -0
  289. package/dist/tools/web-fetch.js +2 -2
  290. package/dist/tools/web-search.d.ts +2 -1
  291. package/dist/tools/web-search.d.ts.map +1 -0
  292. package/dist/tools/web-search.js +46 -11
  293. package/dist/utils/filesystem.d.ts +23 -0
  294. package/dist/utils/filesystem.d.ts.map +1 -0
  295. package/dist/utils/filesystem.js +140 -0
  296. package/dist/utils/filetype-detection.d.ts +3 -0
  297. package/dist/utils/filetype-detection.d.ts.map +1 -0
  298. package/dist/utils/filetype-detection.js +112 -0
  299. package/dist/utils/glob.d.ts +52 -0
  300. package/dist/utils/glob.d.ts.map +1 -0
  301. package/dist/utils/glob.js +376 -0
  302. package/dist/utils/ignore.d.ts +104 -0
  303. package/dist/utils/ignore.d.ts.map +1 -0
  304. package/dist/utils/ignore.js +649 -0
  305. package/dist/utils/process.d.ts +3 -2
  306. package/dist/utils/process.d.ts.map +1 -0
  307. package/dist/utils/process.js +17 -2
  308. package/dist/utils/zod-utils.d.ts +4 -0
  309. package/dist/utils/zod-utils.d.ts.map +1 -0
  310. package/dist/utils/zod-utils.js +7 -0
  311. package/dist/version.d.ts +1 -0
  312. package/dist/version.d.ts.map +1 -0
  313. package/package.json +32 -30
  314. package/dist/tools/command-validation.d.ts +0 -11
  315. package/dist/tools/command-validation.js +0 -45
  316. /package/dist/{token-tracker.js → tokens/tracker.js} +0 -0
@@ -0,0 +1,112 @@
1
+ import { basename, extname } from "node:path";
2
+ const extensionToLanguageMap = {
3
+ ".ts": { name: "TypeScript", codeblock: "typescript" },
4
+ ".js": { name: "JavaScript", codeblock: "javascript" },
5
+ ".mjs": { name: "JavaScript", codeblock: "javascript" },
6
+ ".cjs": { name: "JavaScript", codeblock: "javascript" },
7
+ ".jsx": { name: "JavaScript", codeblock: "javascript" },
8
+ ".tsx": { name: "TypeScript", codeblock: "typescript" },
9
+ ".py": { name: "Python", codeblock: "python" },
10
+ ".java": { name: "Java", codeblock: "java" },
11
+ ".go": { name: "Go", codeblock: "go" },
12
+ ".rb": { name: "Ruby", codeblock: "ruby" },
13
+ ".php": { name: "PHP", codeblock: "php" },
14
+ ".phtml": { name: "PHP", codeblock: "php" },
15
+ ".cs": { name: "C#", codeblock: "csharp" },
16
+ ".cpp": { name: "C++", codeblock: "cpp" },
17
+ ".cxx": { name: "C++", codeblock: "cpp" },
18
+ ".cc": { name: "C++", codeblock: "cpp" },
19
+ ".c": { name: "C", codeblock: "c" },
20
+ ".h": { name: "C/C++", codeblock: "cpp" },
21
+ ".hpp": { name: "C++", codeblock: "cpp" },
22
+ ".swift": { name: "Swift", codeblock: "swift" },
23
+ ".kt": { name: "Kotlin", codeblock: "kotlin" },
24
+ ".rs": { name: "Rust", codeblock: "rust" },
25
+ ".m": { name: "Objective-C", codeblock: "objectivec" },
26
+ ".mm": { name: "Objective-C", codeblock: "objectivec" },
27
+ ".pl": { name: "Perl", codeblock: "perl" },
28
+ ".pm": { name: "Perl", codeblock: "perl" },
29
+ ".lua": { name: "Lua", codeblock: "lua" },
30
+ ".r": { name: "R", codeblock: "r" },
31
+ ".scala": { name: "Scala", codeblock: "scala" },
32
+ ".sc": { name: "Scala", codeblock: "scala" },
33
+ ".sh": { name: "Shell", codeblock: "bash" },
34
+ ".ps1": { name: "PowerShell", codeblock: "powershell" },
35
+ ".bat": { name: "Batch", codeblock: "batch" },
36
+ ".cmd": { name: "Batch", codeblock: "batch" },
37
+ ".sql": { name: "SQL", codeblock: "sql" },
38
+ ".html": { name: "HTML", codeblock: "html" },
39
+ ".htm": { name: "HTML", codeblock: "html" },
40
+ ".css": { name: "CSS", codeblock: "css" },
41
+ ".less": { name: "Less", codeblock: "less" },
42
+ ".sass": { name: "Sass", codeblock: "sass" },
43
+ ".scss": { name: "Sass", codeblock: "scss" },
44
+ ".json": { name: "JSON", codeblock: "json" },
45
+ ".xml": { name: "XML", codeblock: "xml" },
46
+ ".yaml": { name: "YAML", codeblock: "yaml" },
47
+ ".yml": { name: "YAML", codeblock: "yaml" },
48
+ ".md": { name: "Markdown", codeblock: "markdown" },
49
+ ".markdown": { name: "Markdown", codeblock: "markdown" },
50
+ ".dockerfile": { name: "Dockerfile", codeblock: "dockerfile" },
51
+ ".vim": { name: "Vim script", codeblock: "vim" },
52
+ ".vb": { name: "Visual Basic", codeblock: "vb" },
53
+ ".fs": { name: "F#", codeblock: "fsharp" },
54
+ ".clj": { name: "Clojure", codeblock: "clojure" },
55
+ ".cljs": { name: "Clojure", codeblock: "clojure" },
56
+ ".dart": { name: "Dart", codeblock: "dart" },
57
+ ".ex": { name: "Elixir", codeblock: "elixir" },
58
+ ".erl": { name: "Erlang", codeblock: "erlang" },
59
+ ".hs": { name: "Haskell", codeblock: "haskell" },
60
+ ".lisp": { name: "Lisp", codeblock: "lisp" },
61
+ ".rkt": { name: "Racket", codeblock: "racket" },
62
+ ".groovy": { name: "Groovy", codeblock: "groovy" },
63
+ ".jl": { name: "Julia", codeblock: "julia" },
64
+ ".tex": { name: "LaTeX", codeblock: "latex" },
65
+ ".ino": { name: "Arduino", codeblock: "arduino" },
66
+ ".asm": { name: "Assembly", codeblock: "asm" },
67
+ ".s": { name: "Assembly", codeblock: "asm" },
68
+ ".toml": { name: "TOML", codeblock: "toml" },
69
+ ".vue": { name: "Vue", codeblock: "vue" },
70
+ ".svelte": { name: "Svelte", codeblock: "svelte" },
71
+ ".gohtml": { name: "Go Template", codeblock: "go" },
72
+ ".hbs": { name: "Handlebars", codeblock: "handlebars" },
73
+ ".ejs": { name: "EJS", codeblock: "ejs" },
74
+ ".erb": { name: "ERB", codeblock: "erb" },
75
+ ".jsp": { name: "JSP", codeblock: "jsp" },
76
+ ".dockerignore": { name: "Docker", codeblock: "dockerfile" },
77
+ ".gitignore": { name: "Git", codeblock: "gitignore" },
78
+ ".npmignore": { name: "npm", codeblock: "npmignore" },
79
+ ".editorconfig": { name: "EditorConfig", codeblock: "editorconfig" },
80
+ ".prettierrc": { name: "Prettier", codeblock: "json" },
81
+ ".eslintrc": { name: "ESLint", codeblock: "json" },
82
+ ".babelrc": { name: "Babel", codeblock: "json" },
83
+ ".tsconfig": { name: "TypeScript", codeblock: "json" },
84
+ ".flow": { name: "Flow", codeblock: "flow" },
85
+ ".graphql": { name: "GraphQL", codeblock: "graphql" },
86
+ ".proto": { name: "Protocol Buffers", codeblock: "protobuf" },
87
+ ".txt": { name: "Text", codeblock: "text" },
88
+ };
89
+ export function getLanguageFromFilePath(filePath) {
90
+ const extension = extname(filePath).toLowerCase();
91
+ const languageInfo = extension
92
+ ? extensionToLanguageMap[extension]
93
+ : undefined;
94
+ if (languageInfo) {
95
+ return languageInfo.name;
96
+ }
97
+ const filename = basename(filePath).toLowerCase();
98
+ const filenameLanguageInfo = extensionToLanguageMap[`.${filename}`];
99
+ return filenameLanguageInfo?.name;
100
+ }
101
+ export function getCodeblockFromFilePath(filePath) {
102
+ const extension = extname(filePath).toLowerCase();
103
+ const languageInfo = extension
104
+ ? extensionToLanguageMap[extension]
105
+ : undefined;
106
+ if (languageInfo) {
107
+ return languageInfo.codeblock;
108
+ }
109
+ const filename = basename(filePath).toLowerCase();
110
+ const filenameLanguageInfo = extensionToLanguageMap[`.${filename}`];
111
+ return filenameLanguageInfo?.codeblock;
112
+ }
@@ -0,0 +1,52 @@
1
+ import { type Options as FastGlobOptions } from "fast-glob";
2
+ type ExpandDirectoriesOption = boolean | readonly string[] | {
3
+ files?: readonly string[];
4
+ extensions?: readonly string[];
5
+ };
6
+ type FastGlobOptionsWithoutCwd = Omit<FastGlobOptions, "cwd">;
7
+ type Options = {
8
+ /**
9
+ * If set to `true`, `glob` will automatically glob directories for you. If you define an `Array` it will only glob files that matches the patterns inside the `Array`. You can also define an `Object` with `files` and `extensions` like in the example below.
10
+ *
11
+ * Note that if you set this option to `false`, you won't get back matched directories unless you set `onlyFiles: false`.
12
+ *
13
+ * @default true
14
+ */
15
+ readonly expandDirectories?: ExpandDirectoriesOption;
16
+ /**
17
+ * Respect ignore patterns in `.gitignore` files that apply to the globbed files.
18
+ *
19
+ * Performance note: This option searches for all `.gitignore` files in the entire directory tree before globbing, which can be slow. For better performance, use `ignoreFiles: '.gitignore'` to only respect the root `.gitignore` file.
20
+ *
21
+ * @default false
22
+ */
23
+ readonly gitignore?: boolean;
24
+ /**
25
+ * Glob patterns to look for ignore files, which are then used to ignore globbed files.
26
+ *
27
+ * This is a more generic form of the `gitignore` option, allowing you to find ignore files with a [compatible syntax](http://git-scm.com/docs/gitignore). For instance, this works with Babel's `.babelignore`, Prettier's `.prettierignore`, or ESLint's `.eslintignore` files.
28
+ *
29
+ * Performance tip: Using a specific path like `'.gitignore'` is much faster than recursive patterns.
30
+ *
31
+ * @default undefined
32
+ */
33
+ readonly ignoreFiles?: string | readonly string[];
34
+ /**
35
+ * The current working directory in which to search.
36
+ *
37
+ * @default process.cwd()
38
+ */
39
+ readonly cwd?: URL | string;
40
+ } & FastGlobOptionsWithoutCwd;
41
+ /**
42
+ * Find files and directories using glob patterns.
43
+ *
44
+ * Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
45
+ *
46
+ * @param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
47
+ * @param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
48
+ * @returns The matching paths.
49
+ */
50
+ export declare const glob: (patterns: string | string[] | readonly string[], options?: Options) => Promise<string[]>;
51
+ export {};
52
+ //# sourceMappingURL=glob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../source/utils/glob.ts"],"names":[],"mappings":"AAIA,OAAW,EAAc,KAAK,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAC;AAgB5E,KAAK,uBAAuB,GACxB,OAAO,GACP,SAAS,MAAM,EAAE,GACjB;IAAE,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAElE,KAAK,yBAAyB,GAAG,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;AAE9D,KAAK,OAAO,GAAG;IACb;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;IAErD;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IAElD;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC;CAC7B,GAAG,yBAAyB,CAAC;AA6U9B;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,8DAtLa,OAAO,sBAoMpC,CAAC"}
@@ -0,0 +1,376 @@
1
+ import * as fs from "node:fs";
2
+ import { readFile } from "node:fs/promises";
3
+ import path, * as nodePath from "node:path";
4
+ import * as process from "node:process";
5
+ import fg from "fast-glob";
6
+ import { isDirectory, slash, toPath } from "./filesystem.js";
7
+ import { Ignore } from "./ignore.js";
8
+ // Cache for ignore patterns to avoid repeated IO
9
+ const ignoreCache = new Map();
10
+ const CACHE_TTL = 60000; // 1 minute TTL
11
+ const assertPatternsInput = (patterns) => {
12
+ if (patterns.some((pattern) => typeof pattern !== "string")) {
13
+ throw new TypeError("Patterns must be a string or an array of strings");
14
+ }
15
+ };
16
+ // Pre-compiled regexes for performance
17
+ const GLOBSTAR_DIRECTORY_REGEX = /\*\*\/([^/]+)$/;
18
+ const WILDCARD_CHARS_REGEX = /[*?[\]{}]/;
19
+ const EXTENSION_PATTERN_REGEX = /\.[a-zA-Z0-9]{1,5}$/;
20
+ const normalizePathForDirectoryGlob = (filePath, cwd) => {
21
+ const path = isNegativePattern(filePath) ? filePath.slice(1) : filePath;
22
+ return nodePath.isAbsolute(path) ? path : nodePath.join(cwd, path);
23
+ };
24
+ const shouldExpandGlobstarDirectory = (pattern) => {
25
+ const match = pattern?.match(GLOBSTAR_DIRECTORY_REGEX);
26
+ if (!match) {
27
+ return false;
28
+ }
29
+ const dirname = match[1];
30
+ const hasWildcards = WILDCARD_CHARS_REGEX.test(dirname);
31
+ // Only consider it an extension if it looks like a file extension pattern
32
+ // (e.g., contains common extension chars and doesn't look like a directory name)
33
+ const hasExtension = EXTENSION_PATTERN_REGEX.test(dirname) && !dirname.startsWith(".");
34
+ return !hasWildcards && !hasExtension;
35
+ };
36
+ const getDirectoryGlob = ({ directoryPath, files, extensions, }) => {
37
+ const extensionGlob = extensions && extensions.length > 0
38
+ ? `.${extensions.length > 1 ? `{${extensions.join(",")}}` : extensions[0]}`
39
+ : "";
40
+ return files
41
+ ? files.map((file) => {
42
+ // Don't append extension glob if file already has wildcards, extension, or looks like a pattern
43
+ const hasGlobChars = /[*?[\]{}]/.test(file);
44
+ const hasExtension = nodePath.extname(file);
45
+ const shouldAppendExtension = extensionGlob && !hasGlobChars && !hasExtension;
46
+ return nodePath.posix.join(directoryPath, `**/${shouldAppendExtension ? `${file}${extensionGlob}` : file}`);
47
+ })
48
+ : [
49
+ nodePath.posix.join(directoryPath, `**${extensionGlob ? `/*${extensionGlob}` : ""}`),
50
+ ];
51
+ };
52
+ const directoryToGlob = async (directoryPaths, { cwd = process.cwd(), files, extensions, } = {}) => {
53
+ const globs = await Promise.all(directoryPaths.map(async (directoryPath) => {
54
+ // Check pattern without negative prefix
55
+ const checkPattern = isNegativePattern(directoryPath)
56
+ ? directoryPath.slice(1)
57
+ : directoryPath;
58
+ // Expand globstar directory patterns like **/dirname to **/dirname/**
59
+ if (shouldExpandGlobstarDirectory(checkPattern)) {
60
+ return getDirectoryGlob({ directoryPath, files, extensions });
61
+ }
62
+ // If pattern contains any glob wildcard, do not stat; leave as-is
63
+ if (/[*?[\]{}]/.test(checkPattern)) {
64
+ return directoryPath;
65
+ }
66
+ // Original logic for checking actual directories
67
+ const pathToCheck = normalizePathForDirectoryGlob(directoryPath, cwd);
68
+ return (await isDirectory(pathToCheck))
69
+ ? getDirectoryGlob({ directoryPath, files, extensions })
70
+ : directoryPath;
71
+ }));
72
+ return globs.flat();
73
+ };
74
+ const toPatternsArray = (patterns) => {
75
+ const flattenedPatterns = Array.from(new Set([patterns].flat()));
76
+ assertPatternsInput(flattenedPatterns);
77
+ return flattenedPatterns;
78
+ };
79
+ const checkCwdOption = (cwd) => {
80
+ if (!cwd) {
81
+ return;
82
+ }
83
+ let stat;
84
+ try {
85
+ stat = fs.statSync(cwd);
86
+ }
87
+ catch (_error) {
88
+ throw new Error(`The \`cwd\` option must point to an existing directory: ${cwd}`);
89
+ }
90
+ if (!stat.isDirectory()) {
91
+ throw new Error("The `cwd` option must be a path to a directory");
92
+ }
93
+ };
94
+ const normalizeOptions = (options = {}) => {
95
+ const resolvedCwd = options.cwd ? toPath(options.cwd) : undefined;
96
+ const normalizedOptions = {
97
+ ...options,
98
+ ignore: options.ignore ?? [],
99
+ expandDirectories: options.expandDirectories ?? true,
100
+ cwd: resolvedCwd,
101
+ };
102
+ if (resolvedCwd) {
103
+ checkCwdOption(resolvedCwd);
104
+ }
105
+ return normalizedOptions;
106
+ };
107
+ const normalizeArguments = (fn) => (patterns, options) => fn(toPatternsArray(patterns), normalizeOptions(options || {}));
108
+ const getIgnoreFilesPatterns = (options) => {
109
+ const { ignoreFiles, gitignore } = options;
110
+ const patterns = ignoreFiles ? toPatternsArray(ignoreFiles) : [];
111
+ if (gitignore) {
112
+ patterns.push(GITIGNORE_FILES_PATTERN);
113
+ }
114
+ return patterns;
115
+ };
116
+ const getFilter = async (options) => {
117
+ const ignoreFilesPatterns = getIgnoreFilesPatterns(options);
118
+ const isIgnoredFn = ignoreFilesPatterns.length > 0
119
+ ? await isIgnoredByIgnoreFiles(ignoreFilesPatterns, options)
120
+ : false;
121
+ return createFilterFunction(isIgnoredFn);
122
+ };
123
+ // No-op predicate for when no ignore filtering is needed
124
+ const noOpPredicate = () => false;
125
+ const createFilterFunction = (isIgnored) => {
126
+ const seen = new Set();
127
+ const ignorePredicate = isIgnored === false ? noOpPredicate : isIgnored;
128
+ return (fastGlobResult) => {
129
+ let pathKey;
130
+ if (typeof fastGlobResult === "string") {
131
+ pathKey = fastGlobResult;
132
+ }
133
+ else {
134
+ const entry = fastGlobResult;
135
+ if (!entry.path) {
136
+ // Entry without path is invalid - skip it
137
+ return false;
138
+ }
139
+ pathKey = entry.path;
140
+ }
141
+ // Normalize to POSIX for consistent cross-platform behavior
142
+ pathKey = slash(nodePath.normalize(pathKey));
143
+ if (seen.has(pathKey) || ignorePredicate(pathKey)) {
144
+ return false;
145
+ }
146
+ seen.add(pathKey);
147
+ return true;
148
+ };
149
+ };
150
+ const unionFastGlobResults = (results, filter) => results.flat().filter((fastGlobResult) => filter(fastGlobResult));
151
+ const convertNegativePatterns = (patterns, options) => {
152
+ const tasks = [];
153
+ let localPatterns = patterns;
154
+ while (localPatterns.length > 0) {
155
+ const index = localPatterns.findIndex((pattern) => isNegativePattern(pattern));
156
+ if (index === -1) {
157
+ tasks.push({ patterns: localPatterns, options });
158
+ break;
159
+ }
160
+ const ignorePattern = localPatterns[index].slice(1);
161
+ // Create immutable copies for all existing tasks
162
+ for (let i = 0; i < tasks.length; i++) {
163
+ tasks[i] = {
164
+ ...tasks[i],
165
+ options: {
166
+ ...tasks[i].options,
167
+ ignore: [...(tasks[i].options.ignore ?? []), ignorePattern],
168
+ },
169
+ };
170
+ }
171
+ if (index !== 0) {
172
+ tasks.push({
173
+ patterns: localPatterns.slice(0, index),
174
+ options: {
175
+ ...options,
176
+ ignore: [...(options.ignore ?? []), ignorePattern],
177
+ },
178
+ });
179
+ }
180
+ localPatterns = localPatterns.slice(index + 1);
181
+ }
182
+ return tasks;
183
+ };
184
+ const normalizeExpandDirectoriesOption = (options, cwd) => {
185
+ const result = {};
186
+ if (cwd) {
187
+ result.cwd = cwd;
188
+ }
189
+ if (Array.isArray(options)) {
190
+ result.files = options;
191
+ }
192
+ else if (typeof options === "object" && options !== null) {
193
+ if ("files" in options)
194
+ result.files = options.files;
195
+ if ("extensions" in options)
196
+ result.extensions = options.extensions;
197
+ }
198
+ return result;
199
+ };
200
+ const generateTasks = async (patterns, options) => {
201
+ const globTasks = convertNegativePatterns(patterns, options);
202
+ const { cwd, expandDirectories } = options;
203
+ if (!expandDirectories) {
204
+ return globTasks;
205
+ }
206
+ const directoryToGlobOptions = normalizeExpandDirectoriesOption(expandDirectories, cwd ? toPath(cwd) : cwd);
207
+ return Promise.all(globTasks.map(async (task) => {
208
+ let { patterns, options } = task;
209
+ [patterns, options.ignore] = await Promise.all([
210
+ directoryToGlob(patterns, directoryToGlobOptions),
211
+ directoryToGlob(options.ignore, {
212
+ cwd: cwd ? toPath(cwd) : cwd,
213
+ }),
214
+ ]);
215
+ return { patterns, options };
216
+ }));
217
+ };
218
+ /**
219
+ * Find files and directories using glob patterns.
220
+ *
221
+ * Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
222
+ *
223
+ * @param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
224
+ * @param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
225
+ * @returns The matching paths.
226
+ */
227
+ export const glob = normalizeArguments(async (patterns, options) => {
228
+ const [tasks, filter] = await Promise.all([
229
+ generateTasks(patterns, options),
230
+ getFilter(options),
231
+ ]);
232
+ const results = await Promise.all(tasks.map((task) => fg(task.patterns, convertOptionsForFastGlob(task.options))));
233
+ return unionFastGlobResults(results, filter);
234
+ });
235
+ // Helper function to convert our Options to fast-glob compatible options
236
+ const convertOptionsForFastGlob = (options) => {
237
+ const { cwd, ...rest } = options;
238
+ return {
239
+ ...rest,
240
+ cwd: cwd ? toPath(cwd) : undefined,
241
+ };
242
+ };
243
+ const defaultIgnoredDirectories = [
244
+ "**/node_modules",
245
+ "**/flow-typed",
246
+ "**/coverage",
247
+ "**/.git",
248
+ ];
249
+ const ignoreFilesGlobOptions = {
250
+ absolute: true,
251
+ dot: true,
252
+ };
253
+ const GITIGNORE_FILES_PATTERN = "**/.gitignore";
254
+ // Apply base path to gitignore patterns based on .gitignore spec 2.22.1
255
+ // https://git-scm.com/docs/gitignore#_pattern_format
256
+ // See also https://github.com/sindresorhus/globby/issues/146
257
+ const applyBaseToPattern = (pattern, base) => {
258
+ if (!base) {
259
+ return pattern;
260
+ }
261
+ const isNegative = isNegativePattern(pattern);
262
+ const cleanPattern = isNegative ? pattern.slice(1) : pattern;
263
+ // Check if pattern has non-trailing slashes
264
+ const slashIndex = cleanPattern.indexOf("/");
265
+ const hasNonTrailingSlash = slashIndex !== -1 && slashIndex !== cleanPattern.length - 1;
266
+ let result;
267
+ if (!hasNonTrailingSlash) {
268
+ // "If there is no separator at the beginning or middle of the pattern,
269
+ // then the pattern may also match at any level below the .gitignore level."
270
+ // So patterns like '*.log' or 'temp' or 'build/' (trailing slash) match recursively.
271
+ result = path.posix.join(base, "**", cleanPattern);
272
+ }
273
+ else if (cleanPattern.startsWith("/")) {
274
+ // "If there is a separator at the beginning [...] of the pattern,
275
+ // then the pattern is relative to the directory level of the particular .gitignore file itself."
276
+ // Leading slash anchors the pattern to the .gitignore's directory.
277
+ result = path.posix.join(base, cleanPattern.slice(1));
278
+ }
279
+ else {
280
+ // "If there is a separator [...] middle [...] of the pattern,
281
+ // then the pattern is relative to the directory level of the particular .gitignore file itself."
282
+ // Patterns like 'src/foo' are relative to the .gitignore's directory.
283
+ result = path.posix.join(base, cleanPattern);
284
+ }
285
+ return isNegative ? `!${result}` : result;
286
+ };
287
+ const parseIgnoreFile = (file, cwd) => {
288
+ const base = slash(path.relative(cwd, path.dirname(file.filePath)));
289
+ const patterns = [];
290
+ for (const raw of file.content.split(/\r?\n/)) {
291
+ if (raw === "")
292
+ continue; // blank line
293
+ if (raw.startsWith("#"))
294
+ continue; // comment line (only when not escaped)
295
+ const line = raw; // preserve escapes like \# and \ for Ignore engine
296
+ patterns.push(applyBaseToPattern(line, base));
297
+ }
298
+ return patterns;
299
+ };
300
+ const toRelativePath = (fileOrDirectory, cwd) => {
301
+ const abs = path.isAbsolute(fileOrDirectory)
302
+ ? fileOrDirectory
303
+ : path.resolve(cwd, fileOrDirectory);
304
+ const rel = path.relative(cwd, abs);
305
+ if (rel.startsWith("..") || path.isAbsolute(rel))
306
+ return undefined;
307
+ return rel.startsWith("./") ? rel.slice(2) : rel;
308
+ };
309
+ const getIsIgnoredPredicate = (files, cwd) => {
310
+ // Sort files by path depth (ascending) so deeper .gitignore files override shallower ones
311
+ const sortedFiles = [...files].sort((a, b) => {
312
+ const depthA = a.filePath.split(nodePath.sep).length;
313
+ const depthB = b.filePath.split(nodePath.sep).length;
314
+ return depthA - depthB;
315
+ });
316
+ // Generate cache key using file paths + content hash
317
+ const hashString = (s) => {
318
+ // FNV-1a 32-bit
319
+ let h = 0x811c9dc5;
320
+ for (let i = 0; i < s.length; i++) {
321
+ h ^= s.charCodeAt(i);
322
+ h += (h << 1) + (h << 4) + (h << 7) + (h << 8) + (h << 24);
323
+ }
324
+ // force to uint32 and hex
325
+ return (h >>> 0).toString(16);
326
+ };
327
+ const cacheKey = `${cwd}|` +
328
+ sortedFiles.map((f) => `${f.filePath}:${hashString(f.content)}`).join("|");
329
+ const now = Date.now();
330
+ const cached = ignoreCache.get(cacheKey);
331
+ let patterns;
332
+ if (cached && now - cached.timestamp < CACHE_TTL) {
333
+ patterns = cached.patterns;
334
+ }
335
+ else {
336
+ patterns = sortedFiles.flatMap((file) => parseIgnoreFile(file, cwd));
337
+ ignoreCache.set(cacheKey, { patterns, timestamp: now });
338
+ }
339
+ const ignoreInstance = new Ignore().add(patterns);
340
+ return (fileOrDirectory) => {
341
+ let fileOrDirectoryAsPath = toPath(fileOrDirectory);
342
+ fileOrDirectoryAsPath = toRelativePath(fileOrDirectoryAsPath, cwd);
343
+ // If path is outside cwd (undefined), it can't be ignored by patterns in cwd
344
+ if (fileOrDirectoryAsPath === undefined) {
345
+ return false;
346
+ }
347
+ return fileOrDirectoryAsPath
348
+ ? ignoreInstance.ignores(slash(fileOrDirectoryAsPath))
349
+ : false;
350
+ };
351
+ };
352
+ const normalizeIgnoreOptions = (options = {}) => ({
353
+ cwd: options.cwd ? toPath(options.cwd) : process.cwd(),
354
+ suppressErrors: Boolean(options.suppressErrors),
355
+ deep: typeof options.deep === "number" ? options.deep : Number.POSITIVE_INFINITY,
356
+ ignore: [...(options.ignore ?? []), ...defaultIgnoredDirectories],
357
+ });
358
+ const isIgnoredByIgnoreFiles = async (patterns, options) => {
359
+ const { cwd, suppressErrors, deep, ignore } = normalizeIgnoreOptions(options);
360
+ const paths = await fg(patterns, {
361
+ cwd,
362
+ suppressErrors,
363
+ deep,
364
+ ignore: ignore,
365
+ ...ignoreFilesGlobOptions,
366
+ });
367
+ const files = await Promise.all(paths.map(async (filePath) => ({
368
+ filePath,
369
+ content: await readFile(filePath, "utf8"),
370
+ })));
371
+ return getIsIgnoredPredicate(files, cwd);
372
+ };
373
+ /**
374
+ * Check if a pattern is negative (starts with '!')
375
+ */
376
+ const isNegativePattern = (pattern) => pattern[0] === "!";
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Modern TypeScript implementation of node-ignore
3
+ * Based on https://github.com/kaelzhang/node-ignore
4
+ */
5
+ interface TestResult {
6
+ ignored: boolean;
7
+ unignored: boolean;
8
+ rule?: IgnoreRule;
9
+ }
10
+ interface PatternObject {
11
+ pattern: string;
12
+ mark?: boolean;
13
+ }
14
+ declare class IgnoreRule {
15
+ readonly pattern: string;
16
+ readonly mark?: boolean;
17
+ readonly negative: boolean;
18
+ private readonly ignoreCase;
19
+ private readonly regexPrefix;
20
+ private _regex?;
21
+ private _checkRegex?;
22
+ constructor(pattern: string, mark: boolean | undefined, _body: string, ignoreCase: boolean, negative: boolean, regexPrefix: string);
23
+ get regex(): RegExp;
24
+ get checkRegex(): RegExp;
25
+ private compileRegex;
26
+ }
27
+ interface IgnoreOptions {
28
+ ignorecase?: boolean;
29
+ ignoreCase?: boolean;
30
+ allowRelativePaths?: boolean;
31
+ }
32
+ export declare class Ignore {
33
+ private readonly _rules;
34
+ private readonly _strictPathCheck;
35
+ private _ignoreCache;
36
+ private _testCache;
37
+ /**
38
+ * Create a new Ignore instance
39
+ * @param options - Configuration options
40
+ * @param options.ignorecase - Whether to use case-insensitive matching (default: true)
41
+ * @param options.ignoreCase - Alias for ignorecase
42
+ * @param options.allowRelativePaths - Allow relative paths like './' and '../' (default: false)
43
+ */
44
+ constructor({ ignorecase, ignoreCase, allowRelativePaths, }?: IgnoreOptions);
45
+ private _initCache;
46
+ /**
47
+ * Clear all internal caches
48
+ */
49
+ clearCache(): this;
50
+ /**
51
+ * Add ignore patterns
52
+ * @param pattern - Pattern(s) to add
53
+ * @returns This instance for chaining
54
+ */
55
+ add(pattern: string | string[] | Ignore | PatternObject): this;
56
+ /**
57
+ * Legacy alias for add()
58
+ * @deprecated Use add() instead
59
+ */
60
+ addPattern(pattern: string | string[] | Ignore | PatternObject): this;
61
+ private _test;
62
+ /**
63
+ * Check if a path is ignored (Git check-ignore compatible)
64
+ * @param path - The path to check
65
+ * @returns TestResult with ignored status and matched rule
66
+ */
67
+ checkIgnore(path: string): TestResult;
68
+ private _t;
69
+ /**
70
+ * Check if a path is ignored
71
+ * @param path - The path to check
72
+ * @returns True if the path is ignored
73
+ */
74
+ ignores(path: string): boolean;
75
+ /**
76
+ * Create a filter function that returns true for non-ignored paths
77
+ * @returns Filter function
78
+ */
79
+ createFilter(): (path: string) => boolean;
80
+ /**
81
+ * Filter an array of paths, returning only non-ignored paths
82
+ * @param paths - Paths to filter
83
+ * @returns Array of non-ignored paths
84
+ */
85
+ filter(paths: string | string[]): string[];
86
+ /**
87
+ * Test if a path is ignored
88
+ * @param path - The path to test
89
+ * @returns TestResult with ignored status and matched rule
90
+ */
91
+ test(path: string): TestResult;
92
+ /**
93
+ * Compile a pattern to a regular expression
94
+ * @param pattern - The pattern to compile
95
+ * @returns Compiled regular expression
96
+ */
97
+ compile(pattern: string): RegExp;
98
+ }
99
+ declare const factory: {
100
+ (options?: IgnoreOptions): Ignore;
101
+ default: /*elided*/ any;
102
+ };
103
+ export default factory;
104
+ //# sourceMappingURL=ignore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ignore.d.ts","sourceRoot":"","sources":["../../source/utils/ignore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqWH,UAAU,UAAU;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,cAAM,UAAU;IACd,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,IAAI,CAAC,EAAE,OAAO,CAAC;IAC/B,SAAgB,QAAQ,EAAE,OAAO,CAAC;IAElC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAU;IACrC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IAGrC,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,WAAW,CAAC,CAAS;gBAG3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,OAAO,GAAG,SAAS,EACzB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,OAAO,EACnB,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,MAAM;IASrB,IAAI,KAAK,IAAI,MAAM,CAKlB;IAED,IAAI,UAAU,IAAI,MAAM,CAKvB;IAED,OAAO,CAAC,YAAY;CAWrB;AA0MD,UAAU,aAAa;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAU;IAC3C,OAAO,CAAC,YAAY,CAAkC;IACtD,OAAO,CAAC,UAAU,CAAkC;IAEpD;;;;;;OAMG;gBACS,EACV,UAAiB,EACjB,UAAuB,EACvB,kBAA0B,GAC3B,GAAE,aAAkB;IASrB,OAAO,CAAC,UAAU;IAQlB;;OAEG;IACH,UAAU,IAAI,IAAI;IAKlB;;;;OAIG;IACH,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,aAAa,GAAG,IAAI;IAW9D;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,aAAa,GAAG,IAAI;IAKrE,OAAO,CAAC,KAAK;IAuBb;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IA0BrC,OAAO,CAAC,EAAE;IAgDV;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI9B;;;OAGG;IACH,YAAY,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO;IAIzC;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE;IAI1C;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU;IAI9B;;;;OAIG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAKjC;AAED,QAAA,MAAM,OAAO;eAAc,aAAa,GAAG,MAAM;;CAAuB,CAAC;AA6BzE,eAAe,OAAO,CAAC"}