clod
Copyright(c) Fuzz Leonard 2025
LicenseMIT
Maintainercyborg@bionicfuzz.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

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

File processing

processFiles Source #

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

Instances details
Show ManifestEntry Source # 
Instance details

Defined in Clod.FileSystem.Processing

Eq ManifestEntry Source # 
Instance details

Defined in Clod.FileSystem.Processing

Manifest operations

createOptimizedName :: FilePath -> OptimizedName Source #

Create an optimized filename for Claude UI

writeManifestFile Source #

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.