README
¶
dagbump
You release goutils, and now servicekit, oneauth, mcpkit, chakra and jaala each need a new version, in that order. dagbump works out that order and runs the mechanical steps.
make install # devloop and dagbump; or: go install github.com/panyam/devloop/cmd/dagbump@latest
The plan file
A cascade runs through one file, dagbump.plan:
dagbump plan mcpkit --write # waves, each unit's commits and dependency updates
# fill in bump and notes for each release unit, by hand or through an agent:
dagbump notes --agent 'claude -p --permission-mode plan'
dagbump apply # check the file, print the table
dagbump apply --dry-run # print every step
dagbump apply --yes # update, release, push, publish, wave by wave
plan --write records each unit's wave, action, current version and the commit it was planned
against. It also records the unit's commits, changed folders and dependency updates. It leaves
bump, version, notes, only and skip empty for whoever writes the notes.
notes --agent runs a command once per release unit with empty notes, in that unit's repo
folder. Units in one wave run in parallel, up to --jobs. The command reads a prompt on stdin:
instructions, then the unit's context as JSON. $DAGBUMP_CONTEXT names a file holding the same
JSON. The command prints optional front matter (bump: minor) and then the notes. Claude in
plan mode can read the repo and run git show, and it cannot edit anything.
An agent that is already running, such as the one driving the cascade, can write the notes itself from the same prompt:
dagbump notes --next # the next unit needing notes, then its prompt
dagbump notes --prompt <unit> # the prompt for a named unit, to hand a wave to helpers
dagbump notes --set <unit> < reply # front matter, then notes, as --agent prints them
--next goes in wave order, so each prompt lists the versions earlier waves picked. It prints
nothing once every release unit has notes. --set refuses a skipped or released unit, a bump
other than patch, minor or major, and empty notes. Front matter in the reply replaces both
bump and version.
The prompt's context carries counted_commits: the unit's commits, leaving out dependency bumps
and docs: and chore: commits. More than 10 asks for at least a minor bump.
apply refuses a unit whose repo has commits the plan did not see, since its notes would
describe the wrong change set. Before each unit it reloads the graph, so each unit sees the tags
pushed by the units before it. After each unit it writes status, released, tags and
error back into the file. A rerun skips the units marked done.
When a repo moves mid-cascade, write a fresh plan and keep the work in the old one:
mv dagbump.plan old.plan
dagbump plan mcpkit --write --carry old.plan
--carry copies bump, version, notes, only and skip for each unit still at the same
version whose commits include every commit the old plan saw. Commits added since become a
warning on the unit, so you can extend its notes. A unit released or rebased since carries
nothing. A unit the old plan skipped stays skipped and counts as at its current tag: its
dependents don't wait on it, and notes leaves it out of planned_versions.
Notes go into the repo as well. dagbump adds an entry at the top of CHANGELOG.md when the repo
has one. It writes docs/releases/<V>.md when the repo has a docs/releases folder. Both land
in the release: V commit. The notes also become the marker tag's annotation and the GitHub
release body. Set notes: {changelog: ..., file: ...} in .dagbump.yaml to choose other
paths, or none to turn one off.
The manifest
The manifest lists the projects, one clone each. dagbump reads --manifest, else
$DAGBUMP_MANIFEST, else ~/.config/dagbump/dagbump.yml. Keep it in a dotfiles repo and point
$DAGBUMP_MANIFEST at it. To keep separate lists, such as personal and work repos, point the
variable at another file on that machine or in that shell. dagbump manifest prints the file in
use and where its path came from. The manifest holds no edges and no release steps.
Every run reads each project's tracked go.mod and package.json files and builds the edges.
owners: [panyam, turnforge]
roots: [~/newstack, ~/projects]
ignore_commits: ['^release: '] # commit subjects that are not unreleased work
tools: {npm: pnpm} # default tool; enforce: true makes it the rule
projects:
- name: mcpkit
path: ~/newstack/mcpkit/main
- name: blog
path: ~/projects/blog/master
kind: app # lib | app; default: lib when the repo has a semver tag
depends_on: [s3gen] # manual edge
# skip: true leaves the project out
Tools
Each npm package gets one tool, npm, pnpm or yarn, chosen in this order:
tools: {npm: pnpm}in the repo's.dagbump.yamlpackageManagerin the package.json (the corepack pin)- the nearest lockfile, walking up to the repo root
tools.npmin the manifest- npm
dagbump warns when a declared tool disagrees with the lockfile. update installs with the
chosen tool, and a direct publish uses pnpm publish for pnpm packages, so workspace: specs
get rewritten. Setting a package's version is a plain edit of package.json, so no tool runs
for that step.
To make one tool the rule, set it in the manifest:
tools:
npm: pnpm
enforce: true
With enforce, update refuses to install with another tool, and release refuses to
publish with one. The refusal names the fix (pnpm import, then commit pnpm-lock.yaml). A repo
opts out by naming its own tool in its .dagbump.yaml. dagbump list --json shows each
package's tool and where the choice came from.
discover scans each root's children and grandchildren for clones. It groups the clones by
remote and picks one per repo. A clone on the default branch wins, then a folder named main or
master, then a clean tree, then the newest commit. Existing entries keep their path.
Per-repo config
Each repo can carry a .dagbump.yaml at its root. It says which Go modules and npm packages
share a version, and how a release runs. With the file present, dagbump release runs every
step itself, and the repo's make tag, tag-push and bump-root targets are no longer needed.
Without the file, dagbump falls back to those make targets. After the push it still waits for
the Go proxy to serve each module the targets tagged (step 9 below), then creates the GitHub
release. Version files other than VERSION are up to make bump-root, since version_files
lives in the file.
dagbump init <project> proposes the file from the repo's tags. It puts the modules tagged at
the latest release, every public package.json, and VERSION into one lockstep unit. Review the
proposal, then add --write.
A repo with one version line puts the fields at the top level:
# goapplib: Go module, two npm packages and VERSION share one version; CI publishes npm.
modules: [.]
npm: [tsappkit, tsappkit-solid]
version_files: [VERSION]
publish: {npm: ci}
# mcpkit: 22 sub-modules tagged with the root; strip in-repo replaces at the tag.
modules: [., cmd/*, ext/*, stores/redis, experimental/ext/**, experimental/integrations/*,
examples/mcpskills-walkthrough, tests/e2e, tests/keycloak]
npm: [experimental/ext/rooms/ts]
strip_replaces: true
publish: {npm: ci}
hooks:
pre_tag: [make -s verify-submodule-deps]
A repo with several version lines lists them under units. The first unit is the main unit.
It carries the root tag and takes every module and package that no other unit claims. Another
unit is named project/unit in plans, tags only its own <dir>/vX tags, and waits in the plan
until the units it depends on have released.
units:
- modules: [., ext/*]
- name: agent
modules: [agent/**]
versioning: changed
| Field | Meaning |
|---|---|
modules |
go.mod folders tagged with the unit. . is the root, * one segment, ** any depth. Default: every module with a tag of its own |
follow |
Untagged go.mod folders (examples, docs) that belong to the unit. Default for the main unit: every module nobody claims |
pin_followers |
Which pins a follower moves at a release: root (default), all or none. Requires at v0.0.0 or the zero pseudo-version never move |
npm |
package.json folders that get the unit's version. Default for the main unit: every public package.json |
version_files |
Files that hold the bare version. Default: VERSION if tracked. A file that had no v keeps none. file.json:dotted.key sets one string inside a JSON file, such as docs/content/SiteMetadata.json:version |
versioning |
lockstep (default) tags every module each release. changed tags the modules changed since their own last tag, plus the unit's modules that require them |
strip_replaces |
Tag a commit without in-repo replaces, then restore them, so go install pkg@vX works |
publish.npm |
direct (dagbump runs npm publish), ci (a workflow publishes on the tag) or none. Default: ci when a workflow mentions npm publish |
publish.github_release |
Default true |
notes.changelog, notes.file |
Where notes land. Default: CHANGELOG.md if present, docs/releases/{V}.md if that folder exists. none turns one off |
hooks.pre_tag, post_tag, post_release |
Shell commands run in the repo root with V and NOTES set |
check |
Runs after a dependency update in place of go build ./... |
pr, pr_timeout |
pr: true runs this repo in PR mode on every apply, release and update --push; see PR mode. pr_timeout bounds the wait for checks. Default 30m |
tools.npm |
Top level only. This repo's npm tool: npm, pnpm or yarn. Overrides detection and the manifest's enforced choice |
kind, ignore_commits |
Top level only. Same meaning as in the manifest |
To release one module of a lockstep unit without the rest, run
dagbump release mcpkit --version v0.9.1 --only ext/auth. That call tags ext/auth and every
module of the unit that requires it. The unit's other modules keep their versions.
Moving a repo off its make targets
- Run
dagbump init <project>and compare its module list with the Makefile's tag list. - Commit
.dagbump.yaml, then rundagbump release <project> --version vX --dry-runand compare the steps withmake tag-push. - Replace the release targets with one call:
release: ; dagbump release --version $(V) $(if $(NOTES),--notes $(NOTES)). - Keep the scripts that CI still runs, such as goapplib's
check-versions.sh, mcpkit'srooms-ts-version.sh check, andrelease-replaces.sh restorein vulncheck.yml.
Commands
| Command | What it does |
|---|---|
discover [roots] [--owner o] [--write] |
Scan folders and merge new repos into the manifest |
init [project] [--write] |
Propose a .dagbump.yaml from the repo's tags and files |
add <path> / remove <name> |
Edit the manifest by hand |
link <dependent> <dependency> / unlink |
Add or drop a manual edge |
list [--pretty] [--html f] [--svg f] [--open] |
Version, unreleased commits, lagging deps and warnings per project. --pretty draws a boxed table and wraps the notes inside their cell. --html writes a self-contained page with the DAG in waves and a sortable table. Hover a unit to trace its deps, click it for its commits and lagging deps. --svg writes the graph alone |
graph [--dot] |
The whole DAG in release waves |
status [--markdown] [--fetch] [--post owner/repo[#N]] |
What needs attention: libraries with unreleased commits, units lagging a dependency, clone warnings (including clones behind origin), and what plan --changed would release. --markdown prints it for a GitHub issue. --fetch fetches every clone first. --post writes the report to an issue; see Status report |
plan <seeds> | --changed [--exclude x] [--write] [--carry old] |
The seeds plus everything downstream, in waves, with an action each. A project name seeds all its units. --write saves dagbump.plan |
notes [plan] --agent cmd |
Fill bump and notes in the plan file through an agent |
apply [plan] [--dry-run | --yes] [--proxy-wait 10m] |
Check the plan file, then run it wave by wave |
context <name> |
Commits, merges, diffstat and pending updates since the last tag, for writing notes |
update [name] [--push] [--wait 10m] |
Move deps on other units to their latest tags, tidy, build, commit. Waits for CI-published versions to appear |
release [name] --version vX | --bump b [--notes f] [--only dirs] |
Tag, push, publish |
Every command takes --json, and update and release take --dry-run. init, context,
update and release default to the repo holding the current folder, so a Makefile can call
dagbump release without a manifest.
Status report
dagbump status --fetch --post owner/repo keeps one pinned issue up to date with the report.
It looks for the open issue titled "dagbump status" and replaces its body. When there is none,
it creates and pins one. --post owner/repo#N writes to issue N instead. --fetch runs git fetch --tags in every clone first, so the report sees releases made on other machines or by
CI. It moves no working tree, so a clone behind origin shows up as a warning. --dry-run prints
the gh commands.
Run it nightly. With cron (crontab -e):
30 6 * * * zsh -lc 'dagbump status --fetch --post panyam/devloop' >> ~/.cache/dagbump-status.log 2>&1
With launchd, save this as ~/Library/LaunchAgents/dev.dagbump.status.plist and load it with
launchctl load followed by that path:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key><string>dev.dagbump.status</string>
<key>ProgramArguments</key>
<array><string>/bin/zsh</string><string>-lc</string><string>dagbump status --fetch --post panyam/devloop</string></array>
<key>StartCalendarInterval</key><dict><key>Hour</key><integer>6</integer><key>Minute</key><integer>30</integer></dict>
<key>StandardOutPath</key><string>/tmp/dagbump-status.log</string>
<key>StandardErrorPath</key><string>/tmp/dagbump-status.log</string>
</dict>
</plist>
The login shell (zsh -lc) picks up $DAGBUMP_MANIFEST and the gh login.
How it decides
- A module is published when it has its own tag (
v1.2.3, orext/auth/v1.2.3for a sub-module). An edge propagates when the requiring module is the repo root or a published sub-module. A release of the dependency then forces a release of the dependent. Edges from examples and docs sites don't propagate, butupdatestill moves them. - A dependency lags when its required version is below the latest tag for that module.
For npm, dagbump compares the locked version, or the floor of the spec. A
*spec with no lock never lags. It finds the lockfile by walking up from the package to the repo root:pnpm-lock.yaml(v6 and v9 importers, and v5),yarn.lock(v1 and berry), orpackage-lock.json. The lockfile also picks the toolupdateruns:pnpm add/pnpm update,yarn add/yarn upgrade, ornpm install/npm update. - Before a pnpm install,
updateadds the new version tominimumReleaseAgeExcludeinpnpm-workspace.yaml, when the file keeps that list. Without that entry pnpm refuses a version published minutes ago. planreads live state. Rerun it after each release to see what is left.
Release steps
release refuses when the tree is dirty, when the clone is off its default branch, when a
dependency lags, or when nothing is unreleased. With a .dagbump.yaml it runs these steps:
- Write
Vto the version files and to each package.json in the unit. - Pin the tagged modules to
Von each other, adding an in-repo replace where one is missing, sogo mod tidyresolvesVbefore it exists. A replace that names a version (replace M v0.1.0 => ../) would stop applying atV, so dagbump rewrites it without the version. Followers move perpin_followers. Tidy. - Run the
pre_taghooks and commitrelease: V. - With
strip_replaces, commit the tree without in-repo replaces. - Tag. The marker tag goes first: the root tag for the main unit, and it carries the notes.
Then a
<dir>/Vtag goes on each module. - Restore the replaces in a new commit, then run the
post_taghooks. - Push the branch, then the marker tag alone, then the rest in one push. GitHub raises no push event for a push carrying many tags, so the marker tag goes first on its own. In PR mode the commits reach the branch through a PR first; see below.
- Run
npm publishwhenpublish.npmis direct. - Wait, up to
--proxy-wait(default 10m, 0 skips), until the Go module proxy serves each tagged module's@v/V.info. A dependent's CI that asks the proxy for a tag before the proxy has seen it gets a 404. The proxy can cache that 404 for hours. The wait reads your ownGOPROXYand skips modules matchingGOPRIVATEorGONOPROXY, and it skips the check when the first proxy entry isdirectoroff. It asks for one module at a time, root first and then each module after the in-repo modules it requires, and moves on once that module serves. Polls of one module back off from 15s to 1m. Each first request makes the proxy fetch the repo from GitHub. A burst of them can get one refused, and the proxy then caches that failure for that module alone (issue 47). - Run
gh release create, then thepost_releasehooks. The release comes after the proxy wait, so a workflow onrelease: publishedstarts once every module serves. When the wait times out, dagbump still creates the release and then reports the error.
A repo whose tag CI fetches its own modules through the proxy, such as a vulncheck of each module, can run on the release event to stay out of the race:
on:
release:
types: [published]
PR mode
A repo with branch protection rejects a direct push to its default branch. --pr on apply,
release and update --push, or pr: true in the repo's .dagbump.yaml, sends the commits
through a pull request instead:
- Steps 1 to 6 run as usual, so the tags exist only in the local clone.
- The commits go to branch
dagbump/<unit>-<V>(dagbump/<unit>-depsfor an update), and a PR opens against the default branch with the notes as its body. - dagbump waits up to
--pr-timeout(default 30m) for the PR's checks. A PR with no checks after a minute counts as passing. - It merges with
gh pr merge --merge. A merge commit keeps the PR's commits, so the local tags still point at commits on the default branch. Squash and rebase merges would not, so PR mode refuses a repo with merge commits turned off. - The local branch fast-forwards to the merge, and steps 7 to 9 push the tags and publish.
Checks run on the updated dependencies before any tag goes out (issue 25).
A failed check, a refused merge (an approval is missing) or a timeout stops the unit. dagbump
deletes the local tags and resets the branch to origin's, and the PR stays open. The rerun
rebuilds the commits. When the PR branch already holds commits with the same trees, dagbump
moves the tags onto them and skips the push, so the PR keeps its checks and approvals. In
apply, a unit in PR mode stays pending until its PR merges, so a rerun redoes the update.
PR mode needs a .dagbump.yaml, since the make-target path tags inside make tag. It needs
a github.com origin and the gh CLI.
update and release set GOPRIVATE to the projects' module paths. go mod tidy then
resolves a tag pushed a moment ago, without waiting for proxy.golang.org. npm specs that start
with link:, file: or workspace: count as local, like a Go replace, so dagbump never
updates them.