#git #cli #remotes #user #fws-rs

app fws-rs

an open source utility that facilitates selected tasks for creative usage of self-hosted Forgejo instances

1 unstable release

new 0.1.0 Apr 13, 2025

#926 in Command line utilities

AGPL-3.0-only

31KB
484 lines

fws-rs

fws-rs is an open source [command-line] utility designed to reduce reliance on the web-interface for management of repositories and users on self-hosted Git platforms, with Forgejo as its primary target platform. It facilitates repository creation, user mangement, and repository mirroring across multiple platforms.

The name fws-rs is derived from the German word "FWS" which stands for "Forgejo Werkstatt", and the suffix "-rs" indicates that it is written in Rust.

Features

  • Create repositories on Forgejo instances.
  • Invite users to organizations.
  • Add members to organizations.
  • Generate mirror remotes for repositories on platforms like GitHub and Codeberg.
  • Reflect changes to mirror repositories by pushing updates.

Usecaes

  • if you're an avid writer, and use Git to version control, collaborate, or publish your work, fws-rs can help you create a repository with a single command and a series of prompts.
  • if you're the leader of a team which uses multiple projects on Git, fws-rs can help you assign a user to a team within an organization with a single command and a series of prompts.
  • if you're using an off-grid Git platform, fws-rs can help you maintain multiple mirrors of your repositories [on GitHub, Codeberg, or etc] with a single command and a series of prompts.

Installation

To build and install fws-rs, ensure you have Rust installed, then run:

cargo install --git https://git.schloosser.net/werkzeuge/fws-rs

Configuration

Create a configuration file named fws.toml in your home directory in a folder named dotfiles with the following structure:

base_url = "https://your.forgejo.instance/api/v1"
token = "your_forgejo_token"

[mirrors.github]
platform = "GitHub"
token = "your_github_token"
org = "your_github_org"

[mirrors.codeberg]
platform = "Forgejo"
token = "your_codeberg_token"
org = "your_codeberg_org"
base_url = "https://codeberg.org/api/v1"

Replace the placeholders with your actual Forgejo, GitHub, and Codeberg credentials and organization names.

Usage

Run the following commands from your terminal:

Create a Repository

fws create-repo <repository-name>

Prompts for repository visibility (public/private) and description, then creates the repository on your Forgejo instance.

Invite a User

fws assign-member <username>

Invites an existing user to your Forgejo organization.

Add a Member (Admin Only)

fws new-member <email>

Registers a new user with the provided email and adds them to your Forgejo organization.

Generate Mirror Remotes

fws gen-mirrors <repository-name>

Creates mirror repositories on configured platforms (e.g., GitHub, Codeberg) and adds them as remotes to your local Git repository.

Reflect Changes to Mirrors (experimental)

fws reflect-on-mirrors [--branch <branch-name>] [--mirror]

Pushes the specified branch (default: current branch) or all branches and tags (--mirror flag) to all configured mirror remotes.

License

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

Dependencies

~7–23MB
~275K SLoC