Declare and manage your repositories (on multiple platforms) + code search engine

So I was being dumb and trying to manage all my repos declaratively just like NixOS, descriptions, public/private, etc. on multiple git forges in case one goes down (gh -_-) or smth like that, and also want to be able to concurrently push/pull to all remotes (well also i want to be able to clone all my repos if i get a new machine, and keep everything synchronized, and there’s also a exec command to run commands in those repo directories)

And also, I’ve eyeing a code search tool (zoekt) for a very long time now but deploying it seems to be a drag. Since I already have all my repos declared in a static toml file, why not just make a wrapper around zoekt and have it periodically index (configurable) the code and serve the web ui

miroir is a cli tool (on user side, but can also act as a code search indexer/api, it works on both bare mode and regular checkouts):

$ miroir
Repo manager wannabe?

Usage:
  miroir [command]

Available Commands:
  completion  Generate shell completion script
  exec        Execute command in repo(s)
  fetch       Fetch from all remotes
  help        Help about any command
  index       Start index daemon (fetch, index, serve)
  init        Initialize repo(s)
  pull        Pull from origin
  push        Push to all remotes
  sweep       Remove archived and untracked repos from workspace
  sync        Sync metadata to all forges

Flags:
  -a, --all             Target all repos
  -c, --config string   Config file path
  -f, --force           Force operation
  -h, --help            Help for miroir
  -n, --name string     Target repo by name
      --no-tty          Force plain output
      --tty             Force TTY output
  -v, --version         Version for miroir

Use "miroir [command] --help" for more information about a command.

eventually i want to have this as a part of my system activation

demo

metadata sync:

https://github.com/user-attachments/assets/978fa8af-b49a-4215-914c-a92f96463ac0

code search server:

https://github.com/user-attachments/assets/98252e6c-7352-4628-87c6-72942a3a3006

module implementation: dotfiles/modules/nixos/neogrok.nix at 3656e1b4841217639e7de9d2c01deadb2064fd84 · stepbrobd/dotfiles · GitHub

8 Likes

btw i forgot to mention miroir metadata sync currently supports github (haven’t tested on any enterprise instances tho), gitlab (official or hosted), codeberg (and derivative forges), and sourcehut (official)

this can also be used as a repo migration tool if you want to jump ship from one forge to another :wink:

more context here Miroir