git-seek

Crates.iogit-seek
lib.rsgit-seek
version1.3.0
created_at2025-12-26 11:10:18.429359+00
updated_at2025-12-30 06:25:28.033312+00
descriptionQuery Git repositories using Trustfall's GraphQL-like syntax
homepagehttps://github.com/starfy84/git-seek
repositoryhttps://github.com/starfy84/git-seek
max_upload_size
id2005588
size47,330
Dereck Tu (starfy84)

documentation

README

git-seek CLI

A command-line tool for querying Git repositories using Trustfall's GraphQL-like syntax.

Installation

From crates.io

cargo install git-seek

From source

git clone git@github.com:starfy84/git-seek.git
cd git-seek
cargo build --release -p git-seek

Usage

Basic Queries

# Query repository name
git-seek --query '{repository {name @output}}'

# Query all branches
git-seek --query '{repository {branches {name @output}}}'

# Query commits with their messages
git-seek --query '{repository {commits {hash @output message @output}}}'

Input Methods

You can provide queries in three ways:

  1. Inline query (using --query or -q):

    git-seek --query '{repository {name @output}}'
    
  2. From file (using --file or -f):

    git-seek --file my-query.graphql
    
  3. Via stdin (pipe input):

    echo '{repository {name @output}}' | git-seek
    

Variables

Use variables in your queries with --var:

git-seek --query '{repository {name @output}}' --var repo_name=my-repo

Output Formats

Control the output format with --format:

  • raw (default) - Raw debug output
  • json - Pretty-printed JSON
  • table - Human-readable table
# JSON output
git-seek --query '{repository {branches {name @output}}}' --format json

# Table output
git-seek --query '{repository {commits {hash @output message @output}}}' --format table

Examples

Repository Information

git-seek --query '{
  repository {
    name @output
  }
}' --format json

Branch Listing with Latest Commits

git-seek --query '{
  repository {
    branches {
      name @output
      commit {
        hash @output
        message @output
      }
    }
  }
}' --format table

Recent Commits

git-seek --query '{
  repository {
    commits {
      hash @output
      message @output
    }
  }
}' --format table

Limited Commit History

# Get only the last 5 commits
git-seek --query '{
  repository {
    commits(limit: 5) {
      hash @output
      message @output
      author @output
    }
  }
}' --format table

Error Handling

The tool provides helpful error messages:

  • If no query is provided and stdin is a terminal, it will prompt for input method
  • Invalid Trustfall syntax will show parsing errors
  • Git repository errors (e.g., not in a Git repo) are clearly reported

Development

# Run tests
cargo test -p git-seek

# Build in debug mode
cargo build -p git-seek

# Run with debug output
RUST_LOG=debug git-seek --query '{repository {name @output}}'

Dependencies

  • trustfall_git_adapter - The Git adapter library
  • clap - Command-line argument parsing
  • git2 - Git repository access
  • serde_json - JSON serialization
  • comfy-table - Table formatting
  • anyhow - Error handling

License

BSD-3-Clause

Commit count: 0

cargo fmt