Copyright | (c) Fuzz Leonard 2025 |
---|---|
License | MIT |
Maintainer | cyborg@bionicfuzz.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Clod.FileSystem.Processing
Description
This module provides functions for processing files, including adding files to the manifest and copying them to the staging directory.
The implementation uses Kleisli arrows for elegant function composition.
Synopsis
- processFiles :: ClodConfig -> FilePath -> [FilePath] -> Bool -> ClodM (Int, Int)
- data ManifestEntry = ManifestEntry {}
- createOptimizedName :: FilePath -> OptimizedName
- writeManifestFile :: FileWriteCap -> FilePath -> [(OptimizedName, OriginalPath)] -> ClodM ()
File processing
Arguments
:: ClodConfig | Configuration for the Clod program |
-> FilePath | Path to the manifest file |
-> [FilePath] | List of files to process |
-> Bool | Whether to only include in manifest (no file copying) |
-> ClodM (Int, Int) | (Processed count, Skipped count) |
Process a list of files for Claude integration
This is the core function that processes files for Claude integration. It filters files based on ignore patterns, skips binary files, and either copies the files to the staging directory or just adds them to the manifest.
The function returns a tuple with:
- The number of files successfully processed
- The number of files skipped
-- Process all files in a list (processed, skipped) <- processFiles config manifestPath allFiles False -- Process files but only include in manifest (no copying) (processed, skipped) <- processFiles config manifestPath allFiles True
data ManifestEntry Source #
A manifest entry consisting of an optimized name and original path
Each entry in the path manifest maps an optimized file name (as displayed in Claude) to its original file path in the repository.
ManifestEntry { entryOptimizedName = OptimizedName "src-config-settings.js" , entryOriginalPath = OriginalPath "srcconfigsettings.js" }
Constructors
ManifestEntry | |
Fields
|
Instances
Show ManifestEntry Source # | |
Defined in Clod.FileSystem.Processing Methods showsPrec :: Int -> ManifestEntry -> ShowS # show :: ManifestEntry -> String # showList :: [ManifestEntry] -> ShowS # | |
Eq ManifestEntry Source # | |
Defined in Clod.FileSystem.Processing Methods (==) :: ManifestEntry -> ManifestEntry -> Bool # (/=) :: ManifestEntry -> ManifestEntry -> Bool # |
Manifest operations
createOptimizedName :: FilePath -> OptimizedName Source #
Create an optimized filename for Claude UI
Arguments
:: FileWriteCap | Capability token with permissions to write to the staging directory |
-> FilePath | Path to the manifest file (typically "_path_manifest.dhall") |
-> [(OptimizedName, OriginalPath)] | List of optimized name to original path mappings |
-> ClodM () | Action that creates the manifest file |
Write all entries to the manifest file at once
This creates the _path_manifest.dhall file that maps optimized filenames back to original paths. The manifest is a Dhall record with optimized names as keys and original paths as values.
>>>
writeManifestFile writeCap "_path_manifest.dhall" [(OptimizedName "app-config.js", OriginalPath "app/config.js")]
-- Creates a file with content: { `app-config.js` = "app/config.js" }
The manifest file is crucial for Claude to know where to write files back to the filesystem.