Skip to content
TangoMan75Public

About

Python stdin filter that turns file paths in git, diff, and grep output into clickable OSC 8 terminal hyperlinks that open in your editor.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GitHub language GitHub license GitHub release GitHub release date GitHub commit activity CI status GitHub stars Visitors

Taco

Taco icon

Make file paths in terminal output clickable OSC 8 hyperlinks.

Pipe git, diff or grep output through taco and every file path it recognises becomes a link that opens in your editor, at the right line when the input carries one. Single-file Python, standard library only.

🌐 tangoman75.github.io/taco

πŸš€ Features

⚑ Clickable diff and grep output

  1. Wide line-shape coverage: recognises diff --git, ---/+++, Binary files, rename/copy, git log --stat (plain or --graph), git log --name-status, git status (long, --short, --porcelain=v2), hunk headers, grep path:line:text and bare paths.
  2. Line-aware links: grep matches and hunk headers jump to the first changed line of the new file, not just the top of the file.
  3. Repository-scoped resolution: relative paths resolve against the Git root and paths that escape it are left untouched.

⚑ Editor integration

  1. Presets for 11 editors: Atom, VS Code, Emacs, Nano, PhpStorm, PyCharm, PyCharm Community, Sublime Text, Vim, WebStorm and Windsurf.
  2. Persistent choice: one preset flag writes the template to ~/.config/TangoMan75/taco/config.json and every later run reuses it.
  3. One-off templates: --template accepts any URL scheme with {path}/{file} and optional {line} placeholders, without touching the config.

⚑ Safe by design

  1. Idempotent: output that already contains OSC 8 sequences is passed through, so taco | taco is a no-op after the first pass.
  2. Non-destructive paging: colours and hyperlinks survive less -R; redirected output is never paged.
  3. No crash on bad input: malformed configs, missing pagers and broken pipes are reported or ignored, never fatal.

πŸ“‘ Supported line shapes

  1. Diff headers: diff --git a/x b/x, --- a/x, +++ b/x, Binary files a/x and b/x differ.
  2. Git metadata: rename from/rename to, copy from/copy to.
  3. Git log: git log --stat rows (plain and --graph, including binary and rename {old => new} forms) and git log --name-status rows; git log --name-only paths are covered by the bare-path rule.
  4. Git status: long-format rows (modified:, new file:, deleted:, renamed:, untracked paths), --short/--porcelain columns (including colored columns and old -> new renames), and --porcelain=v2 rows.
  5. Hunks: @@ -old[,n] +new[,n] @@ links to the current file at the first modified line of the new file.
  6. Search results: path:line: text from grep -n and git grep -n.
  7. Plain paths: a line that is nothing but a path is linked whole.

Commit messages, hunk content and unrecognised text pass through byte-for-byte. /dev/null is never linked.

πŸ“¦ Installation

  1. Clone the repository:

    git clone https://github.com/TangoMan75/taco.git
    cd taco
  2. Install the command:

    ./entrypoint.sh install

    It copies taco.py to /usr/bin/taco, using sudo when needed, and skips the copy when the installed file is already identical. It does not touch your Git configuration.

  3. Configure Git (optional):

    ./entrypoint.sh config

    This runs git config --global core.pager 'taco', so git output is filtered automatically from then on. Skip it to leave your global Git config unchanged. Undo it later with ./entrypoint.sh unconfig.

  4. Verify:

    taco --help

    To do both steps by hand:

    sudo install -m 755 taco.py /usr/bin/taco
    git config --global core.pager taco

πŸ› οΈ Usage

  1. Pipe a command through it:

    git diff | taco
    git log -p | taco
    git status | taco
    grep -rn "TODO" . | taco
  2. Pick an editor once:

    taco --code      # VS Code
    taco --vim
    taco --pycharm

    The template persists in ~/.config/TangoMan75/taco/config.json.

  3. Override for a single run:

    grep -rn foo . | taco --template 'vscode://file/{path}:{line}'
  4. Control paging. When stdout is a terminal, output goes through a pager (less -R by default). Redirected stdout is written directly, so git diff | taco > patch.diff still works.

    git diff | taco --no-pager        # write straight to the terminal
    git diff | taco --pager 'less -S' # custom pager command

    The pager command comes from --pager, then $TACO_PAGER, then $PAGER, then less. When LESS is unset, less is started with FRX: quit if the output fits on one screen, keep raw colours, do not clear the screen on exit.

Options

Flag Default Description
--template URL config default_template URL template with {path}/{file} and optional {line} (one-off, not persisted)
--atom β€” Use the Atom preset (persists)
--code β€” Use the VS Code preset (persists)
--emacs β€” Use the Emacs preset (persists)
--nano β€” Use the Nano preset (persists)
--phpstorm β€” Use the PhpStorm preset (persists)
--pycharm β€” Use the PyCharm preset (persists)
--pycharm-community β€” Use the PyCharm Community preset (persists)
--subl β€” Use the Sublime Text preset (persists)
--vim β€” Use the Vim preset (persists)
--webstorm β€” Use the WebStorm preset (persists)
--windsurf β€” Use the Windsurf preset (persists)
--root PATH auto-detected via git Repository root for resolving paths
--pager CMD $TACO_PAGER, $PAGER, less Pager command used when stdout is a terminal
--no-pager β€” Write directly to stdout instead of paging

--template and the preset flags are mutually exclusive, and so are --pager and --no-pager.

