fileutil

package
v0.0.0-...-916872c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(src, dst string) error

CopyDir recursively copies a directory from src to dst

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies a single file from src to dst, preserving permissions

func CopyPath

func CopyPath(src, dst string) error

CopyPath copies a file or directory from src to dst

func CountFiles

func CountFiles(dir string) (int, error)

CountFiles recursively counts files in a directory

func DirChecksum

func DirChecksum(dir string) (string, error)

DirChecksum calculates a combined checksum for all files in a directory

func EnsureDir

func EnsureDir(path string) error

EnsureDir creates a directory if it doesn't exist

func Exists

func Exists(path string) bool

Exists checks if a path exists

func ExpandPatterns

func ExpandPatterns(repoPath string, patterns []string) (map[string]string, error)

ExpandPatterns expands patterns to actual paths in the repository Returns a map of relative path -> full path For directory patterns like ".claude/**", returns the directory itself For file patterns like "**/CLAUDE.md", returns matched files

func FileChecksum

func FileChecksum(path string) (string, error)

FileChecksum calculates SHA256 checksum of a file

func FindAIFiles

func FindAIFiles(repoPath string, patterns []string) ([]string, error)

FindAIFiles finds all AI-related files/directories in a repo based on patterns Returns top-level items: directories for "dir/**" patterns, individual files for "**/file" patterns

func IsAIFile

func IsAIFile(path string, patterns []string) bool

IsAIFile checks if a path matches any AI file pattern

func IsDir

func IsDir(path string) bool

IsDir checks if a path is a directory

func IsFile

func IsFile(path string) bool

IsFile checks if a path is a regular file

func ListAllFiles

func ListAllFiles(dir string) ([]string, error)

ListAllFiles recursively lists all files in a directory

func ListDirs

func ListDirs(dir string) ([]string, error)

ListDirs returns all directories in a directory (not recursive)

func ListFiles

func ListFiles(dir string) ([]string, error)

ListFiles returns all files in a directory (not recursive)

func MatchPatterns

func MatchPatterns(baseDir string, patterns []string) ([]string, error)

MatchPatterns finds all files/directories in baseDir that match any of the patterns

func RemoveAll

func RemoveAll(path string) error

RemoveAll removes a file or directory and all its contents

func VerifyChecksum

func VerifyChecksum(path string, expectedChecksum string) (bool, error)

VerifyChecksum verifies a file's checksum

func WalkFiles

func WalkFiles(root string, fn func(path string, info os.FileInfo) error) error

WalkFiles walks through all files in a directory (not directories themselves)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL