Skip to content

CLI Reference

Complete reference for Tameshi command-line interface.

Commands Overview

CommandPurpose
scan runRun vulnerability scanners on Solidity files
transform sol2irConvert Solidity to ThalIR intermediate representation
analyzeRun combined deterministic + LLM analysis
pipelineFull Solidity → ThalIR transformation pipeline
debugDebug IR dump for analysis
validateValidate ThalIR syntax

scan run

Run deterministic vulnerability scanners on Solidity source files.

Basic Usage

bash
tameshi scan run -i <file-or-directory>

Examples

Scan a single file:

bash
tameshi scan run -i MyContract.sol

Scan all contracts in a directory:

bash
tameshi scan run -i contracts/

Scan with JSON output:

bash
tameshi scan run -i MyContract.sol --format json > findings.json

Options

FlagValuesDefaultDescription
--input, -ipath-Input file or directory to scan
--suitedeterministic, alldeterministicScanner suite to use
--formatconsole, json, markdownconsoleOutput format
--min-confidencelow, medium, highmediumMinimum confidence threshold
--verbose, -v-falseShow detailed scanning progress

Output Formats

Console (default):

[CRITICAL] Reentrancy Vulnerability
  Location: Bank.sol:14
  Confidence: High (0.95)
  ...

JSON:

json
{
  "findings": [
    {
      "severity": "Critical",
      "confidence": 0.95,
      "title": "Reentrancy Vulnerability",
      "location": { "file": "Bank.sol", "line": 14 }
    }
  ]
}

Markdown:

markdown
## Critical Findings

### Reentrancy Vulnerability
- **Location**: Bank.sol:14
- **Confidence**: High (0.95)

transform sol2ir

Convert Solidity source code to ThalIR intermediate representation.

Basic Usage

bash
tameshi transform sol2ir -i <input-file>

Examples

Transform to text format:

bash
tameshi transform sol2ir -i MyContract.sol --format text

Transform to JSON:

bash
tameshi transform sol2ir -i MyContract.sol --format json -o output.json

Options

FlagValuesDefaultDescription
--input, -ipath-Input Solidity file
--format, -ftext, json, json-prettyjsonOutput format
--output, -opathstdoutOutput file path
--verbose, -v-falseShow transformation details

When to Use

Transform Solidity to ThalIR to:

  • Inspect the IR representation
  • Debug IR-level scanner behavior
  • Develop custom IR-based scanners
  • Submit IR to external analysis tools

analyze

Run comprehensive analysis combining deterministic scanners and LLM-powered detection.

Basic Usage

bash
tameshi analyze <file-or-directory>

Examples

Run hybrid analysis with default settings:

bash
export OPENAI_API_KEY="your-key"
tameshi analyze MyContract.sol

Analyze with custom model:

bash
tameshi analyze MyContract.sol --model gpt-4 --format json

Filter correlated findings only:

bash
tameshi analyze MyContract.sol --cross-validated-only

Options

FlagValuesDefaultDescription
--format, -ftext, json, markdowntextOutput format
--min-severity, -slow, medium, high, criticallowMinimum severity
--min-confidence, -clow, medium, highlowMinimum confidence
--cross-validated-only-falseShow only correlated findings
--correlation-threshold0.0-1.00.7Correlation score threshold
--modelmodel namegpt-4oLLM model to use
--output, -opathstdoutOutput file path
--no-llm-falseSkip LLM analysis
--llm-only-falseOnly run LLM scanners
--verbose, -v-falseEnable verbose output

LLM Configuration

Set your API key via environment variable:

bash
export OPENAI_API_KEY="sk-..."

Or use a configuration file at .tameshi/llm-config.yaml:

yaml
provider:
  type: openai
  model: gpt-4
  api_key: ${OPENAI_API_KEY}

Common Workflows

CI/CD Pipeline

Fail builds on critical vulnerabilities:

bash
tameshi scan run -i src/ --min-severity critical --format json
if [ $? -ne 0 ]; then
  echo "Critical vulnerabilities found"
  exit 1
fi

Pre-Commit Hook

Quick scan before committing:

bash
#!/bin/bash
# .git/hooks/pre-commit
git diff --cached --name-only | grep ".sol$" | while read file; do
  tameshi scan run -i "$file" --min-confidence high
done

Security Audit Report

Generate comprehensive markdown report:

bash
tameshi analyze contracts/ \
  --format markdown \
  --min-confidence medium \
  --cross-validated-only > audit-report.md

Fast Feedback Loop

Scan only changed files with high confidence:

bash
tameshi scan run -i MyContract.sol --min-confidence high --verbose

Exit Codes

CodeMeaning
0Success, no critical findings
1Critical or high severity findings detected
2Scan failed due to error

Configuration

Configure default behavior in .vscode/settings.json (for VSCode integration) or via environment variables:

bash
# Set default minimum severity
export TAMESHI_MIN_SEVERITY=medium

# Set default output format
export TAMESHI_OUTPUT_FORMAT=json

Debug and Validation Commands

debug

Dump IR structure for debugging:

bash
tameshi debug -i MyContract.sol --verbose

validate

Validate ThalIR syntax:

bash
tameshi validate -i output.thalir

pipeline

Run full transformation pipeline:

bash
tameshi pipeline -i MyContract.sol

Next Steps

Released under the MIT License.