Persistent config

Presets write default_template to ~/.config/TangoMan75/taco/config.json:

{
    "default_template": "code://open?url=file:///{file}&line={line}"
}
  • The file is created the first time a preset flag runs.
  • With no --template or preset flag, runs read default_template and fall back to file:///{path} when the file is missing or the value is empty.
  • A malformed config prints a warning on stderr and the built-in default is used β€” no crash.
  • Both {path} and {file} are accepted for the file path; {path}/ {file} carry the absolute path without its leading slash. If the template has no {line}, a #line fragment is appended when a line is known.

πŸ–‡οΈ Dependencies / Requirements

  1. Python 3.10+: the whole tool is a single stdlib-only script; no packages to install.
  2. Git (recommended): used to auto-detect the repository root. When it is unavailable, the current working directory is used unless --root is passed.
  3. A pager (optional): less is the default; any executable named by --pager, $TACO_PAGER or $PAGER also works. Non-terminal stdout needs none.
  4. ruff (development only): used by CI for linting.

🐞 Troubleshoot

  1. Links show as plain text: the terminal must support OSC 8. Test with printf '\e]8;;https://example.com\e\\click\e]8;;\e\\\n'; if that is not clickable, the terminal (or multiplexer) lacks support.
  2. taco: pager not found: install less or select another pager with --pager, $TACO_PAGER, $PAGER, or bypass paging with --no-pager.
  3. Links point at the wrong directory: pass --root explicitly, or run the command inside the Git repository whose root should be used.
  4. Nothing is linked: taco only recognises the line shapes listed above, and paths outside the repository root are deliberately skipped.
  5. Git behaves unexpectedly after ./entrypoint.sh config: the command sets core.pager globally. Undo with ./entrypoint.sh unconfig (or git config --global --unset core.pager).
  6. taco: ignoring malformed config ...: repair or delete ~/.config/TangoMan75/taco/config.json; the built-in default takes over meanwhile.

πŸ§ͺ Testing Strategy

  1. Standalone suite: python3 tests/test_taco.py drives TransformerFactory and LineTransformer directly with no pytest or third-party harness, covering diff/grep/status shapes, presets, config persistence, pager selection, broken pipes and idempotency.
  2. Behavioural spec: features/taco.feature documents the expected behaviour as Gherkin scenarios and is linted in CI.
  3. Lint: pip install ruff && ruff check ..
  4. CI: GitHub Actions runs the test suite on Python 3.10, 3.11 and 3.12, plus the ruff job, for every push and pull request to main.

πŸ› Limitations

  1. ⚠️ Known shapes only: prose or custom log formats are passed through unchanged; extend the handler chain in taco.py to add new shapes.
  2. ⚠️ Terminal support required: OSC 8 links need a capable terminal and are silently inert elsewhere.
  3. ⚠️ Repository-root scoped: paths that resolve outside the root are never linked, and the root must be correct for links to work.
  4. ⚠️ Idempotent short-circuit: any line already containing an OSC 8 sequence is skipped, so a second pass cannot retarget existing links.
  5. ⚠️ config changes Git config: ./entrypoint.sh config sets the global Git pager, which affects every repository on the machine. ./entrypoint.sh install alone leaves Git untouched, and ./entrypoint.sh unconfig reverts the pager change.

🚫 Out of scope

taco will not implement handling for the following terminal tools. Each one can already emit OSC 8 hyperlinks on its own, and adding a duplicate parser to taco would only drift from upstream.

Handle ls output

ls already provides an option to output clickable terminal OSC 8 hyperlinks:

ls --hyperlink

Handle ripgrep output

ripgrep already provides an option to output clickable terminal OSC 8 hyperlinks:

rg --hyperlink-format default

Handle fd output

fd already provides an option to output clickable terminal OSC 8 hyperlinks:

fd --hyperlink

πŸ“ Notes

taco.py reads stdin line by line and walks an ordered chain of handler classes. Each handler returns None when it does not recognise a line; the first non-None result wins. LineContext carries the PathResolver, the UrlTemplate and a per-stream StreamState, which remembers the current file so hunk headers and context lines can refer back to it. Hunk headers link to new_start (plus the three usual context lines) so a click lands on the first changed line.

The default template is file:///{path}; presets use <scheme>://open?url=file:///{file}&line={line}.

🀝 Contributing

Thank you for your interest in contributing to Taco.

Please open an issue first for bugs or feature ideas, and check whether one already exists in the issue tracker. Pull requests should keep the codebase stdlib-only, preserve the class-based handler chain, and pass both python3 tests/test_taco.py and ruff check .. Project conventions are documented in AGENTS.md.

πŸ“œ License

Copyrights (c) 2026 "Matthias Morin" mat@tangoman.io

License Distributed under the MIT license.

If you like Taco please star, follow or tweet:

GitHub stars GitHub followers Twitter

πŸ™ Acknowledgements

  • Python standard library: everything from argument parsing to subprocess paging is stdlib, so there is nothing to install.
  • OSC 8: the terminal hyperlink escape sequence that makes the whole idea work.
  • Git and GNU less: the tools whose output taco is built to read and page.

πŸ‘‹ Let's Build Your Next Project Together !

Clean code. Clear communication.

From first sketch to final launch, I've got your back.

tangoman.io

About

Python stdin filter that turns file paths in git, diff, and grep output into clickable OSC 8 terminal hyperlinks that open in your editor.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages