Skip to content

CLI

Write RFCs as local Markdown files, then push them to DesignDoc.

Install

Homebrew (macOS / Linux)

brew install shubham030/tap/designdoc

Install script

curl -sSL https://raw.githubusercontent.com/shubham030/designdoc-cli/main/install.sh | sh

Go install

go install github.com/designdoctech/designdoc/cmd/cli@latest

Manual download

Download the latest binary from GitHub Releases.

Login

Authenticate with your DesignDoc account:

designdoc login

This opens your browser for Auth0 login. After authenticating, your token and orgs are saved to ~/.designdoc/config.yaml.

Organization Management

# List your orgs (* = active)
designdoc org list

# Switch active org
designdoc org switch my-team

# Set a short alias
designdoc org alias my-long-org-name mt
designdoc org switch mt

# Show current org
designdoc org current

Create an RFC

1. Scaffold from template

designdoc rfc init --project backend my-proposal.md

This fetches your org's default template and creates a local Markdown file with YAML front matter pre-filled.

2. Edit the file

Open the file in your editor and fill in the sections:

---
title: "API Rate Limiting"
project: backend
tags: [api, security]
summary: "Add rate limiting to public endpoints"
---

## Summary

Add rate limiting to prevent abuse...

## Motivation

Our public API has no rate limits...

## Detailed Design

### Token bucket algorithm
...

3. Push to DesignDoc

designdoc rfc push my-proposal.md

On first push, the CLI creates the RFC on the server and writes rfc_id and numberback into your file's front matter. Subsequent pushes update the existing RFC.

Browse RFCs

# List all RFCs
designdoc rfc list

# Filter by status
designdoc rfc list --status in_review

# View an RFC in your terminal
designdoc rfc show RFC-001

Front Matter Reference

FieldRequiredDescription
titleYesRFC title
projectYesProject slug
tagsNoArray of tags
summaryNoOne-line summary
visibilityNopublic, org_only (default), private
rfc_idAutoSet by CLI after first push
numberAutoSet by CLI after first push

Ledger sync

Some teams keep deferred, owed and expiring work as GitHub issues, one issue per row, labelled ledger. designdoc ledger turns those issues into deferrals and renders them to a markdown file the repository can commit. The issues stay the source of truth.

# Render the open ledger issues to docs/ledger.md
designdoc ledger write --repo acme/svc

# In CI: exit 1 when docs/ledger.md is stale (diff printed), 2 when it cannot tell
designdoc ledger check --repo acme/svc

# Create or update one deferral per open ledger issue (idempotent)
designdoc ledger import --repo acme/svc --org my-team --project backend --dry-run

# The same, accepting the rows it creates (needs a decider or admin)
designdoc ledger import --repo acme/svc --org my-team --accept

# Open one ledger issue per top-level "- **Title** ..." bullet of a review file
designdoc ledger open --repo acme/svc --from reviews/round-2.md --class deferral --area api \
  --source https://github.com/acme/svc/pull/7

GitHub is read with GITHUB_TOKEN or GH_TOKEN. DesignDoc is reached with the same login or API key as rfc push. A rate-limited request (429, or 403 with Retry-After) is retried up to 3 times.GITHUB_API_URL must be https (plain http only for localhost).

ledger open writes a keyinto each trailer: the first 16 hex digits of the SHA-256 of the file's repo-relative path, a newline and the bullet title. Before opening anything it lists every ledger issue, open or closed, and skips a bullet whose key is already there, so a re-run after a failure opens only the rest.

The trailer

A row's fields sit in a block at the foot of the issue body:

Why we are not doing this yet...

---
<!-- ledger
class: deferral
area: api
deadline: 2027-01-31
trigger: the next change to the request-body limits
code: backend/internal/middleware/bodylimit.go
source: https://github.com/acme/svc/pull/7
roadmap: item 3
rfc: 012
owner: @alice
-->
  • The block opens with a line <!-- ledger and closes with -->. A fenced block opened by ```ledger and closed by ``` works too.
  • It must be the last block in the body. Only blank lines may follow it.
  • Each line is key: value. Keys are case-insensitive, and a line starting with # is a comment. An empty value counts as absent. If a key repeats, the first value is kept. Lines that do not parse are skipped with a warning.
  • deadline is a date (YYYY-MM-DD). Unknown keys are kept, and both LF and CRLF line endings work.
  • owner is a GitHub login (@alice) or an email. It becomes the deferral's owner when it matches exactly one org member; otherwise import warns and the importer stays the owner. key is written by ledger open.
  • Labels starting with class: and area:set the row's class and area. The trailer's class and area keys are used only when no such label exists.

What import does

