Running setdef's projects takes steps that someone has to get right every time, such as creating a project's repository and opening its category on setdef's Discourse forum. setdef writes down here what it learns about each step, so that the knowledge outlasts one person's memory and one conversation with an agent. Each runbook says how to do one step and why, and its Ruby script carries the step out the same way for whoever does the work.
The runbooks here cover setting up a project's GitHub repository and its category on a Discourse forum, and checking the repositories later for drift. A runbook is for what people do to the projects; code that every project runs, such as its CI workflows, goes instead in a shared library, which for setdef is Cutter.
The scripts set a project up the way setdef runs its projects: each repository has the same settings and collaborators, only collaborators open issues, nobody can change a published release's assets or tag, the default branch is trunk before 1.0.0 and stable from then on, and people outside the project ask questions and send patches by email to the project's category on the forum. An admin of a GitHub organization or a Discourse forum who runs projects the same way can use the runbooks too.
Each runbook is a Markdown page in two parts. In its steps, you run a script that makes every change, and that can run again at any time without making anything twice. Its reference part lists each change as the gh, git, or curl command to type by hand, with the reasons for each choice and links to the GitHub and Discourse documentation behind it, so you can check what a script does, or do it without the script.
The audit compares each project's repository with the settings the new-repository script gives it. Here setdef/widget has its wiki on, lets anyone open issues, and gives a role to an account that the site file doesn't list:
ruby github/audit/audit.rb projects/widget.ymlsetdef/widget
Would change: turned the wiki off
Would change: limited who can open issues to collaborators
To do: carol has the role write, which github.yml doesn't list. Add carol to github.yml, or remove them under Settings, Collaborators. new_repo_setup.rb removes no one.
Running the new-repository script on the same project file makes the two "Would change" changes, and the "To do" line is yours to act on.
| What | For |
|---|---|
| Ruby 3.2 or later | Every script. The scripts use only Ruby's standard library, so there are no gems to install. |
The GitHub CLI, gh, signed in |
The GitHub scripts. Setting up a repository needs a person's account that can create repositories in the organization. |
| Git 2.28 or later | Setting up a repository's local clone, which uses git init -b. |
| curl | The new-repository script's check of the forum category. The commands by hand also need curl 7.55 or later, jq 1.6 or later, and zsh or bash. |
| An admin API key for the forum | The forum script, which reads the key from a file only you can read, or from 1Password. |
The 1Password CLI, op, signed in |
Reading the forum's API key from 1Password, and saving a new GitHub App's private key there. |
Clone the repository. There is nothing else to install:
git clone https://github.com/setdef/runbook.git
cd runbookRun every script from the repository's root.
Setting up a new project walks through the whole path, in order:
- Copy each site file,
github/github.example.ymlandforum/forum.example.yml, to the same name without.example, and edit it. A site file holds what differs from one site or computer to the next: the collaborators and their roles, the forum's address, where the API key is, where the GitHub App's private key goes, and where this computer keeps its clones. Git ignores both copies. - Write the project file,
projects/NAME.yml, which describes the repository and, when the project takes patches on the forum, its category. The files inprojects/are setdef's projects, to copy from. - Run the new-repository script, then the forum script, then push the first commit and run the new-repository script again to check the default branch.
- Send a test patch by email to the new category.
- From time to time, run the audit.
Each script reads its site file from the clone it runs from, so run the scripts in the clone that holds your site files. Another clone or a Git worktree of this repository has none, since Git ignores them: push a project file you write there, and pull it into that clone first (Setting up a new project).
Every script prints its manual with --help. The two scripts that change things take --dry-run, which prints what the script would change and changes nothing. The audit changes nothing on every run.
- Setting up a new project: the order to run the other runbooks in, and the project file they share.
- Setting up a new repository: create a GitHub repository with the shared settings, collaborators, and a local clone, with every command by hand.
- Checking repositories for drift: report each repository's differences from those settings.
- Setting up a project's category on a Discourse forum: give a project a category that takes questions, problem reports, and patches by email, with every API call by hand, and how incoming email reaches a category.
forum/andgithub/: what else each folder holds.
Ask a question or report a problem in the repository's Discussions. Only collaborators can open issues, as on every repository set up with these runbooks. Report a security problem privately, as SECURITY.md says, never in Discussions.
CONTRIBUTING.md holds the rules for every change. Run the tests with rake, from the repository's root. They use Minitest and in-memory fakes of GitHub and Discourse, and never reach the network. Minitest and Rake are bundled gems, which come with Ruby. shared/ holds the code that more than one runbook uses, in shared/lib/, with its tests in shared/test/.
Copyright 2026 setdef. Three licenses apply, by kind of file:
- The code is MIT: the Ruby scripts, their tests, the
Rakefile, and the example site files and the project files. - The documentation is CC BY 4.0: every Markdown file, the descriptions and templates in
projects/included. Copying it means giving credit. - The examples in the documentation are MIT-0: every fenced code block in a Markdown file. Copy them into your scripts and files without giving credit.
The project follows the REUSE Specification. REUSE.toml declares each file's license, and reuse lint checks it.
I use four words for how code and prose comes to exist. Code or prose I wrote, I typed by hand, with nothing generated. Code or prose I wrought, an AI agent generated while I iterated with it, and I reviewed every change before committing it, so I own every diff. Code or prose I requested, an agent built with little or no review from me, but I take ownership of the outcome or product because I tested and iterated. Code or prose I rushed, an agent built with little or no feedback from me, and may or may not be useful (or safe).
All of runbook (its scripts, tests, project files, and documentation, this README included) is requested. Agents built it from my goals and decisions. I haven't reviewed it. declare-ai.org