Brf.it

module
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: MIT

README

Brf.it logo

Brf.it

🌐 English | 한국어 | 日本語 | हिन्दी | Deutsch

Release Downloads Go Report Card Coverage Languages

Package your codebase for AI comprehension.

50 tokens → 8 tokens — Same information, fewer tokens.

A CLI tool and MCP server that extracts function signatures, type definitions, and documentation from your codebase using Tree-sitter — producing compact XML/Markdown context for LLMs like Claude, GPT, and Gemini. Supports 19 languages including Go, TypeScript, Python, Rust, Java, C/C++, and more.

Installation · Quick Start · Supported Languages



How It Works

Instead of feeding raw code to AI assistants:

Before (50+ tokens) After with brfit (8 tokens)
export async function fetchUser(
  id: string
): Promise<User> {
  const response = await fetch(
    `${API_URL}/users/${id}`
  );
  if (!response.ok) {
    throw new Error('User not found');
  }
  const data = await response.json();
  return {
    id: data.id,
    name: data.name,
    email: data.email,
    createdAt: new Date(data.created_at)
  };
}
<function>
  export async function fetchUser(
    id: string
  ): Promise<User>
</function>


Quick Start

Installation

macOS (Homebrew)

brew install indigo-net/tap/brfit

Linux / macOS (Script)

curl -fsSL https://raw.githubusercontent.com/indigo-net/Brf.it/main/install.sh | sh

Windows (PowerShell)

irm https://raw.githubusercontent.com/indigo-net/Brf.it/main/install.ps1 | iex

From Source

git clone https://github.com/indigo-net/Brf.it.git
cd Brf.it
go build -o brfit ./cmd/brfit
First Run
brfit .                    # Analyze current directory
brfit . -f md              # Output in Markdown
brfit . -o briefing.xml    # Save to file


See It In Action

SAMPLE.md | SAMPLE.xml

This project, packaged by brfit itself. Auto-generated on every commit.



Features

Feature Description
Tree-sitter Based Accurate AST parsing for language structure analysis
Multiple Formats XML and Markdown output support
Token Counting Automatic output token calculation
Gitignore Aware Automatically excludes unnecessary files
Cross-Platform Linux, macOS, and Windows support
Security Check Detects and redacts secrets (AWS keys, GitHub tokens, API keys, etc.) in extracted code
Call Graph Extracts function/method call relationships using Tree-sitter queries (Go, TS, Python, Java, Rust, C)


Supported Languages

Language Extensions Documentation
Go .go Go Guide
TypeScript .ts, .tsx TypeScript Guide
JavaScript .js, .jsx TypeScript Guide
Python .py Python Guide
C .c C Guide
C++ .cpp, .hpp, .h C++ Guide
Java .java Java Guide
Rust .rs Rust Guide
Swift .swift Swift Guide
Kotlin .kt, .kts Kotlin Guide
C# .cs C# Guide
Lua .lua Lua Guide
PHP .php PHP Guide
Ruby .rb Ruby Guide
Scala .scala, .sc Scala Guide
Elixir .ex, .exs Elixir Guide
SQL .sql SQL Guide
YAML .yaml, .yml YAML Guide
TOML .toml TOML Guide


CLI Reference

brfit [path] [options]
Options
Option Short Description Default
--format -f Output format (xml, md) xml
--output -o Output file path stdout
--include-body Include function bodies false
--include-imports Include import statements false
--include-private Include non-exported/private symbols false
--ignore -i Ignore file path (can be specified multiple times) .gitignore
--include Glob pattern(s) to include (can be specified multiple times)
--exclude Glob pattern(s) to exclude (can be specified multiple times)
--include-hidden Include hidden files false
--no-tree Skip directory tree false
--no-tokens Disable token counting false
--max-size Max file size (bytes) 512000
--changed Only scan git-modified files false
--since Only scan files changed since commit/tag
--token-tree Show per-file token count tree false
--security-check / --no-security-check Detect and redact secrets (API keys, tokens, etc.) true
--call-graph Extract function call relationships per file false
--version -v Show version
Examples
# Copy to clipboard for AI assistants
brfit . | pbcopy              # macOS
brfit . | xclip               # Linux
brfit . | clip                # Windows