IssueDeferral
Open, with a trailer, not yet importedA new draft deferral. It has the issue title, the body without the trailer, the tags ledger, class:… and area:…, and deferral_source set to the issue URL
deadline after today (at most 3 years ahead)A date trigger. A deadline that has already passed becomes the text trigger “deadline YYYY-MM-DD”
code: path, or a trigger that is a single pathA code-link trigger on a new code link, if the org has a connection to the repository. Without one it becomes the text trigger “the next change to path”
trigger: text, or no trigger at allA text trigger: the text itself, or “until the ledger issue is closed”
Open, already importedFound again by the hidden marker at the end of its body (<!-- ledger-issue: <node id> <updated_at> -->), else by its source. After a repo rename or an issue transfer the marker still matches and deferral_source is repointed. If nothing changed, nothing is sent
Open, draft deferralUpdated only when the issue changed since the last import, so an edit made in DesignDoc is kept until the issue is edited again
Open, decided deferralIts title, body and tags are never overwritten. A new trigger in the trailer re-defers it
ReopenedA fired deferral is re-deferred with the trailer's trigger. A withdrawn, rejected or superseded one is not revived; import warns
ClosedA draft is withdrawn. A decided deferral is marked fired with the note “Ledger issue closed (completed)”, or withdrawn if the issue was closed as not planned. Only the author may withdraw, so a deferral someone else created gets a warning instead of failing the run

Imported deferrals start as drafts. With --accept, the rows a run creates are submitted and accepted through the normal transitions, so the API checks that the caller may decide; a refusal leaves a draft and a warning. Existing rows are never accepted. Settings can also go in a ledger: section of designdoc.yaml (repo, label, class_prefix, area_prefix, out, classes, areas). Flags override the file. Run designdoc ledger --help for every flag.

Staleness census

ledger census lists the open ledger rows a person should re-read first: the ones whose linked code changed since they were filed while their trigger has not fired. It reads GitHub only and changes nothing.

# Markdown to stdout: a summary, then one table per area
designdoc ledger census --repo acme/svc

# JSON to a file, measuring from each issue's last update instead of its filing
designdoc ledger census --repo acme/svc --format json --out census.json --since-field updated

# Also count rows fired in DesignDoc (the deferral import created), and fall
# back to backticked file paths in the issue text for rows with no code path
designdoc ledger census --repo acme/svc --with-designdoc --org my-team --body-paths

# Bound the GitHub calls on a large ledger
designdoc ledger census --repo acme/svc --limit 200
  • A row's code is its code: path, else a triggerthat is one path, else the paths its trigger names in prose (“the next change to tools/a.py or web/b.ts”), at most 5. With --body-paths, a row with none of those takes the backticked file paths of its issue text, leaving out paths a trailer field names (source, frozen).
  • For each distinct path the census asks GitHub once for the newest commit on the default branch that touches it, 4 requests at a time, with the same retries as the other commands, and compares the commit's author date (a rebase or squash rewrites the committer date) with the filing date. The code is moved when the commit is newer, not moved when it is older, no commits when nothing touches the path, and no link when the row names no path. A glob is not checked (glob (not checked)) unless --glob-parent, which asks about the directory above its first wildcard, so any change there counts.
  • A failed lookup does not stop the run: that path's rows read unknown (lookup failed: …), the report is still written, a warning goes to stderr and the command exits 2. After a rate limit that outlasts the retries, the remaining paths are skipped the same way. Without a token the census still runs, with a warning: GitHub allows 60 requests an hour then, one per 100 issues plus one per distinct path, so pass --limit.
  • --since-field updated measures from the issue's updated_at, which any comment, label or edit moves (a ledger synctoo), so it answers “moved since anyone last touched the issue”, not since the deferral was last reviewed.
  • A trigger has fired when its deadline is today or earlier (UTC), or, with --with-designdoc, when DesignDoc marked the imported deferral fired.
  • Rows sort as: code moved but not fired, newest change first; then fired rows still open; then the rest, oldest first. Every cell is escaped as ledger write escapes it. The run prints its row counts, GitHub calls and cache hits to stderr.

The Censuspage in the app is the same view over the org's own open deferrals, from records DesignDoc already keeps: a drift event on one of the deferral's code links, or a push that fired its code-link trigger, after it was created. It never calls GitHub. No push seen means no push was recorded where DesignDoc would have kept one, not that the code is unchanged: it cannot see pushes while a connection was disabled (or since it was re-enabled), to a webhook never registered on GitHub, or deliveries that failed; and a suggested link accepted later keeps the date it was suggested. It says unknown where no record would have been kept at all: a draft, in-review or stale deferral (drift is recorded only for decisions in effect), a code link added after the deferral was created, a connection without push webhooks or newer than the deferral, or a code-link trigger fired by hand. A date trigger that passed on a draft reads due (not active until accepted). Past 2,000 open deferrals the page shows the newest 2,000.

Environment Variables

VariableDescription
DESIGNDOC_API_KEYAPI key (overrides config token)
DESIGNDOC_ORGOverride active org slug
DESIGNDOC_API_URLOverride API URL
GITHUB_TOKEN / GH_TOKENGitHub token for designdoc ledger
GITHUB_API_URLGitHub REST API for designdoc ledger (GitHub Enterprise)