Skip to content

liphvf/FurLab

Repository files navigation

FurLab Logo

FurLab

A powerful .NET CLI tool to automate common development tasks.

Description

FurLab is a cross-platform command-line interface (CLI) built with .NET that helps developers automate repetitive development tasks. It provides commands for database operations, file management, AI tool installation (Claude Code, OpenCode), and Windows package management.

Note: This is a hobby project created for personal use. It may not follow all best practices or have comprehensive testing. Contributions and feedback are welcome, but please keep in mind this was built to solve the author's specific needs.

Problem It Solves

Developers often perform repetitive tasks that can be automated:

  • Combining multiple files into one
  • Installing and configuring AI development tools
  • Backing up and restoring Windows packages
  • Running SQL queries across multiple PostgreSQL servers

FurLab consolidates these tasks into a single, easy-to-use CLI tool.

Key Features

  • Database Backup: Backup PostgreSQL databases using pg_dump
  • Query Execution: Run SQL queries across multiple PostgreSQL servers with interactive server selection, parallel execution, and CSV export
  • Destructive Query Guard Rail: Automatic detection of INSERT, UPDATE, DELETE, ALTER, DROP, etc. with confirmation prompt
  • Server Management: Add, list, remove, and test PostgreSQL servers via CLI
  • File (Combine): Combine multiple files into one
  • Claude Code Integration: Install and configure Claude Code CLI
  • OpenCode Integration: Install and configure OpenCode CLI
  • Winget Manager: Backup and restore Windows package manager packages

Tech Stack

  • Framework: .NET 10
  • Language: C#
  • CLI Parsing: System.CommandLine
  • Database: Npgsql (PostgreSQL)
  • Configuration: JSONC (furlab.jsonc)
  • UI: Spectre.Console

Installation

Prerequisites

  • .NET SDK 10 or later
  • Windows (required for Claude, OpenCode, and Winget commands)

Install as .NET Tool

dotnet tool install --global FurLab

Or install from NuGet:

dotnet tool install -g FurLab

Build from Source

git clone https://github.com/your-repo/FurLab.git
cd FurLab
dotnet restore
dotnet build

How to Run Locally

Run from Source

dotnet run -- --help

Basic Usage Examples

Query Execution

# Run a SQL file across selected servers
FurLab query run --input query.sql

# Run an inline query
FurLab query run --command "SELECT * FROM users"

# Run with output directory
FurLab query run -i query.sql -o ./results

# Generate one CSV per server
FurLab query run -i query.sql --separate-files

On execution, FurLab shows an interactive server selection prompt (all configured servers are pre-selected). Results are exported to CSV with columns Server, Database, <query columns>.

Server Management

# List configured servers
FurLab settings db-servers ls

# Add a server interactively
FurLab settings db-servers add -i

# Add a server with flags
FurLab settings db-servers add -n dev -h localhost -p 5432 -U postgres -W mypass

# Test connection to a server
FurLab settings db-servers test -n dev

# Remove a server
FurLab settings db-servers rm -n dev

Database Backup

# Backup with default connection settings
FurLab database backup mydb

# Backup with custom connection settings
FurLab database backup mydb --host localhost --port 5432 --username postgres --password mypassword

# Backup with custom output path
FurLab database backup mydb -o "C:\backups\mydb.backup"

Combine Files

FurLab file combine -i "C:\temp\*.sql" -o "C:\temp\result.sql"

Install Claude Code

FurLab claude install

Winget Backup

FurLab winget backup -o "C:\backup"
FurLab winget restore -i "C:\backup\backup-winget.json"

Configuration

FurLab stores user configuration in %LocalAppData%\FurLab\furlab.jsonc (JSONC format with comments support).

Example furlab.jsonc

{
  // PostgreSQL servers configuration
  "servers": [
    {
      "name": "dev",           // Unique identifier
      "host": "localhost",
      "port": 5432,
      "username": "postgres",
      "password": "mypassword",
      "databases": ["mydb", "app_dev"],
      "sslMode": "Prefer",
      "timeout": 30,
      "commandTimeout": 300,
      "maxParallelism": 4
    },
    {
      "name": "prod",
      "host": "prod-db.company.com",
      "port": 5432,
      "username": "readonly",
      "password": "secret",
      "fetchAllDatabases": true,
      "excludePatterns": ["template*", "postgres"],
      "sslMode": "Require"
    }
  ],
  // Default settings
  "defaults": {
    "outputFormat": "csv",
    "outputDirectory": "./results",
    "fetchAllDatabases": false,
    "requireConfirmation": true,
    "maxParallelism": 4
  }
}

Command List

Command Description
query run Execute SQL queries and export to CSV
settings db-servers ls List configured servers
settings db-servers add Add a server (interactive or with flags)
settings db-servers rm Remove a server
settings db-servers test Test server connection
database backup Backup PostgreSQL database
file combine Combine multiple files into one
claude Claude Code integration
opencode OpenCode CLI integration
winget Windows package manager

Query Command Details

Options

Option Description
-i, --input <file> SQL input file
-c, --command <sql> Inline SQL query (mutually exclusive with -i)
-o, --output <path> Output file or directory
--separate-files One CSV per server (default: single consolidated file)
--all, -a Query all databases on server
--exclude <dbs> Comma-separated databases to exclude
--no-confirm Skip destructive query confirmation

CSV Output Format

  • Consolidated (default): Single file with columns Server, Database, <query columns>
  • Separate files (--separate-files): One file per server (<server>_<timestamp>.csv)
  • Errors are logged to the terminal, not included in CSV

Destructive Query Detection

Queries containing INSERT, UPDATE, DELETE, ALTER, DROP, CREATE, TRUNCATE, MERGE, GRANT, REVOKE, or SET ROLE trigger a confirmation prompt before execution. Use --no-confirm to skip in CI/scripts.

Documentation

For more detailed information, see:

Contribution

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please ensure all tests pass and code follows the project's coding standards.

License

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


🇺🇸 English (default)
🇧🇷 Portuguese: README.pt-BR.md

Packages

 
 
 

Contributors