Turn the script into an installable, tested CLI - #1
Open
devnsko wants to merge 1 commit into
Open
Conversation
The tool was a single main.py with a few latent bugs. This reworks it into a proper package while keeping the same command surface. Packaging and usability: - Add a `combinefiles` package with a `comf` console script, so the README's hand-rolled .bat/shell wrappers and PATH instructions are no longer needed. - Add pyproject.toml (hatchling), ruff and pytest config, and CI across Linux/macOS/Windows on Python 3.9 and 3.13. - `python main.py` keeps working as a thin shim. Behaviour fixes: - .gitignore patterns were matched against absolute paths, so they almost never matched. They are now matched against repo-relative POSIX paths, with a trailing slash for directories, and are applied by default (--no-gitignore opts out; the old -g flag is still accepted). - requirements.txt was saved as UTF-16, which pip cannot parse. Rewritten UTF-8. - Combining twice used to pull the previous combined.md back in as input. The output file and leftover combined.* files are now always skipped, and --list previews exactly what a real run would include. - Binary files were read as text and corrupted the output; they are now detected and skipped, along with dotfiles, oversized files and the usual noise directories (node_modules, __pycache__, .venv, ...). - Unreadable files and undecodable bytes no longer abort the run. New options: -a/--all, --hidden, --max-size, --style, -l/--list, -v/--verbose, -q/--quiet, --version, and -o - to write to stdout. Extensions may be given as py, .py or *.py. Default output is markdown with fenced, syntax-tagged blocks whose fences grow when a file contains backticks. Add 26 tests covering discovery, filtering, output formats and the CLI. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AQMWgFaixEevUt7QnjZv8b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The tool was a single main.py with a few latent bugs. This reworks it into a
proper package while keeping the same command surface.
Packaging and usability:
combinefilespackage with acomfconsole script, so the README'shand-rolled .bat/shell wrappers and PATH instructions are no longer needed.
Linux/macOS/Windows on Python 3.9 and 3.13.
python main.pykeeps working as a thin shim.Behaviour fixes:
matched. They are now matched against repo-relative POSIX paths, with a
trailing slash for directories, and are applied by default (--no-gitignore
opts out; the old -g flag is still accepted).
The output file and leftover combined.* files are now always skipped, and
--list previews exactly what a real run would include.
detected and skipped, along with dotfiles, oversized files and the usual
noise directories (node_modules, pycache, .venv, ...).
New options: -a/--all, --hidden, --max-size, --style, -l/--list, -v/--verbose,
-q/--quiet, --version, and -o - to write to stdout. Extensions may be given as
py, .py or *.py. Default output is markdown with fenced, syntax-tagged blocks
whose fences grow when a file contains backticks.
Add 26 tests covering discovery, filtering, output formats and the CLI.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01AQMWgFaixEevUt7QnjZv8b