Skip to main content

CLI tool for fetching AGENTS.md files from GitHub

Project description

agent-fetch

A Python command-line tool for fetching AGENTS.md files (or other markdown/docs) from GitHub repositories.

🚀 Features

  • Interactive-first: Default command triggers beautiful interactive file selection
  • Flexible Automation: Flags let advanced users skip interaction with --all, --name, or --repo
  • Configurable Defaults: Global default repo stored in config with branch overrides
  • Beautiful UI: Colorful menus with arrow key navigation and fuzzy search using questionary
  • Cross-platform: Works on Linux, macOS, and Windows

📦 Installation

# Option 1: Traditional pip installation
pip install -e .

# Option 2: Modern uv installation (recommended)
uv pip install -e .

🎯 Quick Start

Default Setup (No Configuration Required)

The tool comes with a pre-configured default repository and works immediately:

# Interactive mode (with default repo)
agentfetch

Change Default Repository (Optional)

If you want to use a different repository:

agentfetch set-repo https://github.com/your-org/docs

Quick Usage Examples

# Interactive mode (default)
agentfetch

# Fetch all files from default repo
agentfetch main --all

# Search for specific files
agentfetch main --name "api"  # Fuzzy matching

# Use different repository
agentfetch main --all --repo https://github.com/org/docs

Expected Interactive Output

📁 Files in index.yaml
Select files to fetch using ↑/↓ arrows, space to select, enter to confirm

❯ Python APIs Guide
  Shadcn UI Components Guide
  Next.js App APIs Guide

📋 Commands

Command Description
agentfetch Interactive mode (default)
agentfetch --all Fetch all files
agentfetch --name <query> Fetch by name (fuzzy matching)
agentfetch --repo <url> Fetch from alternate repo
agentfetch --branch <branch> Fetch from specific branch
agentfetch --no-overwrite Skip existing files
agentfetch set-repo <url> Set global default repo
agentfetch show-repo Display current config
agentfetch list List files in index.yaml
agentfetch validate Validate index.yaml

🔧 Configuration

Configuration is stored in:

  • Linux/macOS: ~/.agentfetch/config.yaml
  • Windows: %APPDATA%\agentfetch\config.yaml

Example config:

default_repo: "https://github.com/org/agents"
default_branch: "main"

📁 Index File Specification

The tool expects an index.yaml file in the repository root with this structure:

agents:
  - name: "Root Guide"           # Human-readable name
    source: "AGENTS.md"          # Repo-relative path
    target: "downloads/root.md"  # Local destination

  - name: "API Guide"
    source: "services/api/AGENTS.md"
    target: "downloads/api.md"

🔍 Example Workflows

Standard Development Workflow

# Set up default repository
agentfetch set-repo https://github.com/your-org/docs

# Interactive selection for daily use
agentfetch

# Automate fetching all docs
agentfetch --all

# Fetch specific documentation
agentfetch --name "user guide"

CI/CD Integration

# Non-interactive batch operation
agentfetch --all --repo https://github.com/org/docs --branch main

Multi-Repository Setup

# Fetch from monorepo
agentfetch --repo https://github.com/org/monorepo

# Fetch from specific branch
agentfetch --repo https://github.com/org/monorepo --branch feature/new-docs

🛠️ Development

This tool is modular and easily extensible, following Python best practices with:

  • OOP Design: Clean class-based architecture
  • Separation of Concerns: Config, fetching, parsing, and UI as separate modules
  • Robust Error Handling: Comprehensive error handling throughout
  • Rich UI: Beautiful, colorful console output with Rich

Project Structure

agents_collector/
├── config/              # Configuration management
├── fetcher/             # GitHub fetching logic
├── parser/              # Index file parsing
├── cli/                 # Command-line interface
├── ui/                  # Interactive UI components
└── __init__.py

Dependencies

  • typer: CLI framework
  • pyyaml: YAML parsing
  • requests: HTTP client
  • questionary: Interactive menus
  • rapidfuzz: Fuzzy matching
  • rich: Beautiful console output

🤝 Contributing

The tool follows a modular architecture that makes it easy to:

  • Add new fetcher backends (GitLab, local files, etc.)
  • Extend interactive selection features
  • Add new CLI commands
  • Support additional index file formats

📄 License

MIT License


🎉 Why agent-fetch?

This tool makes it simple to collect, organize, and update AGENTS.md files across monorepos or multiple projects, ensuring consistency for both developers and coding agents.

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

agent_fetch-0.1.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

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

agent_fetch-0.1.0-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file agent_fetch-0.1.0.tar.gz.

File metadata

  • Download URL: agent_fetch-0.1.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.15

File hashes

Hashes for agent_fetch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5ec0dd28debd4a501f9d0f2d8ec049fa4a1679ad35192a03551108ab1ef66bac
MD5 2a6b45644542b2b2a44364dfe6200ad2
BLAKE2b-256 15f69d2524e32ac112f7d1d7359771a8af478c29b4b3d583411465b96cc4c823

See more details on using hashes here.

File details

Details for the file agent_fetch-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_fetch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 786a814f093385b317e0af408a7061043504e2bbb7871d3287fc1d6dc0bef4d3
MD5 7cf23238fa401d6c5cde3f8d37ef8f3d
BLAKE2b-256 84f8eef97a6a6e58b6692b4d020e82ee1705e373a63c25d7d23bd0d378c66667

See more details on using hashes here.

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