Skip to content

Repository Organizer

osa_tool.operations.codebase.organization.repo_organizer

RepoOrganizer

Organizes repository by adding 'tests' and 'examples' directories if they aren't exist, moves Python test and example files into the appropriate folders.

__init__(config_manager)

Initialize with the local repository path.

Parameters:

Name Type Description Default
config_manager ConfigManager

A unified configuration manager that provides task-specific LLM settings, repository information, and workflow preferences.

required

add_directories()

Add 'tests' and 'examples' directories if they aren't exist.

match_patterns(filename, patterns) staticmethod

Check if filename matches any of the provided patterns.

Parameters:

Name Type Description Default
filename str

Name of the file.

required
patterns List[str]

List of glob-like patterns.

required

Returns:

Name Type Description
bool bool

True if file matches any pattern, False otherwise.

move_files_by_patterns(target_dir, patterns)

Move files matching patterns to the target directory, excluding files already inside target_dir or its subdirectories.

Parameters:

Name Type Description Default
target_dir str

Directory to move files into.

required
patterns List[str]

Patterns to match files.

required

organize()

Ensure directories exist and move Python test and example files.