lx makes prompt setup repeatable and precise. Instead of letting an agent guess context or manually selecting
files in a UI, define the exact context in one shell command and rerun it whenever you need a fresh session. It works
smoothly with standard tools like grep and shell globs.
Via go install:
go install github.com/rasros/lx/cmd/lx@v1.1.0-rc.1Or via curl:
curl -fsSL https://raw.githubusercontent.com/rasros/lx/main/install.sh | bashFormat a single file:
lx cmd/lx/main.goRecursively walk a directory (respects .gitignore by default):
lx src/Copy output directly to clipboard:
lx -c .Write output to a file:
lx -o prompt.md src/- Smart Formatting: Generates Markdown headers with row counts and language detection.
- Recursive Discovery: Walks directories similar to
fdorripgrep. - Ignore Logic: Respects
.gitignore,.ignore, and.lxignoreautomatically. - Context Control: Add custom prompts (
-p) and section headers (-s) directly in the stream. - Slicing: Use
-nto limit output lines or-n0for compact views. - Line Numbers: Optional
-lflag for referencing specific lines. - Input Flexibility: Reads filenames from arguments or stdin pipe.
- Configurable: Fully template-based output via
config.yaml.
# Walk current directory, respecting gitignore
lx .
# Include hidden files
lx -H .
# Include ignored files (disable gitignore logic)
lx -I .
# Follow symbolic links
lx -L .Inject instructions and headers into the prompt stream:
lx -p "Implement pytests for the following files. Follow the same structure as in the existing tests." \
-s "Files to test" \
src/foo/*.py \
-s "Test fixtures and sample tests." \
src/tests/fixtures src/tests/bar_test.pyUseful for large logs or getting a quick overview:
# Print N lines (split between head and tail), --head and --tail are also supported
lx -n100 server.log
# Compact mode (print filename and stats only, no content)
lx -n0Binary files are written in compact mode automatically.
Helpful for asking the LLM to point out log file issues:
lx -l server.loglx uses Go templates for rendering. You can customize the output format by creating a config file at
~/.config/lx/config.yaml (Linux/Mac) or %APPDATA%\lx\config.yaml (Windows).
See default_config.yaml in the repo for all available options and template variables.