Skip to main content

Print the structural outline of source files for LLM navigation

Project description

outliner

Print the structural outline of source files — useful declarations and callable landmarks with line ranges — so an LLM agent (or human) can navigate a file without reading it whole.

Usage

outliner-cli [OPTIONS] [FILE...]
Option Description
-g, --grep EXPR Only show items whose signature matches EXPR (case-insensitive)
-s, --syntax LANG Override syntax auto-detection when it is ambiguous
-w, --width COLS Truncate output lines to COLS (0=unlimited, auto=terminal, default=120)

Pass a file, a directory (walked recursively), or omit arguments to read stdin. Use - to read stdin explicitly. --syntax is only needed when content auto-detection cannot identify the language (e.g. an ambiguous extensionless script piped on stdin).

Output

 3,4   type Driver struct
19,6   func New() *Driver
26,12  func (d *Driver) StartLogging(ctx context.Context, f *os.File) error

Each line: <start>,<count> <signature>

  • start — 1-based line number, right-aligned
  • count — number of lines covered by the item (including doc-comments above)
  • signature — first non-comment line of the declaration; multi-line signatures are merged into one line; lines longer than the output width are truncated with ...

Nesting is visible in two ways: overlapping ranges (a class range contains its methods) and native-format indentation in the signature (indented for code, #/## heading levels for Markdown).

Installation

pip install outliner

Running

# With the package installed (pip or uvx):
uvx outliner-cli path/to/file.py

# From within the outliner/ directory
uv run outliner-cli path/to/file.py

Running Tests

# From within the outliner/ directory
uv run pytest

Supported Languages

AsciiDoc, C/C++, C#, Clojure, Go, HTML, Java, JavaScript/TypeScript, Markdown, Org-mode, Perl, PHP, Python, reStructuredText, Ruby, Rust, Scala, Shell, Swift, and Zig.

Example Use Cases

Structural overview — Run on a directory to see all declarations across many files before reading anything:

$ uvx outliner-cli src/
==> src/billing.py <==
 12,8   class Invoice
 22,4   def create(customer_id: str, items: list[Item]) -> Invoice
 38,6   def send(invoice: Invoice, method: str) -> bool

==> src/payments.py <==
  8,3   class PaymentMethod
 14,12  def charge(method: PaymentMethod, amount: Decimal) -> Receipt

Find all copies of a pattern--grep serialize across a source tree locates every implementation of a repeated function in one command:

$ uvx outliner-cli --grep serialize src/
==> src/invoice.py <==
 44,5   def serialize(self) -> dict

==> src/receipt.py <==
 31,3   def serialize(self) -> dict

Find functions whose interface mentions a term--grep searches signatures, not bodies. It finds functions whose interface involves a concept, skipping internal uses, comments, and call sites:

$ uvx outliner-cli --grep payment src/
 14,12  def charge(method: PaymentMethod, amount: Decimal) -> Receipt
 61,4   def refund(payment: Payment) -> bool

Find functions accepting a specific type--grep PaymentMethod locates every function where the type appears in parameters, return types, or generic bounds. Multi-line signatures are merged into a single line before matching, so nothing is missed:

$ uvx outliner-cli --grep PaymentMethod src/
 14,12  def charge(method: PaymentMethod, amount: Decimal) -> Receipt
 88,4   def validate(m: PaymentMethod) -> bool

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

outliner_cli-0.2.0.tar.gz (78.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

outliner_cli-0.2.0-py3-none-any.whl (49.5 kB view details)

Uploaded Python 3

File details

Details for the file outliner_cli-0.2.0.tar.gz.

File metadata

  • Download URL: outliner_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 78.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for outliner_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1674eb290274bf832457eed3ae696ab3caa673f36b3b2cca3b2e40239628881b
MD5 bf8069bcd7c5985dc66292cd594f594c
BLAKE2b-256 fdf572a1a3f4f9f7c97e9bc91f0dbad730aefcd187ab68207e05333ae083fa68

See more details on using hashes here.

Provenance

The following attestation bundles were made for outliner_cli-0.2.0.tar.gz:

Publisher: publish-outliner.yml on cederberg/incubator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file outliner_cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: outliner_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 49.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for outliner_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 952222b979ae360086e357af842874b116d062f3fe5041e0b71d83e046396e33
MD5 08f70609d7dfb031bd466aebec2bc005
BLAKE2b-256 612b400203254f1f9757ee7f0174dd4b8d0988fac9933658b3399a213e334c23

See more details on using hashes here.

Provenance

The following attestation bundles were made for outliner_cli-0.2.0-py3-none-any.whl:

Publisher: publish-outliner.yml on cederberg/incubator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page