# Analyze project and save
brfit ./my-project -o briefing.xml

# Include function bodies (full code)
brfit . --include-body

# Skip directory tree output
brfit . --no-tree

# Only scan git-modified files
brfit . --changed

# Only scan files changed since a tag
brfit . --since v1.0.0

# Include imports (verbatim)
brfit . --include-imports


MCP Server

brfit-mcp is a standalone Model Context Protocol server that exposes brfit's code analysis as tools for AI agents. It communicates over stdio (JSON-RPC).

Tools
Tool Description
summarize_project Extract signatures from a project directory. Options: path, format, include_body, include_imports, call_graph
summarize_file Extract signatures from files matching a glob pattern. Options: path, include, format
Usage
brfit-mcp --root /path/to/project
Claude Desktop Configuration
{
  "mcpServers": {
    "brfit": {
      "command": "brfit-mcp",
      "args": ["--root", "/path/to/project"]
    }
  }
}


License

MIT License — Use freely in personal and commercial projects.

See LICENSE for details.

Directories

Path Synopsis
cmd
brfit command
Package main is the entry point for the brfit CLI.
Package main is the entry point for the brfit CLI.
brfit-mcp command
Package main provides the brfit MCP (Model Context Protocol) server.
Package main provides the brfit MCP (Model Context Protocol) server.
examples
go command
internal
config
Package config provides CLI configuration management for brfit.
Package config provides CLI configuration management for brfit.
context
Package context provides global configuration and packaging logic for brfit.
Package context provides global configuration and packaging logic for brfit.
profiling
Package profiling provides memory profiling utilities for brfit.
Package profiling provides memory profiling utilities for brfit.
pkg
extractor
Package extractor provides signature extraction from scanned files.
Package extractor provides signature extraction from scanned files.
formatter
Package formatter provides output formatting for brfit.
Package formatter provides output formatting for brfit.
parser
Package parser provides code parsing capabilities for brfit.
Package parser provides code parsing capabilities for brfit.
parser/treesitter
Package treesitter provides Tree-sitter based parser implementations.
Package treesitter provides Tree-sitter based parser implementations.
parser/treesitter/grammars/csharp
Package csharp provides the tree-sitter grammar for C#.
Package csharp provides the tree-sitter grammar for C#.
parser/treesitter/grammars/elixir
Package elixir provides the tree-sitter grammar for Elixir.
Package elixir provides the tree-sitter grammar for Elixir.
parser/treesitter/grammars/kotlin
Package kotlin provides the tree-sitter grammar for Kotlin.
Package kotlin provides the tree-sitter grammar for Kotlin.
parser/treesitter/grammars/lua
Package lua provides the tree-sitter grammar for Lua.
Package lua provides the tree-sitter grammar for Lua.
parser/treesitter/grammars/scala
Package scala provides the tree-sitter grammar for Scala.
Package scala provides the tree-sitter grammar for Scala.
parser/treesitter/grammars/sql
Package sql provides the tree-sitter grammar for SQL.
Package sql provides the tree-sitter grammar for SQL.
parser/treesitter/grammars/swift
Package swift provides the tree-sitter grammar for Swift.
Package swift provides the tree-sitter grammar for Swift.
parser/treesitter/grammars/toml
Package toml provides the tree-sitter grammar for TOML.
Package toml provides the tree-sitter grammar for TOML.
parser/treesitter/grammars/yaml
Package yaml provides the tree-sitter grammar for YAML.
Package yaml provides the tree-sitter grammar for YAML.
parser/treesitter/languages
Package languages provides language-specific Tree-sitter queries.
Package languages provides language-specific Tree-sitter queries.
scanner
Package scanner provides file system scanning capabilities for brfit.
Package scanner provides file system scanning capabilities for brfit.
security
Package security provides secret detection and redaction for extracted code.
Package security provides secret detection and redaction for extracted code.
tokenizer
Package tokenizer provides token counting for brfit output.
Package tokenizer provides token counting for brfit output.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL