IPathQuery implementation backed by babashka.fs. All operations return hive-dsl Results for railway composition.
Convenience API (stateless, default instance): (exists? path) → Result<boolean> (directory? path) → Result<boolean> (absolute-dir? path) → Result<boolean> (resolve-first-dir [...]) → Result<string> (find-files path exts) → Result<vec<string>> (expand-path path exts) → vec<string> (rescue-wrapped)
DIP: consumers depend on IPathQuery protocol, not this impl. Swap FsPathQuery for a test double via make-path-query or protocol.
IPathQuery implementation backed by babashka.fs. All operations return hive-dsl Results for railway composition. Convenience API (stateless, default instance): (exists? path) → Result<boolean> (directory? path) → Result<boolean> (absolute-dir? path) → Result<boolean> (resolve-first-dir [...]) → Result<string> (find-files path exts) → Result<vec<string>> (expand-path path exts) → vec<string> (rescue-wrapped) DIP: consumers depend on IPathQuery protocol, not this impl. Swap FsPathQuery for a test double via make-path-query or protocol.
(absolute-dir? path)Check if path is both absolute and an existing directory. Returns Result<boolean>. Railway-safe.
Check if path is both absolute and an existing directory. Returns Result<boolean>. Railway-safe.
(absolute? path)Check if path is absolute. Returns Result<boolean> (pure, no IO).
Check if path is absolute. Returns Result<boolean> (pure, no IO).
(cargo-scan
root-path
{:keys [marker read-marker max-depth concurrency timeout-ms skip-dirs]
:or
{max-depth 5 concurrency 8 timeout-ms 10000 skip-dirs default-skip-dirs}})Parallel directory scanner using hive-weave/bounded-pmap. Walks root, finds directories containing :marker file. Fan-out at top level, single-threaded per subtree.
opts: :marker — filename to look for (e.g. ".hive-project.edn") :read-marker — fn (dir-path) -> data, called when marker found :max-depth — max recursion depth (default 5) :concurrency — parallel workers (default 8) :timeout-ms — per-subtree timeout (default 10000) :skip-dirs — set of dir names to skip (default: default-skip-dirs)
Returns Result<vec<{:path str :marker-data any}>>.
Parallel directory scanner using hive-weave/bounded-pmap.
Walks root, finds directories containing :marker file.
Fan-out at top level, single-threaded per subtree.
opts:
:marker — filename to look for (e.g. ".hive-project.edn")
:read-marker — fn (dir-path) -> data, called when marker found
:max-depth — max recursion depth (default 5)
:concurrency — parallel workers (default 8)
:timeout-ms — per-subtree timeout (default 10000)
:skip-dirs — set of dir names to skip (default: default-skip-dirs)
Returns Result<vec<{:path str :marker-data any}>>.(children dir)(children dir opts)List immediate children. Returns Result<vec<string>>. opts: {:filter :dirs|:files|:all, :skip #{"node_modules" ...}}
List immediate children. Returns Result<vec<string>>.
opts: {:filter :dirs|:files|:all, :skip #{"node_modules" ...}}(directory? path)Check if path is directory. Returns Result<boolean>.
Check if path is directory. Returns Result<boolean>.
(exists? path)Check path existence. Returns Result<boolean>.
Check path existence. Returns Result<boolean>.
(expand-path path exts)Expand a path to matching files. Directory → recursive glob. File matching exts → [file]. Nonexistent → []. Error → []. Returns plain vec (not Result) — rescue-wrapped for pipeline use.
(expand-path "/src" #{"clj" "cljs"}) => ["/src/foo.clj" "/src/bar/baz.cljs"]
Expand a path to matching files. Directory → recursive glob.
File matching exts → [file]. Nonexistent → []. Error → [].
Returns plain vec (not Result) — rescue-wrapped for pipeline use.
(expand-path "/src" #{"clj" "cljs"})
=> ["/src/foo.clj" "/src/bar/baz.cljs"](file? path)Check if path is regular file. Returns Result<boolean>.
Check if path is regular file. Returns Result<boolean>.
(find-files path exts)Recursively find files matching extensions under path. If path is a file matching exts, returns [path]. If path is a directory, walks recursively. Returns Result<vec<string>>.
(find-files "/src" #{"clj" "cljs" "cljc"}) => (ok ["/src/a.clj" "/src/b/c.cljs"])
Recursively find files matching extensions under path.
If path is a file matching exts, returns [path].
If path is a directory, walks recursively.
Returns Result<vec<string>>.
(find-files "/src" #{"clj" "cljs" "cljc"})
=> (ok ["/src/a.clj" "/src/b/c.cljs"])(make-path-query)Create a FsPathQuery instance. For DI injection or test doubles.
Create a FsPathQuery instance. For DI injection or test doubles.
(resolve-first-dir candidates)Try candidate paths in order, return first existing directory. Skips nil candidates. Returns Result<string> or err :fs/no-matching-dir.
(resolve-first-dir [nil (hcr-lookup project-id) (str hive-root "/" project-id)])
Try candidate paths in order, return first existing directory. Skips nil candidates. Returns Result<string> or err :fs/no-matching-dir. (resolve-first-dir [nil (hcr-lookup project-id) (str hive-root "/" project-id)])
(resolve-path base & segments)Join + normalize path segments. Returns Result<string>.
Join + normalize path segments. Returns Result<string>.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |