kiriya 0.1.0

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 (282) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/LICENSE +21 -0
  3. package/README.md +87 -0
  4. package/dist/src/config/clean-rules.js +39 -0
  5. package/dist/src/config/config-keys.js +24 -0
  6. package/dist/src/config/dependency-directories.js +16 -0
  7. package/dist/src/config/modules.js +38 -0
  8. package/dist/src/config/protected-paths.js +32 -0
  9. package/dist/src/config/rebuildable-directories.js +20 -0
  10. package/dist/src/core/application/command-registry.js +57 -0
  11. package/dist/src/core/application/config-values.js +33 -0
  12. package/dist/src/core/application/path-guard.js +69 -0
  13. package/dist/src/core/application/paths.js +77 -0
  14. package/dist/src/core/application/plugin-loader.js +100 -0
  15. package/dist/src/core/application/process-ending.js +28 -0
  16. package/dist/src/core/application/root-scope.js +123 -0
  17. package/dist/src/core/application/safety.js +26 -0
  18. package/dist/src/core/application/text-input.js +44 -0
  19. package/dist/src/core/application/walk.js +34 -0
  20. package/dist/src/core/domain/command.js +8 -0
  21. package/dist/src/core/domain/encodings.js +70 -0
  22. package/dist/src/core/domain/errors.js +49 -0
  23. package/dist/src/core/domain/glob.js +57 -0
  24. package/dist/src/core/domain/global-options.js +10 -0
  25. package/dist/src/core/domain/input-schema.js +54 -0
  26. package/dist/src/core/domain/message.js +7 -0
  27. package/dist/src/core/domain/module.js +2 -0
  28. package/dist/src/core/domain/names.js +22 -0
  29. package/dist/src/core/domain/ports/clipboard.js +2 -0
  30. package/dist/src/core/domain/ports/clock.js +2 -0
  31. package/dist/src/core/domain/ports/command-catalog.js +2 -0
  32. package/dist/src/core/domain/ports/compression.js +2 -0
  33. package/dist/src/core/domain/ports/config-store.js +2 -0
  34. package/dist/src/core/domain/ports/confirmation.js +2 -0
  35. package/dist/src/core/domain/ports/environment.js +2 -0
  36. package/dist/src/core/domain/ports/file-content.js +2 -0
  37. package/dist/src/core/domain/ports/file-system.js +2 -0
  38. package/dist/src/core/domain/ports/hasher.js +2 -0
  39. package/dist/src/core/domain/ports/network.js +2 -0
  40. package/dist/src/core/domain/ports/opener.js +2 -0
  41. package/dist/src/core/domain/ports/passthrough.js +2 -0
  42. package/dist/src/core/domain/ports/plugin-inventory.js +2 -0
  43. package/dist/src/core/domain/ports/plugin-source.js +2 -0
  44. package/dist/src/core/domain/ports/port-table.js +2 -0
  45. package/dist/src/core/domain/ports/process-runner.js +2 -0
  46. package/dist/src/core/domain/ports/process-table.js +2 -0
  47. package/dist/src/core/domain/ports/protected-paths.js +2 -0
  48. package/dist/src/core/domain/ports/random-source.js +2 -0
  49. package/dist/src/core/domain/ports/standard-input.js +2 -0
  50. package/dist/src/core/domain/ports/system-info.js +2 -0
  51. package/dist/src/core/domain/ports/trash.js +2 -0
  52. package/dist/src/core/domain/secrets.js +59 -0
  53. package/dist/src/core/domain/targets.js +41 -0
  54. package/dist/src/core/domain/text-case.js +39 -0
  55. package/dist/src/core/domain/values/bytes.js +13 -0
  56. package/dist/src/core/domain/view.js +2 -0
  57. package/dist/src/core/infrastructure/node/can-listen.js +10 -0
  58. package/dist/src/core/infrastructure/node/closed-standard-input.adapter.js +12 -0
  59. package/dist/src/core/infrastructure/node/config-location.js +27 -0
  60. package/dist/src/core/infrastructure/node/fs-errors.js +22 -0
  61. package/dist/src/core/infrastructure/node/json-config-store.adapter.js +69 -0
  62. package/dist/src/core/infrastructure/node/node-compression.adapter.js +82 -0
  63. package/dist/src/core/infrastructure/node/node-environment.adapter.js +21 -0
  64. package/dist/src/core/infrastructure/node/node-file-content.adapter.js +99 -0
  65. package/dist/src/core/infrastructure/node/node-file-system.adapter.js +169 -0
  66. package/dist/src/core/infrastructure/node/node-hasher.adapter.js +32 -0
  67. package/dist/src/core/infrastructure/node/node-network.adapter.js +168 -0
  68. package/dist/src/core/infrastructure/node/node-plugin-source.adapter.js +89 -0
  69. package/dist/src/core/infrastructure/node/node-process-runner.adapter.js +48 -0
  70. package/dist/src/core/infrastructure/node/node-random-source.adapter.js +7 -0
  71. package/dist/src/core/infrastructure/node/node-standard-input.adapter.js +24 -0
  72. package/dist/src/core/infrastructure/node/node-system-info.adapter.js +63 -0
  73. package/dist/src/core/infrastructure/node/process-signals.js +51 -0
  74. package/dist/src/core/infrastructure/node/run-program.js +65 -0
  75. package/dist/src/core/infrastructure/node/system-clock.adapter.js +22 -0
  76. package/dist/src/core/infrastructure/node/typed-programs.js +45 -0
  77. package/dist/src/core/infrastructure/platform/linux/freedesktop-trash.adapter.js +115 -0
  78. package/dist/src/core/infrastructure/platform/linux/linux-clipboard.adapter.js +70 -0
  79. package/dist/src/core/infrastructure/platform/linux/linux-opener.adapter.js +21 -0
  80. package/dist/src/core/infrastructure/platform/linux/linux-port-table.adapter.js +97 -0
  81. package/dist/src/core/infrastructure/platform/linux/linux-process-table.adapter.js +61 -0
  82. package/dist/src/core/infrastructure/platform/macos/macos-clipboard.adapter.js +29 -0
  83. package/dist/src/core/infrastructure/platform/macos/macos-opener.adapter.js +13 -0
  84. package/dist/src/core/infrastructure/platform/macos/macos-port-table.adapter.js +86 -0
  85. package/dist/src/core/infrastructure/platform/macos/macos-process-table.adapter.js +62 -0
  86. package/dist/src/core/infrastructure/platform/macos/macos-trash.adapter.js +64 -0
  87. package/dist/src/core/infrastructure/platform/windows/system32.js +6 -0
  88. package/dist/src/core/infrastructure/platform/windows/windows-clipboard.adapter.js +50 -0
  89. package/dist/src/core/infrastructure/platform/windows/windows-opener.adapter.js +11 -0
  90. package/dist/src/core/infrastructure/platform/windows/windows-port-table.adapter.js +38 -0
  91. package/dist/src/core/infrastructure/platform/windows/windows-process-table.adapter.js +134 -0
  92. package/dist/src/core/infrastructure/platform/windows/windows-trash.adapter.js +86 -0
  93. package/dist/src/core/presentation/cli/argv.js +83 -0
  94. package/dist/src/core/presentation/cli/cli-application.js +201 -0
  95. package/dist/src/core/presentation/cli/cli-view-format.js +46 -0
  96. package/dist/src/core/presentation/cli/help.js +202 -0
  97. package/dist/src/core/presentation/cli/json-output.js +28 -0
  98. package/dist/src/core/presentation/cli/style.js +21 -0
  99. package/dist/src/core/presentation/cli/suggest.js +25 -0
  100. package/dist/src/core/presentation/cli/terminal-confirmation.js +63 -0
  101. package/dist/src/core/presentation/ended-processes.js +18 -0
  102. package/dist/src/core/presentation/i18n/translator.js +23 -0
  103. package/dist/src/core/presentation/list-preview.js +10 -0
  104. package/dist/src/core/presentation/mcp/elicitation.js +55 -0
  105. package/dist/src/core/presentation/mcp/mcp-application.js +60 -0
  106. package/dist/src/core/presentation/mcp/mcp-confirmation.js +59 -0
  107. package/dist/src/core/presentation/mcp/mcp-server.js +355 -0
  108. package/dist/src/core/presentation/mcp/protocol.js +32 -0
  109. package/dist/src/core/presentation/mcp/request-state.js +66 -0
  110. package/dist/src/core/presentation/mcp/tool-definitions.js +149 -0
  111. package/dist/src/core/presentation/mcp/tool-results.js +56 -0
  112. package/dist/src/i18n/locales/en.js +827 -0
  113. package/dist/src/main.js +154 -0
  114. package/dist/src/modules/archive/application/archive-sources.js +55 -0
  115. package/dist/src/modules/archive/application/create-tar.use-case.js +123 -0
  116. package/dist/src/modules/archive/application/create-zip.use-case.js +106 -0
  117. package/dist/src/modules/archive/application/extract-tar.use-case.js +240 -0
  118. package/dist/src/modules/archive/application/extract-zip.use-case.js +181 -0
  119. package/dist/src/modules/archive/application/tar-reader.js +45 -0
  120. package/dist/src/modules/archive/application/zip-reader.js +57 -0
  121. package/dist/src/modules/archive/archive.module.js +27 -0
  122. package/dist/src/modules/archive/domain/crc32.js +18 -0
  123. package/dist/src/modules/archive/domain/tar-format.js +97 -0
  124. package/dist/src/modules/archive/domain/tar-stream.js +223 -0
  125. package/dist/src/modules/archive/domain/zip-format.js +158 -0
  126. package/dist/src/modules/archive/presentation/tar.view.js +17 -0
  127. package/dist/src/modules/archive/presentation/untar.view.js +30 -0
  128. package/dist/src/modules/archive/presentation/unzip.view.js +24 -0
  129. package/dist/src/modules/archive/presentation/zip.view.js +17 -0
  130. package/dist/src/modules/clip/application/copy-text.use-case.js +43 -0
  131. package/dist/src/modules/clip/application/paste-text.use-case.js +25 -0
  132. package/dist/src/modules/clip/clip.module.js +16 -0
  133. package/dist/src/modules/clip/presentation/clip.views.js +7 -0
  134. package/dist/src/modules/completion/application/print-script.use-case.js +38 -0
  135. package/dist/src/modules/completion/application/suggest-words.use-case.js +37 -0
  136. package/dist/src/modules/completion/completion.module.js +14 -0
  137. package/dist/src/modules/completion/domain/scripts.js +91 -0
  138. package/dist/src/modules/completion/domain/suggest.js +134 -0
  139. package/dist/src/modules/completion/presentation/completion.views.js +6 -0
  140. package/dist/src/modules/config/application/config-commands.js +14 -0
  141. package/dist/src/modules/config/application/get-setting.use-case.js +25 -0
  142. package/dist/src/modules/config/application/list-config-keys.use-case.js +26 -0
  143. package/dist/src/modules/config/application/list-settings.use-case.js +28 -0
  144. package/dist/src/modules/config/application/set-setting.use-case.js +53 -0
  145. package/dist/src/modules/config/application/show-config-path.use-case.js +21 -0
  146. package/dist/src/modules/config/application/unset-setting.use-case.js +28 -0
  147. package/dist/src/modules/config/config.module.js +28 -0
  148. package/dist/src/modules/config/presentation/config.views.js +33 -0
  149. package/dist/src/modules/convert/application/convert-case.use-case.js +38 -0
  150. package/dist/src/modules/convert/application/convert-codecs.use-case.js +92 -0
  151. package/dist/src/modules/convert/application/convert-input.js +16 -0
  152. package/dist/src/modules/convert/application/convert-json.use-case.js +51 -0
  153. package/dist/src/modules/convert/application/convert-time.use-case.js +39 -0
  154. package/dist/src/modules/convert/application/decode-jwt.use-case.js +52 -0
  155. package/dist/src/modules/convert/convert.module.js +29 -0
  156. package/dist/src/modules/convert/domain/json-syntax.js +135 -0
  157. package/dist/src/modules/convert/domain/jwt.js +29 -0
  158. package/dist/src/modules/convert/domain/moments.js +20 -0
  159. package/dist/src/modules/convert/presentation/convert.views.js +44 -0
  160. package/dist/src/modules/docker/application/clean-engine.use-case.js +77 -0
  161. package/dist/src/modules/docker/application/compose-project.js +45 -0
  162. package/dist/src/modules/docker/application/docker-engine.js +40 -0
  163. package/dist/src/modules/docker/application/list-containers.use-case.js +69 -0
  164. package/dist/src/modules/docker/application/run-compose.use-case.js +83 -0
  165. package/dist/src/modules/docker/application/show-logs.use-case.js +51 -0
  166. package/dist/src/modules/docker/application/stop-project.use-case.js +56 -0
  167. package/dist/src/modules/docker/docker.module.js +23 -0
  168. package/dist/src/modules/docker/domain/compose-file.js +105 -0
  169. package/dist/src/modules/docker/domain/engine-output.js +65 -0
  170. package/dist/src/modules/docker/presentation/docker.views.js +63 -0
  171. package/dist/src/modules/doctor/application/run-checks.use-case.js +128 -0
  172. package/dist/src/modules/doctor/doctor.module.js +13 -0
  173. package/dist/src/modules/doctor/domain/versions.js +22 -0
  174. package/dist/src/modules/doctor/presentation/doctor.view.js +30 -0
  175. package/dist/src/modules/env/application/check-dotenv.use-case.js +116 -0
  176. package/dist/src/modules/env/application/inspect-path.use-case.js +71 -0
  177. package/dist/src/modules/env/application/path-entries.js +28 -0
  178. package/dist/src/modules/env/application/show-variables.use-case.js +47 -0
  179. package/dist/src/modules/env/domain/dotenv.js +62 -0
  180. package/dist/src/modules/env/env.module.js +17 -0
  181. package/dist/src/modules/env/presentation/env.views.js +43 -0
  182. package/dist/src/modules/files/application/clean-builds.use-case.js +149 -0
  183. package/dist/src/modules/files/application/compare-paths.use-case.js +127 -0
  184. package/dist/src/modules/files/application/copy-paths.use-case.js +101 -0
  185. package/dist/src/modules/files/application/create-paths.use-case.js +85 -0
  186. package/dist/src/modules/files/application/delete-paths.use-case.js +127 -0
  187. package/dist/src/modules/files/application/find-duplicates.use-case.js +105 -0
  188. package/dist/src/modules/files/application/find-files.use-case.js +131 -0
  189. package/dist/src/modules/files/application/hash-files.use-case.js +73 -0
  190. package/dist/src/modules/files/application/list-entries.use-case.js +87 -0
  191. package/dist/src/modules/files/application/measure-folders.use-case.js +102 -0
  192. package/dist/src/modules/files/application/move-entry.js +19 -0
  193. package/dist/src/modules/files/application/move-paths.use-case.js +82 -0
  194. package/dist/src/modules/files/application/read-text.use-case.js +92 -0
  195. package/dist/src/modules/files/application/rename-paths.use-case.js +184 -0
  196. package/dist/src/modules/files/application/replace-text.use-case.js +146 -0
  197. package/dist/src/modules/files/application/search-text.use-case.js +115 -0
  198. package/dist/src/modules/files/application/show-info.use-case.js +80 -0
  199. package/dist/src/modules/files/application/show-tree.use-case.js +75 -0
  200. package/dist/src/modules/files/application/sync-folders.use-case.js +162 -0
  201. package/dist/src/modules/files/application/text-files.js +46 -0
  202. package/dist/src/modules/files/application/transfers.js +35 -0
  203. package/dist/src/modules/files/domain/case-style.js +18 -0
  204. package/dist/src/modules/files/domain/filters.js +9 -0
  205. package/dist/src/modules/files/domain/sync-plan.js +35 -0
  206. package/dist/src/modules/files/domain/text-encoding.js +75 -0
  207. package/dist/src/modules/files/domain/values.js +28 -0
  208. package/dist/src/modules/files/files.module.js +70 -0
  209. package/dist/src/modules/files/presentation/clean.view.js +15 -0
  210. package/dist/src/modules/files/presentation/compare.view.js +50 -0
  211. package/dist/src/modules/files/presentation/copy.view.js +17 -0
  212. package/dist/src/modules/files/presentation/delete.view.js +16 -0
  213. package/dist/src/modules/files/presentation/dupes.view.js +20 -0
  214. package/dist/src/modules/files/presentation/find.view.js +16 -0
  215. package/dist/src/modules/files/presentation/grep.view.js +27 -0
  216. package/dist/src/modules/files/presentation/hash.view.js +15 -0
  217. package/dist/src/modules/files/presentation/info.view.js +36 -0
  218. package/dist/src/modules/files/presentation/list.view.js +17 -0
  219. package/dist/src/modules/files/presentation/move.view.js +14 -0
  220. package/dist/src/modules/files/presentation/new.view.js +8 -0
  221. package/dist/src/modules/files/presentation/read.view.js +6 -0
  222. package/dist/src/modules/files/presentation/rename.view.js +16 -0
  223. package/dist/src/modules/files/presentation/replace.view.js +26 -0
  224. package/dist/src/modules/files/presentation/size.view.js +24 -0
  225. package/dist/src/modules/files/presentation/sync.view.js +37 -0
  226. package/dist/src/modules/files/presentation/tree.view.js +22 -0
  227. package/dist/src/modules/gen/application/gen-options.js +18 -0
  228. package/dist/src/modules/gen/application/generate-passwords.use-case.js +39 -0
  229. package/dist/src/modules/gen/application/generate-tokens.use-case.js +38 -0
  230. package/dist/src/modules/gen/application/generate-ulids.use-case.js +40 -0
  231. package/dist/src/modules/gen/application/generate-uuids.use-case.js +32 -0
  232. package/dist/src/modules/gen/domain/identifiers.js +65 -0
  233. package/dist/src/modules/gen/domain/secrets.js +43 -0
  234. package/dist/src/modules/gen/gen.module.js +20 -0
  235. package/dist/src/modules/git/application/fetch-repositories.use-case.js +50 -0
  236. package/dist/src/modules/git/application/git-client.js +62 -0
  237. package/dist/src/modules/git/application/pull-repositories.use-case.js +67 -0
  238. package/dist/src/modules/git/application/repositories.js +67 -0
  239. package/dist/src/modules/git/application/show-status.use-case.js +49 -0
  240. package/dist/src/modules/git/application/switch-branch.use-case.js +118 -0
  241. package/dist/src/modules/git/domain/repository-status.js +37 -0
  242. package/dist/src/modules/git/git.module.js +25 -0
  243. package/dist/src/modules/git/presentation/git.views.js +100 -0
  244. package/dist/src/modules/net/application/check-connection.use-case.js +71 -0
  245. package/dist/src/modules/net/application/list-addresses.use-case.js +29 -0
  246. package/dist/src/modules/net/application/lookup-name.use-case.js +55 -0
  247. package/dist/src/modules/net/net.module.js +17 -0
  248. package/dist/src/modules/net/presentation/net.views.js +39 -0
  249. package/dist/src/modules/open/application/open-target.use-case.js +53 -0
  250. package/dist/src/modules/open/domain/targets.js +45 -0
  251. package/dist/src/modules/open/open.module.js +12 -0
  252. package/dist/src/modules/open/presentation/open.view.js +6 -0
  253. package/dist/src/modules/port/application/end-port-owners.use-case.js +68 -0
  254. package/dist/src/modules/port/application/find-free-port.use-case.js +40 -0
  255. package/dist/src/modules/port/application/find-listeners.use-case.js +34 -0
  256. package/dist/src/modules/port/application/port-owners.js +25 -0
  257. package/dist/src/modules/port/domain/port-number.js +8 -0
  258. package/dist/src/modules/port/port.module.js +17 -0
  259. package/dist/src/modules/port/presentation/port.views.js +27 -0
  260. package/dist/src/modules/proc/application/end-processes.use-case.js +77 -0
  261. package/dist/src/modules/proc/application/find-processes.use-case.js +50 -0
  262. package/dist/src/modules/proc/application/list-processes.use-case.js +41 -0
  263. package/dist/src/modules/proc/application/show-tree.use-case.js +40 -0
  264. package/dist/src/modules/proc/domain/process-tree.js +55 -0
  265. package/dist/src/modules/proc/presentation/proc.views.js +28 -0
  266. package/dist/src/modules/proc/proc.module.js +19 -0
  267. package/dist/src/modules/sys/application/create-report.use-case.js +30 -0
  268. package/dist/src/modules/sys/application/find-tools.use-case.js +20 -0
  269. package/dist/src/modules/sys/application/machine-facts.js +44 -0
  270. package/dist/src/modules/sys/application/show-info.use-case.js +29 -0
  271. package/dist/src/modules/sys/domain/tools.js +17 -0
  272. package/dist/src/modules/sys/presentation/sys.views.js +67 -0
  273. package/dist/src/modules/sys/sys.module.js +17 -0
  274. package/dist/src/modules/wait/application/poll.js +26 -0
  275. package/dist/src/modules/wait/application/wait-file.use-case.js +55 -0
  276. package/dist/src/modules/wait/application/wait-port.use-case.js +76 -0
  277. package/dist/src/modules/wait/application/wait-url.use-case.js +71 -0
  278. package/dist/src/modules/wait/domain/reasons.js +14 -0
  279. package/dist/src/modules/wait/domain/wait-input.js +50 -0
  280. package/dist/src/modules/wait/presentation/wait.views.js +31 -0
  281. package/dist/src/modules/wait/wait.module.js +21 -0
  282. package/package.json +57 -0
