{"id":33765183,"url":"https://github.com/rasros/lx","last_synced_at":"2026-01-25T12:03:55.572Z","repository":{"id":326401224,"uuid":"1094440287","full_name":"rasros/lx","owner":"rasros","description":"Recursively find, filter, and format code files for ChatGPT and Claude context windows directly from your terminal.","archived":false,"fork":false,"pushed_at":"2026-01-24T13:06:40.000Z","size":490,"stargazers_count":39,"open_issues_count":4,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-25T01:01:54.486Z","etag":null,"topics":["chatgpt","claude","cli","clipboard","code-analysis","context-window","developer-tools","gitignore","go","go-lang","llm","productivity","prompt-engineering","terminal"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rasros.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-11T17:53:51.000Z","updated_at":"2026-01-24T13:06:42.000Z","dependencies_parsed_at":"2026-01-17T15:08:12.176Z","dependency_job_id":null,"html_url":"https://github.com/rasros/lx","commit_stats":null,"previous_names":["rasros/ctxp"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/rasros/lx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasros%2Flx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasros%2Flx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasros%2Flx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasros%2Flx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rasros","download_url":"https://codeload.github.com/rasros/lx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasros%2Flx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28752671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T10:25:12.305Z","status":"ssl_error","status_checked_at":"2026-01-25T10:25:11.933Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["chatgpt","claude","cli","clipboard","code-analysis","context-window","developer-tools","gitignore","go","go-lang","llm","productivity","prompt-engineering","terminal"],"created_at":"2025-12-05T13:00:18.055Z","updated_at":"2026-01-25T12:03:55.566Z","avatar_url":"https://github.com/rasros.png","language":"Go","funding_links":[],"categories":["\u003ca name=\"conversion\"\u003e\u003c/a\u003eConversion"],"sub_categories":[],"readme":"# lx\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/rasros/lx.svg)](https://pkg.go.dev/github.com/rasros/lx)\n[![Go Report Card](https://goreportcard.com/badge/github.com/rasros/lx)](https://goreportcard.com/report/github.com/rasros/lx)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n`lx` is a CLI context bundler for Large Language Models.\n\nIt recursively discovers files, respects ignore rules, detects binaries, and formats content into Markdown, XML, or HTML\nwith built-in token estimation.\n\nUnlike simple file concatenators, `lx` treats arguments as a stream. This allows you to apply state modifiers (like line\nlimits or filters) to specific subsets of files within a single command.\n\n---\n\n[Installation](#installation) • [Usage](#usage) • [Stream Processing](#stream-processing-model) • [Configuration](#configuration)\n\n## Features\n\n* **Token Economy:** Automatically calculates token estimates for every file and the total bundle.\n* **Smart Traversal:** Respects `.gitignore`, `.ignore`, and `.lxignore`. Skips binary files by default.\n* **Stream Processing:** Apply different rules (e.g., `--tail 50`) to different files in one pass.\n* **LLM Optimized:** Outputs Markdown (GitHub/OpenAI), XML (Claude), or HTML (visual debugging).\n* **Clipboard Ready:** Pipes output directly to the system clipboard on Linux (`xclip`/`wl-copy`), macOS, and Windows.\n* **Pipeline Friendly:** Accepts file lists via stdin from tools like `find`, `fd`, or `git`.\n\n## Installation\n\n### Via Go install\n\n```bash\ngo install github.com/rasros/lx/cmd/lx@latest\n```\n\n### Via Curl (Pre-built binaries)\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/rasros/lx/main/install.sh\n```\n\n### Dependencies\n\nClipboard support (`-c`) requires:\n\n* **Linux (X11):** `xclip`\n* **Linux (Wayland):** `wl-clipboard`\n* **macOS / Windows:** Native support included.\n\n## Usage\n\n### Basic Bundling\n\nWalk the current directory, ignoring hidden/gitignored files, and copy to clipboard:\n\n```bash\nlx -c\n```\n\n### Git Integration\n\nBundle only the files changed in the current branch:\n\n```bash\ngit diff --name-only main | lx -c\n```\n\n### Filter by Type\n\nFind Python files, exclude tests, and output as XML (Recommended for **Anthropic/Claude**):\n\n```bash\nlx --xml -i \"*.py\" -e \"*test*\" src/\n```\n\n### Prompt Injection\n\nInject a custom instruction header before the file context:\n\n```bash\nlx -p \"Refactor the following code to use contexts:\" main.go\n```\n\n## Stream Processing Model\n\nArguments are processed sequentially. Flags are not global; they are **state modifiers** that apply to all subsequent\nactions until reset.\n\n1. **Modifiers:** (`-n`, `--tail`, `-i`) Apply to subsequent files.\n2. **Actions:** (`file`, `dir/`) Capture the current state.\n3. **Resets:** (`-N`, `-E`) Clear active modifiers.\n\n**Example:**\nBundling a log file (last 50 lines) and the full source code in one command.\n\n```bash\nlx --tail 50 app.log -N src/main.go\n```\n\n| Argument      | Type         | Effect                                 |\n|:--------------|:-------------|:---------------------------------------|\n| `--tail 50`   | **Modifier** | Sets \"Read Strategy\" to last 50 lines. |\n| `app.log`     | **Action**   | Processed using the tail strategy.     |\n| `-N`          | **Reset**    | Resets strategy to full content.       |\n| `src/main.go` | **Action**   | Processed in full.                     |\n\n## Integration\n\n### Using with `fzf`\n\nUse `fd` to find files, `lx` to preview them, and `lx` again to bundle the selection.\n\n```bash\n# Requires: fd, fzf\nfd -t f | fzf -m --preview 'lx -n 20 {}' | lx -c\n```\n\n### Using with `llm`\n\nPipe context directly into [llm](https://github.com/simonw/llm) tool:\n\n```bash\nlx -p \"Explain this project structure\" src/ | llm\n```\n\n## Output Formats\n\n| Flag      | Format       | Best For                                                                 |\n|:----------|:-------------|:-------------------------------------------------------------------------|\n| (default) | **Markdown** | ChatGPT, GitHub Copilot, DeepSeek. Uses fenced code blocks.              |\n| `--xml`   | **XML**      | Claude (Anthropic). Uses semantic tags `\u003cdocument\u003e`, `\u003csource\u003e`.         |\n| `--html`  | **HTML**     | Archiving/Sharing. Generates a standalone file with syntax highlighting. |\n\n## Configuration\n\nDefaults can be overridden via `~/.config/lx/config.yaml`.\n\n```yaml\noutput_mode: \"stdout\"    # stdout, copy\noutput_format: \"xml\"     # markdown, xml, html\nshow_hidden: false\nfollow_symlinks: false\nignore: true             # Respect .gitignore\n```\n\n## Comparison\n\n| Feature               | lx | repopack | files-to-prompt |\n|:----------------------|:--:|:--------:|:---------------:|\n| **Language**          | Go | Node.js  |     Python      |\n| **Stream Processing** | ✅  |    ❌     |        ❌        |\n| **Clipboard Copy**    | ✅  |    ❌     |        ❌        |\n| **XML Support**       | ✅  |    ✅     |        ✅        |\n| **Token Estimation**  | ✅  |    ✅     |        ❌        |\n| **Binary Detection**  | ✅  |    ✅     |        ✅        |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasros%2Flx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frasros%2Flx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasros%2Flx/lists"}