clod
Copyright(c) Fuzz Leonard 2025
LicenseMIT
Maintainerink@fuzz.ink
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Clod.FileSystem.Detection

Description

This module provides functions for detecting file types and states using libmagic for robust file type detection. It determines whether files are text or binary based on their content rather than just extensions.

Synopsis

File type detection

isTextFile :: FilePath -> ClodM Bool Source #

Check if a file is a text file using libmagic with enhanced detection

isModifiedSince :: FilePath -> UTCTime -> FilePath -> ClodM Bool Source #

Check if a file has been modified since the given time

safeFileExists :: FileReadCap -> FilePath -> ClodM Bool Source #

Safe file existence check that checks capabilities

safeIsTextFile :: FileReadCap -> FilePath -> ClodM Bool Source #

Safe file type check that checks capabilities

isTextDescription :: String -> ClodM Bool Source #

Helper to determine if a file description indicates text content

needsTransformation :: FilePath -> Bool Source #

Special handling for files that need transformation

Detects files that need special handling and transformation based on their name or extension. Currently identifies:

  • Hidden files (dotfiles) - need to be transformed to be visible
  • SVG files - need to be transformed to XML for Claude compatibility
>>> needsTransformation ".gitignore"
True
>>> needsTransformation "logo.svg"
True
>>> needsTransformation "regular-file.txt"
False