Kevin Veen-Birkenbach 039481d3a9 This commit introduces a complete structural and architectural refactor of
Analysis-Ready Code (ARC). The project is now fully migrated to a modern
src/-based Python package layout, with proper packaging via pyproject.toml,
a clean Nix flake, and improved CLI entry points.

Major changes:

• Add `src/arc/` package with clean module structure:
  - arc/__init__.py now contains the main() dispatcher and clipboard helpers
  - arc/__main__.py provides a proper `python -m arc` entry point
  - arc/cli.py rewritten with full argparse-based interface
  - arc/code_processor.py modernized and relocated
  - arc/directory_handler.py rewritten with output_stream support
  - arc/tee.py added for multi-stream output (stdout + buffer)

• Remove legacy top-level modules:
  - cli.py
  - directory_handler.py
  - main.py

• Introduce fully PEP-517 compliant pyproject.toml with console script:
  - arc = arc.__main__:main

• Add Nix flake (`flake.nix`) providing:
  - buildPythonApplication package `arc`
  - `nix run .#arc` app
  - development shell with Python + xclip

• Add Makefile overhaul:
  - automatic detection of Nix vs Python installation
  - unified install/uninstall targets
  - Nix wrapper installation into ~/.local/bin
  - improved help text and shell safety

• Add GitHub CI pipelines:
  - ci-python.yml for Python builds + Makefile tests + arc --help
  - ci-nix.yml for Nix builds, flake checks, dev-shell tests, and `nix run .#arc`

• Refactor and extend unit tests:
  - test_arc.py updated for src/ imports
  - new tests: test_cli.py, test_main.py, test_tee.py
  - improved CodeProcessor and DirectoryHandler tests

• Add egg-info metadata for local builds

• Add build/lib/ tree for compatibility with setuptools (generated)

Overall, this commit modernizes ARC into a clean, robust, and fully packaged
Python/Nix hybrid tool, enabling reproducible builds, solid CLI behavior,
testable architecture, and CI automation.

https://chatgpt.com/share/693933a0-e280-800f-9cf0-26036d15be04
2025-12-10 09:47:19 +01:00
2023-09-02 16:35:30 +02:00
2025-03-12 20:47:42 +01:00

🤖👩‍🔬 Analysis-Ready Code (ARC)

GitHub Sponsors Patreon Buy Me a Coffee PayPal

Analysis-Ready Code (ARC) is a Python-based utility designed to recursively scan directories and transform source code into a format optimized for AI and computer analysis. By stripping comments, filtering specific file types, and optionally compressing content, ARC ensures that your code is clean and ready for automated processing.

🚀 Getting Started

📋 Prerequisites

🛠️ Installation via Package Manager

ARC is available through the package manager under the alias arc. To install it, follow these steps:

  1. Ensure that you have Kevin's Package Manager set up on your system. Follow the instructions on the package manager repository if you haven't done so already.
  2. Install ARC using the package manager:
    package-manager install arc
    
    This command will download and install ARC and make it available globally via the alias arc.

Running ARC

Once installed, you can run ARC directly from the terminal using its alias:

arc /path/to/directory [options]

📖 Usage

ARC scans the specified directories and processes source code to prepare it for automated analysis. It can filter by file type, remove comments, and compress the content for efficient processing.

To view the help page and all available options, execute:

arc --help

Options:

  • paths: List of files or directories to scan. This is a positional argument.
  • --file-types: Filter by file types (e.g., .py, .js, .c). Only files with these extensions will be processed.
  • --ignore-file-strings: Ignore files and folders containing these strings. Useful for excluding specific files or directories.
  • --ignore-hidden: Ignore hidden directories and files (those starting with a dot).
  • -v, --verbose: Enable verbose mode to print additional information about skipped files.
  • --no-comments: Remove comments from the displayed content based on file type. This is especially useful for preparing code for automated analysis.
  • --compress: Compress code (for supported file types) to further optimize it for analysis.
  • --path-contains: Display files whose paths contain one of these strings. Useful for narrowing down the scan to specific parts of the directory structure.
  • --content-contains: Display files containing one of these strings in their content.

⚠️ Caution

ARC is designed to prepare code for analysis by removing extraneous elements like comments. Exercise caution when scanning directories with large files, as the script may produce extensive output. Always assess the data volume before executing the script.

🤝 Contributing

Contributions via pull requests are welcome. For significant modifications, kindly open an issue first to discuss the proposed changes.

✍️ Author

Kevin Veen-Birkenbach

📜 License

This project is licensed under the GNU Affero General Public License v3.0. The complete license text is available in the LICENSE file.

🙏 Acknowledgements

Special thanks to the community and tools like OpenAI's ChatGPT for assisting in the development process.

Description
No description provided
Readme AGPL-3.0 182 KiB
Languages
Python 84.6%
Makefile 10.5%
Nix 4.9%