{"id":30580632,"url":"https://github.com/brianredbeard/rucat","last_synced_at":"2025-08-29T05:39:53.517Z","repository":{"id":310028050,"uuid":"1037877901","full_name":"brianredbeard/rucat","owner":"brianredbeard","description":"A `cat` like tool for displaying multiple files with fenced delimiters.","archived":false,"fork":false,"pushed_at":"2025-08-15T08:20:19.000Z","size":1267,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-15T09:22:39.292Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brianredbeard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-14T09:03:37.000Z","updated_at":"2025-08-15T08:20:22.000Z","dependencies_parsed_at":"2025-08-15T09:33:10.333Z","dependency_job_id":null,"html_url":"https://github.com/brianredbeard/rucat","commit_stats":null,"previous_names":["brianredbeard/rucat"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/brianredbeard/rucat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianredbeard%2Frucat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianredbeard%2Frucat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianredbeard%2Frucat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianredbeard%2Frucat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brianredbeard","download_url":"https://codeload.github.com/brianredbeard/rucat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianredbeard%2Frucat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272636504,"owners_count":24967983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-29T02:00:10.610Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-29T05:39:52.917Z","updated_at":"2025-08-29T05:39:53.512Z","avatar_url":"https://github.com/brianredbeard.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `rucat` - A versatile `cat` clone\n\n![rucat image](/.assets/rucat.png)\n_our mascot, \"Rucus\"_\n\n`rucat` is `cat` reborn for the era of LLMs. A critical tool for every prompt\nengineer.\n\nWritten in Rust. It goes beyond simple file concatenation, offering multiple\noutput formats, line numbering, syntax-aware formatting, and clipboard support,\nmaking it an ideal tool for developers, system administrators, and anyone working\nwith code or text files in the terminal.\n\n## Powering AI and Development Workflows\n\nIn modern development, AI assistants are invaluable for complex tasks like\ndebugging, refactoring, or repository analysis. However, their effectiveness\nhinges on the quality and completeness of the context you provide. Manually\ncopying and pasting from numerous files is slow and error-prone.\n\n`rucat` excels at rapidly consolidating context from multiple files into a\nsingle, well-structured block of text, perfect for an AI prompt.\n\nIf you're troubleshooting a complex `git` history issue and need to provide an\nAI with the full state of your repository's refs and logs, you can run:\n\n```bash\n# Quickly gather all relevant git state files into one block\n$ rucat .git/{HEAD,config,info/exclude,logs/HEAD,logs/refs/heads/*}\n\n# Or copy directly to clipboard for pasting into AI chat\n$ rucat --copy .git/{HEAD,config,info/exclude,logs/HEAD,logs/refs/heads/*}\n```\n\n````\n```\n---\nFile: .git/HEAD\n---\n```\nref: refs/heads/main\n```\n---\nFile: .git/config\n---\n```\n[core]\n    repositoryformatversion = 0\n    filemode = true\n    bare = false\n    logallrefupdates = true\n    ignorecase = true\n    precomposeunicode = true\n[remote \"origin\"]\n    url = https://github.com/poundifdef/SmoothMQ\n    fetch = +refs/heads/*:refs/remotes/origin/*\n[branch \"main\"]\n    remote = origin\n    merge = refs/heads/main\n```\n---\nFile: .git/info/exclude\n---\n```\n# git ls-files --others --exclude-from=.git/info/exclude\n# Lines that start with '#' are comments.\n# For a project mostly in C, the following would be a good set of\n# exclude patterns (uncomment them if you want to use them):\n# *.[oa]\n# *~\n```\n---\nFile: .git/logs/HEAD\n---\n```\n0000000000000000000000000000000000000000 2770c4b21a3755e95652c24b71ac7cad87b532dc Brian 'redbeard' Harrington \u003credbeard@dead-city.org\u003e 1718820643 -0700\tclone: from https://github.com/poundifdef/SmoothMQ\n```\n---\nFile: .git/logs/refs/heads/main\n---\n```\n0000000000000000000000000000000000000000 2770c4b21a3755e95652c24b71ac7cad87b532dc Brian 'redbeard' Harrington \u003credbeard@dead-city.org\u003e 1718820643 -0700\tclone: from https://github.com/poundifdef/SmoothMQ\n```\n````\n\nThis command instantly generates a clean, markdown-formatted output, with each\nfile's content neatly separated and labeled:\n\nThe resulting text can be piped to your clipboard and pasted directly into your\nAI chat, delivering complete and unambiguous context in seconds. This makes\n`rucat` an essential tool for accelerating AI-driven development.\n\n## Features\n\n- **Multiple Output Formats**: Display content in various styles, including:\n  - `ansi`: Nicely formatted with borders (width-configurable via\n    `--ansi-width`).\n  - `utf8`: Fancy UTF-8 box-drawing borders (width-configurable via\n    `--utf8-width`).\n  - `markdown`: GitHub-flavored Markdown code blocks, with automatic language\n    detection from the file extension.\n  - `ascii`: Simple `=== file.txt ===` headers for easy separation.\n  - `xml`: Structured XML output with file and line metadata.\n  - `json`: A clean JSON array of file entries, perfect for scripting and\n    programmatic use.\n  - `pretty`: Syntax highlighting for a wide range of languages. Syntax is\n    chosen based on: 1) the `--pretty-syntax` flag, 2) a Vim modeline in the\n    file (e.g., `vim: ft=rust`), or 3) the file extension.\n- **Line Numbering**: Prepend line numbers to every line with the `-n` or\n  `--numbers` flag.\n- **Clipboard Support**: Copy output directly to the system clipboard with the\n  `-c` or `--copy` flag. Supports multiple clipboard providers:\n  - Native clipboard on Windows, macOS, and Linux (X11/Wayland)\n  - Terminal escape sequences (OSC 52 for tmux/SSH, OSC 5522 for Kitty)\n  - Automatic provider detection based on your environment\n- **Flexible Input**:\n  - Process multiple files and directories.\n  - Read from `stdin`, allowing it to be used in shell pipelines.\n  - Handle NUL-terminated file lists from commands like `find ... -print0` using\n    the `-0` or `--null` flag.\n- **Path Manipulation**: Use `--strip N` to remove leading path components from\n  file headers, cleaning up output for nested projects.\n- **Packaging**:\n  - Built-in support for generating `.deb` packages for Debian/Ubuntu systems\n    via `cargo deb`.\n- **Robust and Fast**: Built with Rust for performance and memory safety.\n\n## Installation\n\n### From Homebrew (for macOS users)\n\nIf you are on macOS and have Homebrew installed, you can install `rucat` with a single command:\n\n```bash\nbrew install brianredbeard/rucat/rucat\n```\n\n### From source with Cargo\n\nIf you have the Rust toolchain installed, you can build and install `rucat`\ndirectly from source. From the root of the project repository:\n\n```bash\ncargo install --path .\n```\n\nTo build without clipboard support (reduces dependencies):\n\n```bash\ncargo install --path . --no-default-features\n```\n\n### Building Packages\n\nThis project is configured to build `.deb` packages using standard Cargo\ntooling. First, ensure you have the necessary packaging subcommand installed:\n\n```bash\ncargo install cargo-deb\n```\n\nThen, you can build the package from the project root:\n\n```bash\n# Build .deb package (output in target/debian/)\ncargo deb\n```\n\nThe binary will be placed in `~/.cargo/bin`.\n\n### Cross-compiling from macOS to Linux\n\nWhen cross-compiling from macOS to Linux, `rustc` needs a C-language toolchain\nthat can link executables for the Linux target. The native macOS toolchain\ncannot do this. You can install the necessary toolchains using Homebrew, but it\nrequires adding a new formula tap first.\n\n**This is a one-time setup for your development machine. No changes are needed\nfor the project's code.**\n\n1. **Install Cross-Compilation Toolchains with Homebrew**\n\n   First, tap the repository that contains the toolchains. Then, install them.\n\n   ```bash\n   brew tap messense/macos-cross-toolchains\n   brew install aarch64-unknown-linux-gnu\n   brew install x86_64-unknown-linux-gnu\n   ```\n\n1. **Configure Cargo to Use the New Linkers**\n\n   You must tell Cargo to use these newly installed linkers for the respective\n   targets. Create or edit the file `~/.cargo/config.toml` (this is Cargo's\n   global configuration file in your home directory, not your project directory)\n   and add the following content:\n\n   ```toml\n   [target.aarch64-unknown-linux-gnu]\n   linker = \"aarch64-unknown-linux-gnu-gcc\"\n\n   [target.x86_64-unknown-linux-gnu]\n   linker = \"x86_64-unknown-linux-gnu-gcc\"\n   ```\n\nAfter completing these two steps, your system will be properly configured for\ncross-compilation, and `make cross-build-all` should succeed.\n\n## Usage\n\n### Basic Usage\n\n```bash\n# Display a single file\nrucat src/main.rs\n\n# Display multiple files\nrucat README.md Cargo.toml\n\n# Pipe content from another command\nls -1 src/formatters | rucat\n\n# Copy output to clipboard\nrucat --copy src/main.rs\n```\n\n### Formatting Options\n\n`rucat` defaults to the `markdown` format. Use the `-f` or `--format` flag to\nchange it.\n\n```bash\n# Use the ANSI formatter with a width of 80 columns and line numbers\nrucat -f ansi --ansi-width 80 -n src/main.rs\n\n# Use the simple ASCII format\nrucat -f ascii src/main.rs\n\n# Get JSON output for scripting\nrucat -f json src/main.rs \u003e output.json\n\n# Use the pretty-printer with syntax highlighting\nrucat -f pretty src/main.rs\n\n# Force a specific syntax for the pretty-printer\nrucat -f pretty --pretty-syntax sh \u003c 'my-script-without-extension'\n\n# Pretty-print and copy to clipboard\nrucat -f pretty --copy src/main.rs\n```\n\n### Advanced Input\n\n`rucat` can process a NUL-separated list of files from standard input, which is\nsafer and more robust than using `xargs`. This is especially useful with `find`.\n\n```bash\n# Find all Rust files and display them using the markdown format\nfind src -name \"*.rs\" -print0 | rucat -0 -f markdown\n\n# Find and copy all configuration files to clipboard\nfind . -name \"*.toml\" -print0 | rucat -0 --copy\n```\n\n### Path Stripping\n\nWhen working with deep directory structures, the full file path can be noisy.\nUse `--strip` to shorten the paths in the output headers.\n\n```bash\n# Before stripping: === src/formatters/ansi.rs ===\nrucat -f ascii src/formatters/ansi.rs\n\n# After stripping 2 components: === ansi.rs ===\nrucat -f ascii --strip 2 src/formatters/ansi.rs\n```\n\n### Clipboard Support\n\nThe `--copy` flag allows you to copy the output directly to your system clipboard\nwhile still printing to stdout. This is particularly useful for quickly gathering\ncode context for AI assistants or sharing snippets with colleagues.\n\n```bash\n# Copy a single file to clipboard\nrucat --copy src/main.rs\n\n# Copy multiple files with pretty formatting\nrucat -f pretty --copy src/*.rs\n\n# Copy from stdin\necho \"Hello, World!\" | rucat --copy\n\n# Works over SSH with OSC 52 support (tmux, modern terminals)\nssh remote-server \"rucat --copy /etc/nginx/nginx.conf\"\n```\n\nThe clipboard feature automatically detects the best provider for your environment:\n- On desktop systems, it uses the native clipboard\n- In SSH sessions or tmux, it uses OSC 52 escape sequences\n- In Kitty terminal, it can use OSC 5522 for better compatibility\n- Falls back gracefully if no clipboard is available\n\n## Configuration\n\n`rucat` can be configured with a TOML file to set your preferred default\noptions. Create a file at `~/.config/rucat/config.toml` (or the equivalent XDG\nconfig path on your OS).\n\nCommand-line arguments will always override settings from this file.\n\n**Example `config.toml`:**\n\n```toml\n# Default output format.\n# Possible values: \"ansi\", \"utf8\", \"markdown\", \"ascii\", \"xml\", \"json\",\n# \"pretty\"\nformat = \"ansi\"\n\n# Default to showing line numbers.\nnumbers = true\n\n# Default number of path components to strip from filenames.\nstrip = 1\n\n# Default width for the \"ansi\" and \"utf8\" formatters.\nansi_width = 120\nutf8_width = 120\n\n# Default syntax for the \"pretty\" formatter.\npretty_syntax = \"rust\"\n```\n\n## Contributing\n\nContributions are welcome! If you have a feature request, bug report, or pull\nrequest, please feel free to open an issue or submit a PR.\n\nThis tool was proudly co-written using\n[Aider](https://github.com/Aider-AI/aider)\n\n## License\n\nThis project is licensed under the GNU General Public License v3.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianredbeard%2Frucat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrianredbeard%2Frucat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianredbeard%2Frucat/lists"}