Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Configuration

towl uses a .towl.toml file in the project root for configuration. All fields have sensible defaults -- you only need to override what you want to change.

Config File

Create .towl.toml manually or run towl init:

[parsing]
file_extensions = ["rs", "toml", "json", "yaml", "yml", "sh", "bash"]
exclude_patterns = ["target/*", ".git/*"]
include_context_lines = 3

[github]
owner = "your-username"
repo = "your-repo"

Parsing Section

FieldTypeDefaultDescription
file_extensionsstring[]["rs", "toml", "json", "yaml", "yml", "sh", "bash"]File extensions to scan
exclude_patternsstring[]["target/*", ".git/*"]Glob patterns to exclude
include_context_linesinteger3Number of surrounding lines to capture (1-50)
comment_prefixesstring[]["//", "^\\s*#", "/\\*", "^\\s*\\*"]Regex patterns for comment line detection
todo_patternsstring[]See belowRegex patterns for TODO extraction
function_patternsstring[]See belowRegex patterns for function context detection

Default TODO Patterns

todo_patterns = [
    "(?i)\\bTODO:\\s*(.*)",
    "(?i)\\bFIXME:\\s*(.*)",
    "(?i)\\bHACK:\\s*(.*)",
    "(?i)\\bNOTE:\\s*(.*)",
    "(?i)\\bBUG:\\s*(.*)",
]

All patterns are case-insensitive by default. Each pattern must contain a capture group (.*) for extracting the description text.

Default Function Patterns

function_patterns = [
    "^\\s*(pub\\s+)?fn\\s+(\\w+)",            # Rust
    "^\\s*def\\s+(\\w+)",                      # Python
    "^\\s*(async\\s+)?function\\s+(\\w+)",     # JavaScript
    "^\\s*(public|private|protected)?\\s*(static\\s+)?\\w+\\s+(\\w+)\\s*\\(",  # Java/C#
    "^\\s*func\\s+(\\w+)",                     # Go/Swift
]

Pattern Limits

Each pattern field is limited to 100 entries. Individual regex patterns are limited to 256 characters. These limits prevent denial-of-service via malicious configuration files.

GitHub Section

FieldTypeDefaultDescription
ownerstringAuto-detected from git remoteGitHub repository owner
repostringAuto-detected from git remoteGitHub repository name
token----Set via environment variable only
rate_limit_delay_msinteger100Delay in ms between GitHub API calls

Note: The GitHub token is never stored in the config file. Use the TOWL_GITHUB_TOKEN environment variable.

LLM Section

FieldTypeDefaultDescription
providerstringclaudeLLM provider: "claude", "openai", "claude-code", or "codex"
modelstringclaude-opus-4-6Model identifier
base_urlstringProvider defaultCustom endpoint URL (for Ollama, vLLM, etc.)
max_concurrent_analysesinteger5Max concurrent LLM requests (1-20)
max_analyse_countinteger50Max TODOs to analyse per scan (1-500)
max_tokensinteger4096LLM response token limit
commandstringAuto (provider-dependent)Override CLI binary path
argsstring[]Auto (provider-dependent)Override CLI arguments

Note: The LLM API key is never stored in the config file. Use the TOWL_LLM_API_KEY environment variable. See AI Analysis for usage details.

Environment Variables

Seven environment variables override config file values:

VariableOverridesDescription
TOWL_GITHUB_TOKENgithub.tokenGitHub personal access token (stored as SecretString, masked in logs)
TOWL_GITHUB_OWNERgithub.ownerGitHub repository owner
TOWL_GITHUB_REPOgithub.repoGitHub repository name
TOWL_LLM_API_KEYllm.api_keyLLM API key (stored as SecretString, env-only)
TOWL_LLM_PROVIDERllm.providerLLM provider ("claude" or "openai")
TOWL_LLM_MODELllm.modelLLM model identifier
TOWL_LLM_BASE_URLllm.base_urlCustom LLM endpoint URL

Config Loading Order

  1. Built-in defaults
  2. .towl.toml file (or path specified with --path)
  3. Environment variable overrides (TOWL_GITHUB_*, TOWL_LLM_*)

If no .towl.toml exists, defaults are used without error.

Viewing Active Configuration

towl config

Example output:

📋 Towl Configuration
┌─ Parsing
│  ├─ File Extensions: bash, json, rs, sh, toml, yaml, yml
│  ├─ Exclude Patterns: target/*, .git/*
│  ├─ Context Lines: 3
│  ├─ Comment Prefixes:
│  │  ├─ //
│  │  ├─ ^\s*#
│  │  ├─ /\*
│  │  └─ ^\s*\*
│  ├─ TODO Patterns:
│  │  ├─ (?i)\bTODO:\s*(.*)
│  │  ...
│  └─ Function Patterns:
│     ├─ ^\s*(pub\s+)?fn\s+(\w+)
│     ...
└─ GitHub
   ├─ Owner: glottologist
   ├─ Repo: towl
   └─ Token: not set