Skip to content

Conversation

@filipchristiansen
Copy link
Contributor

Summary

This PR unifies the ingestion output flow for both directories and single files into a single function, format_node. It also removes several unused exceptions (MaxFilesReachedError, MaxFileSizeReachedError, and AlreadyVisitedError) and refines the partial clone subpath logic.

Key Changes

  • Reduced Duplication in output_formatters.py
    Consolidated format_directory and format_single_file into a single format_node function, eliminating parallel code paths and clarifying how content is assembled and displayed.

  • Removed an Unused Exception
    Deleted MaxFilesReachedError, MaxFileSizeReachedError, and AlreadyVisitedError from exceptions.py since they were no longer being used.

  • Simplified Cloning Logic
    Streamlined partial clone handling and removed extraneous steps in the clone_repo function.

  • Refactored FileSystemNode
    Simplified the logic for the sort_children method of FileSystemNode class, its content and content_string properties

  • Additional Improvements

    • Updated docstrings and code comments for clarity.
    • Refined variable names and removed redundant code.

…emove unused exceptions, and fix partial clone subpath handling.

- Consolidate `format_directory` and `format_single_file` into a single `format_node` function
- Remove unused exceptions (`MaxFilesReachedError`, `MaxFileSizeReachedError`, `AlreadyVisitedError`)
- Update partial clone logic to correctly handle single-file paths by stripping the filename from subpath when `blob` is True
- Improve docstrings and clean up code for better readability
Copy link
Member

@cyclotruc cyclotruc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The more i looked at the new sorting implementation, the more I liked it
impressive work thank you

@filipchristiansen filipchristiansen merged commit de19278 into main Mar 7, 2025
18 checks passed
@filipchristiansen filipchristiansen deleted the refactor/simplify-codebase branch March 7, 2025 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants