1
0
Fork
You've already forked fjctl
0
CLI for maintaining Forgejo repositories as IaC https://fjctl.netlify.app/
  • Haskell 96.6%
  • Shell 1.6%
  • Just 1.6%
  • Mustache 0.2%
patrick brisbin 9e710bf194
All checks were successful
CI / test (pull_request) Successful in 34s
CI / lint (pull_request) Successful in 9s
CI / test (push) Successful in 34s
CI / lint (push) Successful in 7s
CI / test-docs (pull_request) Successful in 11s
CI / test-integration (pull_request) Successful in 25s
CI / test-docs (push) Successful in 11s
CI / test-integration (push) Successful in 26s
Release / release (push) Successful in 3m45s
fix(release): trigger release
2025年10月14日 14:36:17 -04:00
.forgejo/workflows chore(release): don't publish css files 2025年10月14日 14:13:04 -04:00
app Finalize FJCTL rename 2025年09月17日 16:17:00 -04:00
dist/fjctl Implement installation archive 2025年09月29日 12:25:38 -04:00
docs fix(docs): use mdoc for man-page generation 2025年10月14日 11:12:54 -04:00
files Test defaulting behaviors 2025年09月17日 14:42:37 -04:00
headroom-templates chore: add AGPLv3 license headers 2025年02月06日 17:14:11 -05:00
integration chore(ci): update config.yaml for out of band change 2025年10月03日 16:18:21 -04:00
src feat!: replace --docs with --doc 2025年10月14日 13:32:41 -04:00
test chore: remove DocsSpec 2025年10月14日 13:20:57 -04:00
.gitignore fix(docs): use mdoc for man-page generation 2025年10月14日 11:12:54 -04:00
.headroom.yaml chore: add AGPLv3 license headers 2025年02月06日 17:14:11 -05:00
.hlint.yaml chore: enable QuasiQuotes all the time 2025年02月19日 12:35:58 -05:00
.releaserc.yaml fix(release): implement semantic-release on CI 2025年09月29日 12:43:04 -04:00
.restyled.yaml Add repository.schema.json 2025年05月08日 11:44:58 -04:00
CHANGELOG.md Remove more GitHub naming 2025年09月17日 15:19:44 -04:00
COPYING chore: add AGPLv3 license headers 2025年02月06日 17:14:11 -05:00
fjctl.cabal chore: remove DocsSpec 2025年10月14日 13:20:57 -04:00
fourmolu.yaml feat: scaffold Haskell CLI 2025年02月05日 09:35:35 -05:00
justfile feat!: replace --docs with --doc 2025年10月14日 13:32:41 -04:00
package.yaml chore: remove DocsSpec 2025年10月14日 13:20:57 -04:00
README.md chore(docs): update README 2025年10月03日 16:27:30 -04:00
stack.yaml fix(docs): use mdoc for man-page generation 2025年10月14日 11:12:54 -04:00
stack.yaml.lock fix(docs): use mdoc for man-page generation 2025年10月14日 11:12:54 -04:00
weeder.toml Finalize FJCTL rename 2025年09月17日 16:17:00 -04:00

fjctl

CLI for maintaining Forgejo repositories as IaC.

Installation

Binary

Note

Due to the limitation of my self-hosted Forgejo Actions runner, we only build Linux binaries right now.

curl -L "https://codeberg.org/pbrisbin/fjctl/releases/download/v${VERSION}/fjctl-${VERSION}-Linux-x86_64.tar.gz" | tar xvzf -
cd fjctl
make install PREFIX=$HOME/.local # user installation
sudo make install # global installation, likely needs root

Installation includes man-pages fjctl.1 (the CLI) and fjctl.5 (the configuration file) and shell completions for bash, fish, and zsh.

Source

Building from source requires a Haskell tool-chain, specifically Stack.

git clone https://codeberg.org/pbrisbin/fjctl && cd fjctl
just dist-check # to install everything (in ~/.local)
stack install # to install just the binary
stack exec -- fjctl ... # to run without installation

Getting Started

  1. Create ~/.config/fjctl/config.yaml (assuming default $XDG variables)

  2. Add a defaults key with properties you want for all repositories

    defaults:has_actions:trueallow_merge_commits:falsedefault_delete_branch_after_merge:truedefault_merge_style:fast-forward-onlydefault_update_style:rebase
  3. Add a repositories key with name-properties pairs

    To accept all defaults, use {}. Otherwise, add the properties that differ from defaults for this repository.

    repositories:pbrisbin/hs-shellwords:description:Parse a string into a list of words, like a shell wouldhas_releases:trueallow_merge_commits:true
  4. Run fjctl to compare the on-disk state to the server state and report any differences

  5. Add --apply to make the server state match the on-disk state

For an example, see my own (work in progress) config.yaml.

Migration

The --create-via-migrate option can be used to migrate, instead of create, any configured repositories that do not exist on the server. By default, this migrates the same-named repository from GitHub and uses no authentication. This can be adjusted by adding a migrate_options stanza in the configuration file:

migrate_options:clone_addr_template:"https://github.com/{owner}/{name}.git"auth_token:nullauth_username:nullauth_password:nulllabels:falsemilestones:false

Deletion

fjctl will report, but not delete, things that exist on the server but not in the configuration. This includes variables, branch-protections, and whole repositories.

It's an open feature to handle deletes in a safe and intuitive way.

Usage

See fjctl(1) for CLI usage and fjctl(5) for documentation of the configuration file.

License

This project is licensed AGPLv3. See COPYING.