@@ -0,0 +1,82 @@
1
+ import path from "node:path";
2
+ import { refuseProtected, requireTypedConfirmation } from "../../../core/application/safety.js";
3
+ import { done, preview } from "../../../core/domain/command.js";
4
+ import { KiriyaError } from "../../../core/domain/errors.js";
5
+ import { message } from "../../../core/domain/message.js";
6
+ import { transferInput } from "./copy-paths.use-case.js";
7
+ import { moveEntry } from "./move-entry.js";
8
+ import { planTransfers } from "./transfers.js";
9
+ export const moveSpec = {
10
+ id: "files.move",
11
+ summary: "files.move.summary",
12
+ examples: [
13
+ "kiriya files move draft.md docs/",
14
+ "kiriya files move readme.md README.md",
15
+ 'kiriya files move "*.log" D:/archive/logs/ --dry-run',
16
+ ],
17
+ // Replaced destinations go to the trash, so even --overwrite can be undone.
18
+ safety: "write",
19
+ idempotent: false,
20
+ usesNetwork: false,
21
+ runsUserCommands: false,
22
+ input: transferInput,
23
+ };
24
+ export class MovePaths {
25
+ fileSystem;
26
+ trash;
27
+ protectedPaths;
28
+ environment;
29
+ spec = moveSpec;
30
+ constructor(fileSystem, trash, protectedPaths, environment) {
31
+ this.fileSystem = fileSystem;
32
+ this.trash = trash;
33
+ this.protectedPaths = protectedPaths;
34
+ this.environment = environment;
35
+ }
36
+ async execute(input, context) {
37
+ const windows = this.environment.os === "windows";
38
+ const transfers = await planTransfers(this.fileSystem, input.sources, input.target, context.cwd, windows);
39
+ refuseProtected(this.protectedPaths, transfers.map((transfer) => transfer.source), context.cwd);
40
+ const planned = transfers.map((transfer) => ({ ...transfer, outcome: "planned", reason: null }));
41
+ const conflicts = planned.filter((item) => item.conflict);
42
+ const data = { items: planned, conflicts: conflicts.length };
43
+ if (input.dryRun)
44
+ return preview(data, "");
45
+ if (conflicts.length > 0) {
46
+ if (!input.overwrite) {
47
+ return done(data, {
48
+ failures: conflicts.map((item) => message("core.fs.exists", { path: item.destination })),
49
+ warnings: [message("files.transfer.nothing-changed")],
50
+ });
51
+ }
52
+ const destinations = conflicts.map((item) => item.destination);
53
+ refuseProtected(this.protectedPaths, destinations, context.cwd);
54
+ const warning = message("files.move.warn-overwrite", {
55
+ count: conflicts.length,
56
+ location: message(this.trash.location),
57
+ });
58
+ await requireTypedConfirmation(context, warning, String(conflicts.length), input.confirm);
59
+ const outcomes = await this.trash.send(destinations);
60
+ const refused = outcomes.flatMap((outcome) => outcome.ok ? [] : [message("files.move.trash-failed", { path: outcome.path, reason: outcome.reason })]);
61
+ if (refused.length > 0)
62
+ return done(data, { failures: refused, warnings: [message("files.move.nothing-moved")] });
63
+ }
64
+ const items = [];
65
+ const failures = [];
66
+ for (const item of planned) {
67
+ try {
68
+ await this.fileSystem.createDirectory(path.dirname(item.destination));
69
+ await moveEntry(this.fileSystem, item.source, item.destination);
70
+ items.push({ ...item, outcome: "moved" });
71
+ }
72
+ catch (error) {
73
+ if (!(error instanceof KiriyaError))
74
+ throw error;
75
+ items.push({ ...item, outcome: "failed", reason: error.detail });
76
+ failures.push(error.detail);
77
+ }
78
+ }
79
+ return done({ ...data, items }, { failures });
80
+ }
81
+ }
82
+ //# sourceMappingURL=move-paths.use-case.js.map
@@ -0,0 +1,92 @@
1
+ import path from "node:path";
2
+ import { done } from "../../../core/domain/command.js";
3
+ import { NotFoundError, OperationFailedError, UsageError } from "../../../core/domain/errors.js";
4
+ import { RawReader } from "../../../core/domain/input-schema.js";
5
+ import { formatBytes } from "../../../core/domain/values/bytes.js";
6
+ import { MAX_TEXT_BYTES, splitLines } from "../domain/text-encoding.js";
7
+ import { readTextFile } from "./text-files.js";
8
+ export const readSpec = {
9
+ id: "files.read",
10
+ summary: "files.read.summary",
11
+ examples: [
12
+ "kiriya files read README.md",
13
+ "kiriya files read app.log --tail 50",
14
+ "kiriya files read query.sql --lines 10-20 --number",
15
+ ],
16
+ safety: "read",
17
+ idempotent: true,
18
+ usesNetwork: false,
19
+ runsUserCommands: false,
20
+ input: {
21
+ positionals: [{ name: "file", description: "files.read.arg.file", required: true, variadic: false, path: true }],
22
+ options: {
23
+ head: { type: "string", description: "files.read.option.head", valueName: "<n>" },
24
+ tail: { type: "string", description: "files.read.option.tail", valueName: "<n>" },
25
+ lines: { type: "string", description: "files.read.option.lines", valueName: "<from>-<to>" },
26
+ number: { type: "boolean", description: "files.read.option.number" },
27
+ },
28
+ parse(raw) {
29
+ const reader = new RawReader(raw);
30
+ const head = reader.string("head") === undefined ? undefined : reader.positiveInteger("head", 1);
31
+ const tail = reader.string("tail") === undefined ? undefined : reader.positiveInteger("tail", 1);
32
+ const lines = reader.string("lines");
33
+ if ([head, tail, lines].filter((value) => value !== undefined).length > 1) {
34
+ throw new UsageError("files.read.one-selection");
35
+ }
36
+ let range;
37
+ if (lines !== undefined) {
38
+ const match = /^(\d+)-(\d+)$/.exec(lines.trim());
39
+ const from = Number(match?.[1]);
40
+ const to = Number(match?.[2]);
41
+ if (match === null || from < 1 || to < 1)
42
+ throw new UsageError("files.read.lines-format");
43
+ if (to < from)
44
+ throw new UsageError("files.read.lines-order");
45
+ range = { from, to };
46
+ }
47
+ return { path: reader.positional(0) ?? "", head, tail, range, number: reader.flag("number") };
48
+ },
49
+ },
50
+ };
51
+ export class ReadText {
52
+ fileSystem;
53
+ content;
54
+ spec = readSpec;
55
+ constructor(fileSystem, content) {
56
+ this.fileSystem = fileSystem;
57
+ this.content = content;
58
+ }
59
+ async execute(input, context) {
60
+ const target = path.resolve(context.cwd, input.path);
61
+ const stat = await this.fileSystem.stat(target);
62
+ if (stat === null)
63
+ throw new NotFoundError("core.fs.not-found", { path: target });
64
+ if (stat.kind === "directory")
65
+ throw new UsageError("files.read.is-folder", { path: target });
66
+ const text = await readTextFile(this.fileSystem, this.content, target);
67
+ if (text === null) {
68
+ throw new OperationFailedError("files.read.not-text", { path: target, limit: formatBytes(MAX_TEXT_BYTES) });
69
+ }
70
+ const lines = splitLines(text.text);
71
+ let first = 1;
72
+ let last = lines.length;
73
+ if (input.head !== undefined)
74
+ last = Math.min(lines.length, input.head);
75
+ if (input.tail !== undefined)
76
+ first = Math.max(1, lines.length - input.tail + 1);
77
+ if (input.range !== undefined) {
78
+ first = input.range.from;
79
+ last = Math.min(lines.length, input.range.to);
80
+ }
81
+ return done({
82
+ path: target,
83
+ encoding: text.encoding,
84
+ first,
85
+ last,
86
+ totalLines: lines.length,
87
+ lines: lines.slice(first - 1, Math.max(first - 1, last)),
88
+ numbered: input.number,
89
+ });
90
+ }
91
+ }
92
+ //# sourceMappingURL=read-text.use-case.js.map
@@ -0,0 +1,184 @@
1
+ import path from "node:path";
2
+ import { expandPaths } from "../../../core/application/paths.js";
3
+ import { refuseProtected, requireApproval } from "../../../core/application/safety.js";
4
+ import { walk } from "../../../core/application/walk.js";
5
+ import { done, preview } from "../../../core/domain/command.js";
6
+ import { KiriyaError, NotFoundError, UsageError } from "../../../core/domain/errors.js";
7
+ import { RawReader } from "../../../core/domain/input-schema.js";
8
+ import { message } from "../../../core/domain/message.js";
9
+ import { invalidNameReason } from "../../../core/domain/names.js";
10
+ import { CASE_STYLES, renameByCase } from "../domain/case-style.js";
11
+ import { moveEntry } from "./move-entry.js";
12
+ const ONLY = ["files", "dirs"];
13
+ export const renameSpec = {
14
+ id: "files.rename",
15
+ summary: "files.rename.summary",
16
+ examples: [
17
+ "kiriya files rename notes.txt meeting-notes.txt",
18
+ "kiriya files rename src/components --case kebab --recursive",
19
+ 'kiriya files rename "photos/*.JPG" --find " " --with "-" --apply',
20
+ ],
21
+ safety: "write",
22
+ idempotent: false,
23
+ usesNetwork: false,
24
+ runsUserCommands: false,
25
+ input: {
26
+ positionals: [
27
+ { name: "paths", description: "files.rename.arg.paths", required: false, variadic: true, path: true },
28
+ ],
29
+ options: {
30
+ case: { type: "string", description: "files.rename.option.case", valueName: `<${CASE_STYLES.join("|")}>` },
31
+ find: { type: "string", description: "files.rename.option.find", valueName: "<text>" },
32
+ with: { type: "string", description: "files.rename.option.with", valueName: "<text>" },
33
+ recursive: { type: "boolean", description: "files.rename.option.recursive" },
34
+ only: { type: "string", description: "files.rename.option.only", valueName: "<files|dirs>" },
35
+ apply: { type: "boolean", description: "files.rename.option.apply" },
36
+ yes: { type: "boolean", description: "files.rename.option.yes", short: "y", terminalOnly: true },
37
+ },
38
+ parse(raw) {
39
+ const reader = new RawReader(raw);
40
+ const positionals = reader.positionalsFrom(0);
41
+ const find = reader.string("find");
42
+ const replacement = reader.string("with");
43
+ if (reader.string("case") === undefined && find === undefined) {
44
+ if (replacement !== undefined)
45
+ throw new UsageError("files.rename.find-with");
46
+ const [from, newName, ...rest] = positionals;
47
+ if (from === undefined || newName === undefined || rest.length > 0)
48
+ throw new UsageError("files.rename.usage");
49
+ return { mode: "one", path: from, newName };
50
+ }
51
+ if ((find === undefined) !== (replacement === undefined))
52
+ throw new UsageError("files.rename.find-with");
53
+ if (find === "")
54
+ throw new UsageError("files.rename.find-empty");
55
+ return {
56
+ mode: "many",
57
+ paths: positionals,
58
+ style: reader.string("case") === undefined ? undefined : reader.choice("case", CASE_STYLES, "kebab"),
59
+ find,
60
+ replacement: replacement ?? "",
61
+ recursive: reader.flag("recursive"),
62
+ only: reader.string("only") === undefined ? undefined : reader.choice("only", ONLY, "files"),
63
+ apply: reader.flag("apply"),
64
+ yes: reader.flag("yes"),
65
+ };
66
+ },
67
+ },
68
+ };
69
+ export class RenamePaths {
70
+ fileSystem;
71
+ protectedPaths;
72
+ spec = renameSpec;
73
+ constructor(fileSystem, protectedPaths) {
74
+ this.fileSystem = fileSystem;
75
+ this.protectedPaths = protectedPaths;
76
+ }
77
+ async execute(input, context) {
78
+ return input.mode === "one" ? this.renameOne(input, context) : this.renameMany(input, context);
79
+ }
80
+ async renameOne(input, context) {
81
+ const from = path.resolve(context.cwd, input.path);
82
+ if ((await this.fileSystem.lstat(from)) === null)
83
+ throw new NotFoundError("core.fs.not-found", { path: from });
84
+ const invalid = invalidNameReason(input.newName);
85
+ if (invalid !== null) {
86
+ throw new UsageError("files.rename.invalid-name", { reason: message(invalid, { name: input.newName }) });
87
+ }
88
+ refuseProtected(this.protectedPaths, [from], context.cwd);
89
+ const to = path.join(path.dirname(from), input.newName);
90
+ await moveEntry(this.fileSystem, from, to);
91
+ return done({ mode: "one", renames: [{ from, to }], problems: [], renamed: 1 });
92
+ }
93
+ async renameMany(input, context) {
94
+ const args = input.paths.length === 0 ? ["."] : input.paths;
95
+ const folderArgs = new Set(args.map((arg) => path.resolve(context.cwd, arg)));
96
+ const candidates = [];
97
+ for (const target of await expandPaths(this.fileSystem, args, context.cwd, false)) {
98
+ const isDirectory = (await this.fileSystem.lstat(target))?.kind === "directory";
99
+ // A folder named as an argument means its contents; a folder a glob matched means itself.
100
+ if (!isDirectory || !folderArgs.has(target)) {
101
+ candidates.push({ path: target, isDirectory });
102
+ continue;
103
+ }
104
+ const options = input.recursive ? { all: false } : { all: false, maxDepth: 1 };
105
+ for await (const entry of walk(this.fileSystem, target, options)) {
106
+ candidates.push({ path: entry.path, isDirectory: entry.kind === "directory" });
107
+ }
108
+ }
109
+ const renames = [];
110
+ const problems = [];
111
+ for (const candidate of candidates) {
112
+ if (input.only === "files" && candidate.isDirectory)
113
+ continue;
114
+ if (input.only === "dirs" && !candidate.isDirectory)
115
+ continue;
116
+ const name = path.basename(candidate.path);
117
+ let next = input.find === undefined ? name : name.split(input.find).join(input.replacement);
118
+ if (input.style !== undefined)
119
+ next = renameByCase(next, input.style);
120
+ if (next === name)
121
+ continue;
122
+ const invalid = invalidNameReason(next);
123
+ if (invalid !== null) {
124
+ problems.push(message("files.rename.invalid", { from: candidate.path, reason: message(invalid, { name: next }) }));
125
+ continue;
126
+ }
127
+ renames.push({ from: candidate.path, to: path.join(path.dirname(candidate.path), next) });
128
+ }
129
+ problems.push(...(await this.clashes(renames)));
130
+ const data = { mode: "many", renames, problems, renamed: 0 };
131
+ if (problems.length > 0) {
132
+ return done(data, { failures: problems, warnings: [message("files.rename.nothing-renamed")] });
133
+ }
134
+ if (renames.length === 0)
135
+ return done(data);
136
+ if (!input.apply)
137
+ return preview(data, "--apply");
138
+ refuseProtected(this.protectedPaths, renames.map((rename) => rename.from), context.cwd);
139
+ await requireApproval(context, message("files.rename.ask", { count: renames.length }), input.yes);
140
+ const failures = [];
141
+ let renamed = 0;
142
+ // Deepest first, so a folder is renamed only after everything inside it.
143
+ for (const rename of [...renames].sort((a, b) => b.from.length - a.from.length)) {
144
+ try {
145
+ await moveEntry(this.fileSystem, rename.from, rename.to);
146
+ renamed += 1;
147
+ }
148
+ catch (error) {
149
+ if (!(error instanceof KiriyaError))
150
+ throw error;
151
+ failures.push(error.detail);
152
+ }
153
+ }
154
+ return done({ ...data, renamed }, { failures });
155
+ }
156
+ /** Two renames landing on one name, compared without case as Windows and macOS do, or an existing entry. */
157
+ async clashes(renames) {
158
+ const problems = [];
159
+ const landing = new Map();
160
+ for (const rename of renames) {
161
+ const key = rename.to.toLowerCase();
162
+ const other = landing.get(key);
163
+ if (other !== undefined) {
164
+ problems.push(message("files.rename.clash", { first: other, second: rename.from, name: path.basename(rename.to) }));
165
+ }
166
+ landing.set(key, rename.from);
167
+ if ((await this.fileSystem.lstat(rename.to)) === null)
168
+ continue;
169
+ if (await this.fileSystem.sameEntry(rename.from, rename.to))
170
+ continue;
171
+ let movedAway = false;
172
+ for (const item of renames) {
173
+ if (item !== rename && (await this.fileSystem.sameEntry(item.from, rename.to))) {
174
+ movedAway = true;
175
+ break;
176
+ }
177
+ }
178
+ if (!movedAway)
179
+ problems.push(message("core.fs.exists", { path: rename.to }));
180
+ }
181
+ return problems;
182
+ }
183
+ }
184
+ //# sourceMappingURL=rename-paths.use-case.js.map
@@ -0,0 +1,146 @@
1
+ import { expandPaths } from "../../../core/application/paths.js";
2
+ import { requireApproval } from "../../../core/application/safety.js";
3
+ import { done, preview } from "../../../core/domain/command.js";
4
+ import { KiriyaError, UsageError } from "../../../core/domain/errors.js";
5
+ import { RawReader } from "../../../core/domain/input-schema.js";
6
+ import { message } from "../../../core/domain/message.js";
7
+ import { parseExtensions } from "../domain/filters.js";
8
+ import { encodeText, escapeRegExp } from "../domain/text-encoding.js";
9
+ import { readTextFile, selectFiles } from "./text-files.js";
10
+ /** Changed lines shown per file. */
11
+ const SAMPLE_LINES = 3;
12
+ export const replaceSpec = {
13
+ id: "files.replace",
14
+ summary: "files.replace.summary",
15
+ examples: [
16
+ "kiriya files replace OldName NewName src --ext .cs",
17
+ 'kiriya files replace "v(\\d+)\\.0" "v$1.1" --regex --apply',
18
+ "kiriya files replace localhost:5000 localhost:8080 --name appsettings*.json --apply --yes",
19
+ ],
20
+ // Files are written in place and there is no undo, but --apply and a question come first.
21
+ safety: "write",
22
+ idempotent: false,
23
+ usesNetwork: false,
24
+ runsUserCommands: false,
25
+ input: {
26
+ positionals: [
27
+ { name: "find", description: "files.replace.arg.find", required: true, variadic: false },
28
+ { name: "with", description: "files.replace.arg.with", required: true, variadic: false },
29
+ { name: "paths", description: "files.replace.arg.paths", required: false, variadic: true, path: true },
30
+ ],
31
+ options: {
32
+ regex: { type: "boolean", description: "files.replace.option.regex" },
33
+ "ignore-case": { type: "boolean", description: "files.replace.option.ignore-case", short: "i" },
34
+ ext: { type: "string", description: "files.option.ext", valueName: "<extensions>", multiple: true },
35
+ name: { type: "string", description: "files.option.name", valueName: "<glob>" },
36
+ all: { type: "boolean", description: "files.option.all", reachesHidden: true },
37
+ apply: { type: "boolean", description: "files.replace.option.apply" },
38
+ yes: { type: "boolean", description: "files.replace.option.yes", short: "y", terminalOnly: true },
39
+ },
40
+ parse(raw) {
41
+ const reader = new RawReader(raw);
42
+ const find = reader.positional(0) ?? "";
43
+ if (find === "")
44
+ throw new UsageError("files.replace.empty-find");
45
+ const regex = reader.flag("regex");
46
+ if (regex) {
47
+ try {
48
+ new RegExp(find, "g");
49
+ }
50
+ catch {
51
+ throw new UsageError("files.replace.bad-pattern", { pattern: find });
52
+ }
53
+ }
54
+ return {
55
+ find,
56
+ replacement: reader.positional(1) ?? "",
57
+ paths: reader.positionalsFrom(2),
58
+ regex,
59
+ ignoreCase: reader.flag("ignore-case"),
60
+ extensions: parseExtensions(reader.strings("ext")),
61
+ name: reader.string("name"),
62
+ all: reader.flag("all"),
63
+ apply: reader.flag("apply"),
64
+ yes: reader.flag("yes"),
65
+ };
66
+ },
67
+ },
68
+ };
69
+ function samplesOf(before, after) {
70
+ const oldLines = before.split(/\r?\n/);
71
+ const newLines = after.split(/\r?\n/);
72
+ if (oldLines.length !== newLines.length)
73
+ return { lineCountChanges: true, samples: [] };
74
+ const samples = [];
75
+ for (let index = 0; index < oldLines.length && samples.length < SAMPLE_LINES; index += 1) {
76
+ const old = oldLines[index] ?? "";
77
+ const next = newLines[index] ?? "";
78
+ if (old !== next)
79
+ samples.push({ line: index + 1, before: old.trim(), after: next.trim() });
80
+ }
81
+ return { lineCountChanges: false, samples };
82
+ }
83
+ export class ReplaceText {
84
+ fileSystem;
85
+ content;
86
+ spec = replaceSpec;
87
+ constructor(fileSystem, content) {
88
+ this.fileSystem = fileSystem;
89
+ this.content = content;
90
+ }
91
+ async execute(input, context) {
92
+ const pattern = new RegExp(input.regex ? input.find : escapeRegExp(input.find), input.ignoreCase ? "gi" : "g");
93
+ // Without --regex a `$` in the replacement is text, not a group reference.
94
+ const replaceIn = (text) => input.regex ? text.replace(pattern, input.replacement) : text.replace(pattern, () => input.replacement);
95
+ const targets = input.paths.length === 0 ? ["."] : input.paths;
96
+ const paths = await expandPaths(this.fileSystem, targets, context.cwd, input.all);
97
+ const files = await selectFiles(this.fileSystem, paths, {
98
+ all: input.all,
99
+ extensions: input.extensions,
100
+ name: input.name,
101
+ });
102
+ const changes = [];
103
+ const replaced = [];
104
+ let replacements = 0;
105
+ let skipped = 0;
106
+ for (const file of files) {
107
+ if (context.signal.aborted)
108
+ break;
109
+ const current = await readTextFile(this.fileSystem, this.content, file);
110
+ if (current === null) {
111
+ skipped += 1;
112
+ continue;
113
+ }
114
+ const count = current.text.match(pattern)?.length ?? 0;
115
+ if (count === 0)
116
+ continue;
117
+ const updated = replaceIn(current.text);
118
+ if (updated === current.text)
119
+ continue;
120
+ replacements += count;
121
+ changes.push({ path: file, file: { text: updated, encoding: current.encoding } });
122
+ replaced.push({ path: file, count, ...samplesOf(current.text, updated) });
123
+ }
124
+ const data = { files: replaced, replacements, checked: files.length, skipped, written: 0 };
125
+ if (changes.length === 0)
126
+ return done(data);
127
+ if (!input.apply)
128
+ return preview(data, "--apply");
129
+ await requireApproval(context, message("files.replace.ask", { count: changes.length }), input.yes);
130
+ const failures = [];
131
+ let written = 0;
132
+ for (const change of changes) {
133
+ try {
134
+ await this.content.write(change.path, encodeText(change.file));
135
+ written += 1;
136
+ }
137
+ catch (error) {
138
+ if (!(error instanceof KiriyaError))
139
+ throw error;
140
+ failures.push(error.detail);
141
+ }
142
+ }
143
+ return done({ ...data, written }, { failures });
144
+ }
145
+ }
146
+ //# sourceMappingURL=replace-text.use-case.js.map
@@ -0,0 +1,115 @@
1
+ import { expandPaths } from "../../../core/application/paths.js";
2
+ import { done } from "../../../core/domain/command.js";
3
+ import { UsageError } from "../../../core/domain/errors.js";
4
+ import { RawReader } from "../../../core/domain/input-schema.js";
5
+ import { parseExtensions } from "../domain/filters.js";
6
+ import { escapeRegExp } from "../domain/text-encoding.js";
7
+ import { readTextFile, selectFiles } from "./text-files.js";
8
+ /** Longer matching lines are cut here, so one minified file cannot flood the terminal. */
9
+ const LINE_LIMIT = 240;
10
+ export const grepSpec = {
11
+ id: "files.grep",
12
+ summary: "files.grep.summary",
13
+ examples: [
14
+ 'kiriya files grep "TODO|FIXME"',
15
+ "kiriya files grep useState src --ext .tsx",
16
+ 'kiriya files grep "connection string" --literal -i -l',
17
+ ],
18
+ safety: "read",
19
+ idempotent: true,
20
+ usesNetwork: false,
21
+ runsUserCommands: false,
22
+ input: {
23
+ positionals: [
24
+ { name: "pattern", description: "files.grep.arg.pattern", required: true, variadic: false },
25
+ { name: "paths", description: "files.grep.arg.paths", required: false, variadic: true, path: true },
26
+ ],
27
+ options: {
28
+ literal: { type: "boolean", description: "files.grep.option.literal" },
29
+ "ignore-case": { type: "boolean", description: "files.grep.option.ignore-case", short: "i" },
30
+ ext: { type: "string", description: "files.option.ext", valueName: "<extensions>", multiple: true },
31
+ name: { type: "string", description: "files.option.name", valueName: "<glob>" },
32
+ "files-only": { type: "boolean", description: "files.grep.option.files-only", short: "l" },
33
+ count: { type: "boolean", description: "files.grep.option.count", short: "c" },
34
+ all: { type: "boolean", description: "files.option.all" },
35
+ limit: { type: "string", description: "files.grep.option.limit", valueName: "<n>" },
36
+ },
37
+ parse(raw) {
38
+ const reader = new RawReader(raw);
39
+ const pattern = reader.positional(0) ?? "";
40
+ if (pattern === "")
41
+ throw new UsageError("files.grep.empty-pattern");
42
+ const literal = reader.flag("literal");
43
+ if (!literal) {
44
+ try {
45
+ new RegExp(pattern);
46
+ }
47
+ catch {
48
+ throw new UsageError("files.grep.bad-pattern", { pattern });
49
+ }
50
+ }
51
+ return {
52
+ pattern,
53
+ paths: reader.positionalsFrom(1),
54
+ literal,
55
+ ignoreCase: reader.flag("ignore-case"),
56
+ extensions: parseExtensions(reader.strings("ext")),
57
+ name: reader.string("name"),
58
+ filesOnly: reader.flag("files-only"),
59
+ count: reader.flag("count"),
60
+ all: reader.flag("all"),
61
+ limit: reader.positiveInteger("limit", 500),
62
+ };
63
+ },
64
+ },
65
+ };
66
+ export class SearchText {
67
+ fileSystem;
68
+ content;
69
+ spec = grepSpec;
70
+ constructor(fileSystem, content) {
71
+ this.fileSystem = fileSystem;
72
+ this.content = content;
73
+ }
74
+ async execute(input, context) {
75
+ const regex = new RegExp(input.literal ? escapeRegExp(input.pattern) : input.pattern, input.ignoreCase ? "i" : "");
76
+ const mode = input.filesOnly ? "files" : input.count ? "count" : "lines";
77
+ const targets = input.paths.length === 0 ? ["."] : input.paths;
78
+ const paths = await expandPaths(this.fileSystem, targets, context.cwd, input.all);
79
+ const files = await selectFiles(this.fileSystem, paths, {
80
+ all: input.all,
81
+ extensions: input.extensions,
82
+ name: input.name,
83
+ });
84
+ const lines = [];
85
+ const matched = [];
86
+ let matches = 0;
87
+ let skipped = 0;
88
+ for (const file of files) {
89
+ if (context.signal.aborted)
90
+ break;
91
+ const text = await readTextFile(this.fileSystem, this.content, file);
92
+ if (text === null) {
93
+ skipped += 1;
94
+ continue;
95
+ }
96
+ let inFile = 0;
97
+ text.text.split(/\r?\n/).forEach((line, index) => {
98
+ if (!regex.test(line))
99
+ return;
100
+ inFile += 1;
101
+ if (mode !== "lines" || lines.length >= input.limit)
102
+ return;
103
+ const trimmed = line.trim();
104
+ const clipped = trimmed.length > LINE_LIMIT ? `${trimmed.slice(0, LINE_LIMIT)}…` : trimmed;
105
+ lines.push({ path: file, line: index + 1, text: clipped });
106
+ });
107
+ if (inFile === 0)
108
+ continue;
109
+ matches += inFile;
110
+ matched.push({ path: file, count: inFile });
111
+ }
112
+ return done({ mode, lines, files: matched, matches, checked: files.length, skipped });
113
+ }
114
+ }
115
+ //# sourceMappingURL=search-text.use-case.js.map