furca

command module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2025 License: MIT Imports: 3 Imported by: 0

README ΒΆ

Furca

Keep your GitHub forks effortlessly fresh.

Build Status Go Reference Go Report Card Go 1.24 License

Table of Contents

Overview

Furca is a command-line tool built in Go designed to automate the synchronization of forked GitHub repositories with their upstream sources. It simplifies the developer experience by automatically fetching repository information, determining if forks are behind their upstream repositories, and synchronizing them accordingly when executed.

Features

  • Automatically detects all your forked repositories
  • Identifies which forks are behind their upstream repositories
  • Synchronizes forks with upstream changes
  • Concurrent processing for efficiency
  • Clear, structured output showing sync status

Installation

From Source
# Clone the repository
git clone https://github.com/TFMV/furca.git
cd furca

# Build the binary
go build -o furca

# Move to a directory in your PATH (optional)
mv furca /usr/local/bin/
Using Go Install
go install github.com/TFMV/furca@latest

Configuration

Furca requires a GitHub personal access token with the repo scope to access your repositories. You can provide this token in one of two ways:

  1. Environment variable:

    export GITHUB_TOKEN=your_github_token_here
    
  2. .env file in the current directory:

    GITHUB_TOKEN=your_github_token_here
    

You can also create a .furca file in your home directory with the same format.

Additional Configuration Options

You can configure the following options either via command-line flags or in your .env file:

Environment Variable Command-line Flag Description Default
GITHUB_TOKEN - GitHub personal access token (required)
LOG_LEVEL - Logging verbosity (debug, info, warn, error) info
DRY_RUN --dry-run Preview changes without syncing false
JSON_OUTPUT --json Output results in JSON format false
MAX_RETRIES --max-retries Maximum retry attempts for API operations 2
RETRY_DELAY --retry-delay Delay in seconds between retries 3

Example .env file:

GITHUB_TOKEN=your_github_token_here
LOG_LEVEL=debug
DRY_RUN=true
JSON_OUTPUT=true
MAX_RETRIES=3
RETRY_DELAY=5

Command-line flags take precedence over environment variables.

Usage

Sync Command

The primary command is sync, which synchronizes all your forked repositories with their upstream sources:

furca sync

This will:

  1. Fetch all your forked repositories
  2. Check which ones are behind their upstream
  3. Synchronize the ones that are behind
  4. Display the results
Advanced Options
Dry Run Mode

Preview which repositories would be synced without making any changes:

furca sync --dry-run

Example output:

[DRY-RUN] βœ… awesome-project is up to date with upstream
[DRY-RUN] πŸ”„ Would sync cool-library (behind by 5 commits)
JSON Output

Get structured JSON output for integration with other tools:

furca sync --json

Example output:

{
  "synced": ["weaviate", "duckdb-wasm"],
  "up_to_date": ["pattern", "simdjson-go"],
  "errors": {
    "codon": "failed to compare commits: 404 Not Found"
  },
  "timestamp": "2025-03-07T16:30:00Z"
}
Retry Configuration

Configure retry behavior for API operations:

furca sync --max-retries=3 --retry-delay=5
Log Level

Control the verbosity of logging:

# In .env file or environment variable
LOG_LEVEL=debug  # Options: debug, info, warn, error, dpanic, panic, fatal

Example Output

Fetching forked repositories...
Found 5 forked repositories
βœ… awesome-project is up to date with upstream
πŸ”„ Successfully synced cool-library with upstream (was behind by 2 commits)
❌ Error checking useful-tool: failed to compare commits: 404 Not Found
βœ… example-repo is up to date with upstream
πŸ”„ Successfully synced test-project with upstream (was behind by 5 commits)

πŸ“Š Summary:
πŸ”„ Synced repositories: 2
βœ… Up-to-date repositories: 2
❌ Errors encountered: 1

See logs for details.

Requirements

  • Go 1.18 or higher
  • GitHub personal access token with repo scope

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation ΒΆ

Overview ΒΆ

Package main provides the entry point for Furca, a tool to keep GitHub forks effortlessly fresh.

Furca automates the synchronization of forked GitHub repositories with their upstream sources. It simplifies the developer experience by automatically fetching repository information, determining if forks are behind their upstream repositories, and synchronizing them accordingly.

Directories ΒΆ

Path Synopsis
Package cmd implements the command-line interface for Furca.
Package cmd implements the command-line interface for Furca.
Package github provides functionality for interacting with the GitHub API.
Package github provides functionality for interacting with the GitHub API.
Package logger provides structured logging functionality for Furca.
Package logger provides structured logging functionality for Furca.

Jump to

Keyboard shortcuts

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