Skip to content

exlee/codelooker

Repository files navigation

codelooker

A tool to generate standalone HTML reports for Code Reviews, Pull Requests, or technical discussions. It captures code context, highlights lines, and adds annotations in a portable format.

Installation

You can install codelooker using Cargo or by building from source.

1. Via Cargo (Recommended)

If you have a Rust toolchain installed, the easiest way is to install directly from the repository:

cargo install --git https://github.com/exlee/codelooker

2. Build from Source

For manual building, clone the repository and build the release binary:

git clone https://github.com/exlee/codelooker.git
cd codelooker
cargo build --release

The binary will be generated at ./target/release/codelooker. Ensure you move it to a location within your $PATH to use it globally.

3. Pre-built Binaries

If you prefer not to compile it yourself, check the GitHub Releases page for pre-compiled binaries for Linux, macOS, and Windows.

Usage

1. File Mode

Generate a report from a configuration file (TOML, YAML, Script, or Look).

codelooker report.toml --html
codelooker report.look -o my_report.html

2. Builder Mode

Chain commands directly in the terminal to build a report on the fly.

codelooker --title "Bug Report" --snippet main --file app.rs --lines 10-20

File Formats

codelooker supports 4 input types. TOML and YAML are standard structure. The custom formats are detailed below:

Script Format (.script)

A line-separated list of builder commands. Useful for shell-script-like generation without the shell overhead.

Example:

--title "Post-Mortem"
--snippet crash_point
--file calc.c
--lines 3-12
--note "The crash occurs here."

Look Format (.look)

A shorthand, minimal format for rapid writing.

Structure:

  1. Header: Metadata like theme: base16-ocean.dark.
  2. Title/Description: Free text block at the top.
  3. Snippets: Defined as id:path:range (e.g., crash_point:calc.c:3-12).
  4. Annotations:
    • Marks: Line::Name (e.g., 12::crash_line).
    • Links: Line:TargetID:Note (e.g., 6:bad_parsing:See this logic).

Command Reference

Flag Description
--html Generate HTML output (Default is Terminal).
--extract <FILE> Extract source manifest from an existing HTML report.
--list-themes Show available syntax highlighting themes.

Builder Commands

  • --snippet <ID>: Start a new code block.
  • --file <PATH> / lines <RANGE>: Define file context.
  • --mark / link: Add annotations to specific lines.
  • --note <TEXT>: Attach text to the current context (supports Markdown).

Examples

Generate a sample configuration to start

codelooker --example-toml > codelooker.toml

Build a quick report for a bug

codelooker --title "Null Pointer" \
           --snippet core --file lib.rs --lines 15-25 \
           --mark --line 20 --note "Panic here" \
           --html -o bug.html

TODO

  • set up versioning
  • add more themes
  • command line tests
  • README/CHANGELOG etc.
  • improve help

About

A tool to generate standalone HTML reports for Code Reviews, Pull Requests, or technical discussions. It captures code context, highlights lines, and adds annotations in a portable format.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors