dockhand

module
v0.0.0-20260918.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2026 License: MIT

README

[!WARNING] Pre-release software under rapid development. Commands, behavior, and stored data can change or break without notice. There are no stability or compatibility guarantees yet.

dockhand logo

dockhand

From upstream release to submitted port update.

Description

Dockhand is a command-line tool for people who keep MacPorts ports up to date and contribute those updates through GitHub pull requests. It does the repetitive part of a port update for you: it finds the new upstream version, edits the Portfile and checksums, builds the port in a clean macOS virtual machine or on GitHub Actions, and opens the pull request from your fork. You look at the result at every step, and you decide when it goes out.

You do not need commit access to MacPorts. Dockhand works entirely through your own fork of macports/macports-ports. The pull request it opens is the same kind you would open by hand, and nothing is ever pushed to the MacPorts repository directly.

You can take an update one step at a time, previewing the diff, preparing a branch, building it, and publishing it as separate commands. Or you can take a port from its latest release to a submitted pull request with one command. Either way, Dockhand never guesses. When a Portfile does not follow a convention it understands, or a build fails, or something upstream looks wrong, it stops, keeps what it has done so far, and tells you why.

Requirements

  • A Mac running macOS. Building ports in local virtual machines needs an Apple silicon Mac with Tart installed; the prepared images cover macOS Monterey through Tahoe. On any other Mac you can still prepare updates and build them on GitHub Actions instead.
  • Go 1.27.1 or newer, to build Dockhand from source. There are no binary releases yet.
  • Git.
  • A local MacPorts installation. Dockhand reads Portfiles through MacPorts' own Tcl interpreter, so it sees exactly what port sees, including computed versions and PortGroup effects.
  • A GitHub account with a fork of macports/macports-ports, cloned to your machine, with Git able to push to that fork.
  • A GitHub credential for Dockhand. Any one of these works: Dockhand's browser login (dockhand auth login), an existing GitHub CLI login (gh auth login), or a GH_TOKEN or GITHUB_TOKEN environment variable.

Optional, depending on what you work on:

  • An Xcode archive (Xcode.xip) for ports that need full Xcode rather than the Command Line Tools. Dockhand builds a separate VM image from it.
  • go2port and cargo2port for ports with generated Go or Rust dependency blocks. Install them with MacPorts; Dockhand only needs the one a given port uses.

Features

Preparing updates

  • Version bumps that find the newest stable upstream release from GitHub/GitLab catalogs, or from the livecheck MacPorts itself resolves for the port, PyPI, CPAN, CRAN, RubyGems, SourceForge, and the other checker types that come down to a regex, following the port's own livecheck and tag conventions; or use a version you name.
  • Revision bumps.
  • Versions carried as a literal version or as a github.setup, gitlab.setup, go.setup, perl5.setup, R.setup, or ruby.setup argument, edited in the spelling the source uses, with checksums recomputed from the real archives over HTTP or anonymous FTP, including ports with several archives, named or conditional checksums, checksums held in tables, and legacy md5/sha1 blocks, which are rewritten as rmd160, sha256, and size unless you ask to keep them.
  • Ports fetched with git, which bump through their version alone and let the build clone the tag.
  • Python, perl, and ruby stubs, which bump through their newest versioned subport as one shared release; the build proves the newest subport by default.
  • Regenerated go.vendors, cargo.crates, and cargo.crates_github blocks, checked against the upstream module and lockfile so a helper that silently drops a dependency is caught.
  • A preview mode that prints the exact diff without creating a branch or touching your checkout.
  • Every update starts from freshly fetched MacPorts master, on a new branch, with your working copy left alone.

Building and checking

  • Clean builds in a disposable virtual machine cloned from an image you prepare once: lint, build, declared tests, and install, with the build log available live.
  • Builds on GitHub Actions in your fork when you have no Tart, using the MacPorts workflow that already lives there.
  • Automatic choice between the two for bumps, or an explicit --provider.
  • Reuse of a passing result when the same source tree and build settings are checked again, so committing verified edits does not cost a second build.
  • Checks of your own hand-made branches and even uncommitted working-tree edits, not only branches Dockhand prepared.

Publishing

  • Pull requests opened from your fork against MacPorts, with the commit message as the description and a body that reports the build environment and a review checklist based on what actually ran.
  • Publication only for committed contents with a passing build on record. Dockhand refuses to publish anything it has not seen pass.
  • Safe recovery when GitHub does not answer: an uncertain pull-request request is checked, never blindly repeated.

Working style

  • Work is durable. Close the terminal, come back later, and pick up the same job with wait.
  • Ctrl-C detaches from a running build without canceling it; cancel cancels on purpose.
  • A failed build keeps the prepared branch so you can fix it and check again.
  • status is a live table on a terminal: it shows every contribution, processes the repository's pending work while it is open, and its keys run the other commands on the selected row. status --print only reads.
  • --json on any command for scripting.

Using It

Build and install
git clone https://github.com/herbygillot/dockhand.git
cd dockhand
make build

This produces ./dockhand; ./dockhand --version shows the build it came from. Put it somewhere on your PATH:

mkdir -p "$HOME/.local/bin"
install -m 755 dockhand "$HOME/.local/bin/dockhand"
export PATH="$HOME/.local/bin:$PATH"
Set up your fork

Fork macports/macports-ports on GitHub if you have not already, then clone your fork and add MacPorts as upstream:

git clone git@github.com:YOUR_USERNAME/macports-ports.git
cd macports-ports
git remote add upstream https://github.com/macports/macports-ports.git

Run the commands below from inside this checkout. To run them from somewhere else, add --tree /path/to/macports-ports or set MACPORTS_TREE. Dockhand finds your fork among the checkout's remotes by its URL and your GitHub login, and recognizes macports/macports-ports as the upstream whatever the remote is called; --remote is only needed when that is ambiguous. Dockhand only pushes to a repository owned by your GitHub login. If your origin is macports/macports-ports itself, publication stops and names the remotes that point at your fork; pass one of them with --remote.

Sign in to GitHub

Use Dockhand's browser login:

dockhand auth login
dockhand auth status

auth status tells you which credential Dockhand will use and which account it belongs to. auth logout removes only Dockhand's own saved credential.

Prepare a build VM (optional)

To build ports locally, prepare a VM image once. This pulls a vanilla macOS image, installs the Command Line Tools and MacPorts into it, and checks the result:

dockhand setup

It takes a while the first time. Use dockhand setup --check to validate an existing image, dockhand setup --os sonoma to prepare a different macOS release, and dockhand setup --xcode /path/to/Xcode.xip to build a second image for ports that need full Xcode. Dockhand picks the right image for each port automatically.

If you skip this step, Dockhand builds on GitHub Actions in your fork. Make sure the fork's existing main.yml workflow is enabled under its Actions settings.

Check whether a port can be updated
dockhand assess jq
dockhand assess rust-analyzer --version 2026-09-14

assess examines the committed Portfile and explains what Dockhand can edit, what tools are missing, and what it cannot determine. Add --version to check a specific upstream release. It does not download source archives or build the port; an assessment is not a guarantee that the update will build.

Preview an update

Start by looking at what Dockhand would change:

dockhand bump jq --diff

It picks the newest eligible upstream version and prints the patch. Nothing is written. To choose the version yourself:

dockhand bump jq 1.8.1 --diff

Include the upstream tag prefix if you like (v1.8.1); if you leave it off, Dockhand follows the port's existing convention. For a perl module the version you name is the module version, 0.58, and the port version MacPorts derives from it is what the commit records. A revision bump works the same way with dockhand bump-revision jq --diff, and dockhand refresh-checksums jq --diff shows a checksum refresh.

If the port's Portfile does something Dockhand does not understand, the preview says so instead of producing a guess. Those ports still need a manual edit, and you can hand that edit back to Dockhand for building and publishing, as described below.

Update, build, and open the pull request
dockhand bump jq

Dockhand fetches the current MacPorts master, creates an update branch named like dockhand/bump/jq-..., builds it (in a Tart VM if you prepared an image, otherwise on GitHub Actions), and when the build passes pushes the branch to your fork and opens the pull request against MacPorts. It stays in the foreground the whole way and prints the branch, the verdict, and the pull request URL. Your current checkout is not touched. If the port is already at the newest version, the command finishes with nothing to do. If the build fails, the branch is kept and no pull request is opened.

  • --no-publish (-P) stops after the build, for updates you want to look at before opening a pull request.
  • --skip-verify (-V) opens the pull request without building, when you have decided the build is not worth waiting for. The pull request says the change was not built locally, and status shows it as published unverified.
  • Both together prepare the branch and stop, for updates you want to finish by hand.
  • --detach submits the work and returns as soon as the build is admitted; dockhand wait jq picks it back up. Ctrl-C does the same without canceling anything.
  • --trace streams the build log as it runs.
  • --provider tart or --provider github overrides the automatic choice.
  • --from-source builds dependencies from source instead of using binary archives.

Opening the pull request needs a GitHub login and a fork; if either is missing, the command says so before doing any work and points at --no-publish.

Use dockhand status to follow your contributions, and dockhand verify jq to verify a committed branch again. A failed build keeps the branch. Switch to it, look at the log, fix what needs fixing, and check it again with verify.

Open the pull request later

When a branch has a passing build but no pull request yet, preview the publication and then open it:

dockhand publish jq --dry-run
dockhand publish jq

The dry run shows the full pull-request body without pushing anything. The real run pushes the branch to your fork and opens the pull request against MacPorts. Publishing requires a passing build for exactly the committed contents; if you changed the branch since it was built, Dockhand asks you to verify it again first.

Edit by hand

Dockhand's branches are ordinary Git branches, and Dockhand is happy to build and publish branches you made yourself. Edit the Portfile or patches, keep the contribution as one commit confined to one port directory, then check and publish:

git switch dockhand/bump/jq-...
# edit, then stage the changed files
git add <changed-files>
dockhand verify jq --working-tree --trace
git commit --amend --no-edit
dockhand verify jq
dockhand publish

Plain dockhand verify jq builds the contribution's committed branch. --working-tree captures the checkout instead, including staged edits, so you can build before you commit; new files must be staged to be included. --branch <name> checks another branch's committed contents. Without a Tart image, add --provider github, which pushes the branch to your fork for the workflow to build.

Follow, resume, or cancel

Everything Dockhand accepts is recorded, so you can leave and come back:

dockhand status
dockhand status --active
dockhand wait --job <job-id> --trace
dockhand cancel --job <job-id> --wait

After a PR is merged or closed, run dockhand refresh jq to record its outcome and let the next bump start fresh; the live status table and start do the same on their own every few minutes. A merged PR's local and fork branches are deleted once they no longer hold anything unpublished; one that could not be deleted yet, because it is checked out or the fork was unreachable, is recorded as owed and retried, and status says which. Use dockhand abandon jq to end local pursuit of an update while preserving its branch and any PR; cancel pending jobs first.

status --print reads what is recorded and starts nothing. wait resumes a job and follows it to the end. wait and cancel also accept --branch <name>, or no selector at all when you are on the branch in question. Ctrl-C detaches from a running command; the build keeps going, and cancel is how you stop it. dockhand start keeps working through every pending job for the checkout until you interrupt it.

Commands exit with 0 on success, 2 when the requested build failed, 3 when something needs your attention, 130 when interrupted or canceled, and 1 for any other error.

Housekeeping

Dockhand keeps its records in one SQLite database, ~/.dockhand/state.db by default (--db selects another). Completed verification VMs are released automatically, including failed builds. Use --keep-failed on a bump or verification to retain a failed VM for investigation. Logs survive VM release and are eligible for automatic cleanup after seven days. Preview or request additional cleanup with gc:

dockhand gc --dry-run
dockhand gc
dockhand db backup ~/Backups/dockhand.db
dockhand db check

A newer Dockhand upgrades the database the first time a command writes to it; a read-only command on an older database asks you to run dockhand db migrate first, after dockhand db backup if you want the old schema kept.

Additional Info

The docs/ directory has the detailed material:

A few things worth knowing up front:

  • Automatic version discovery covers GitHub and GitLab sources that follow the PortGroup conventions, and any port whose livecheck MacPorts resolves to a plain regex over an HTTP listing. A port with a custom livecheck script, a version composed from several variables, or a commit pinned as its version can still be bumped to a version you name, or edited by hand and then built and published with Dockhand.
  • review appears in --help but is not implemented yet.
  • Build results, VM images, and logs live outside the database: VMs under Tart's home directory, logs and artifacts next to the database under ~/.dockhand/.
  • A successful GitHub Actions workflow is recorded as a pass under the workflow's own rules, which may tolerate individual port test failures. A Tart build reports lint, build, tests, and install separately.

Dockhand is developed at github.com/herbygillot/dockhand and licensed under the MIT License.

Directories

Path Synopsis
cmd
dockhand command
Command dockhand prepares, verifies, and publishes MacPorts contributions.
Command dockhand prepares, verifies, and publishes MacPorts contributions.
internal
app
Package app composes Dockhand's configuration, workflow engine, and concrete integrations for command callers.
Package app composes Dockhand's configuration, workflow engine, and concrete integrations for command callers.
archive
Package archive walks tar and zip source archives without extracting them onto the host.
Package archive walks tar and zip source archives without extracting them onto the host.
assess
Package assess reports whether committed ports have supported update inputs.
Package assess reports whether committed ports have supported update inputs.
atomicfile
Package atomicfile durably replaces small local files.
Package atomicfile durably replaces small local files.
cli
Package cli defines Dockhand's Cobra commands and their user-facing behavior.
Package cli defines Dockhand's Cobra commands and their user-facing behavior.
credential
Package credential defines secret-storage and device-authorization contracts.
Package credential defines secret-storage and device-authorization contracts.
credential/keychain
Package keychain stores credentials in the current user's macOS Keychain.
Package keychain stores credentials in the current user's macOS Keychain.
fetch
Package fetch performs bounded HTTP transfers using caller-owned requests and clients.
Package fetch performs bounded HTTP transfers using caller-owned requests and clients.
filelock
Package filelock provides context-aware advisory locks for files and external resources shared by Dockhand processes.
Package filelock provides context-aware advisory locks for files and external resources shared by Dockhand processes.
forge
Package forge defines remote repository observations and publication inputs shared by forge adapters and their consumers.
Package forge defines remote repository observations and publication inputs shared by forge adapters and their consumers.
forge/github
Package github adapts GitHub repositories and pull requests to forge contracts.
Package github adapts GitHub repositories and pull requests to forge contracts.
forge/gitlab
Package gitlab adapts GitLab tag observations to forge contracts.
Package gitlab adapts GitLab tag observations to forge contracts.
git
Package git provides repository operations through a configurable Git executable.
Package git provides repository operations through a configurable Git executable.
git/changeset
Package changeset captures Git-backed sources and describes changes between immutable objects.
Package changeset captures Git-backed sources and describes changes between immutable objects.
github
Package github supplies the GitHub client and authentication shared by forge and verification adapters.
Package github supplies the GitHub client and authentication shared by forge and verification adapters.
macos
Package macos describes macOS releases and supplies developer-tool, storage, and launchd operations.
Package macos describes macOS releases and supplies developer-tool, storage, and launchd operations.
macports
Package macports defines bound ports-tree contexts and evaluated observations.
Package macports defines bound ports-tree contexts and evaluated observations.
macports/dependency
Package dependency handles generated MacPorts Go and Rust dependency blocks.
Package dependency handles generated MacPorts Go and Rust dependency blocks.
macports/dependents
Package dependents discovers downstream verification coverage from a frozen ports tree.
Package dependents discovers downstream verification coverage from a frozen ports tree.
macports/distfiles
Package distfiles associates native fetch observations with exact checksum declarations.
Package distfiles associates native fetch observations with exact checksum declarations.
macports/eval
Package eval implements MacPorts evaluation through its native Tcl runtime.
Package eval implements MacPorts evaluation through its native Tcl runtime.
macports/fidelity
Package fidelity compares MacPorts evaluations of a Portfile before and after an edit and reports whether only the intended metadata changed.
Package fidelity compares MacPorts evaluations of a Portfile before and after an edit and reports whether only the intended metadata changed.
macports/installation
Package installation observes and installs MacPorts on an explicit command target.
Package installation observes and installs MacPorts on an explicit command target.
macports/patchcheck
Package patchcheck tells whether a port's patch files still apply to a source archive before any build is attempted.
Package patchcheck tells whether a port's patch files still apply to a source archive before any build is attempted.
macports/portedit
Package portedit prepares evaluated Portfile edits in disposable source workspaces.
Package portedit prepares evaluated Portfile edits in disposable source workspaces.
macports/portfile
Package portfile identifies and edits literal inputs in Tcl Portfiles.
Package portfile identifies and edits literal inputs in Tcl Portfiles.
macports/portindex
Package portindex prepares, reads, and retains MacPorts indexes for immutable source trees.
Package portindex prepares, reads, and retains MacPorts indexes for immutable source trees.
macports/selection
Package selection resolves port names in a captured source before native evaluation.
Package selection resolves port names in a captured source before native evaluation.
macports/source
Package source interprets the upstream conventions of evaluated Portfiles.
Package source interprets the upstream conventions of evaluated Portfiles.
macports/survey
Package survey selects ports from an isolated snapshot of committed source.
Package survey selects ports from an isolated snapshot of committed source.
macports/version
Package version owns how Dockhand reads a version spelling: whether it is a usable spelling at all, how an upstream tag maps to and from it, and whether it is stable or a prerelease.
Package version owns how Dockhand reads a version spelling: whether it is a usable spelling at all, how an upstream tag maps to and from it, and whether it is stable or a prerelease.
outdated
Package outdated observes upstream updates for ports selected from committed local source.
Package outdated observes upstream updates for ports selected from committed local source.
proc
Package proc drives workflow cycles within the current Dockhand process.
Package proc drives workflow cycles within the current Dockhand process.
progress
Package progress carries transient operation messages through a context to an optional observer.
Package progress carries transient operation messages through a context to an optional observer.
publish
Package publish plans and reconciles the remote publication of verified contributions.
Package publish plans and reconciles the remote publication of verified contributions.
record
Package record defines Dockhand's durable workflow records and shared identities and value types.
Package record defines Dockhand's durable workflow records and shared identities and value types.
state
Package state defines repository-scoped persistence and shared provider coordination for Dockhand workflows.
Package state defines repository-scoped persistence and shared provider coordination for Dockhand workflows.
state/sqlite
Package sqlite implements Dockhand's state contracts using SQLite.
Package sqlite implements Dockhand's state contracts using SQLite.
subprocess
Package subprocess runs one external command with the conventions every Dockhand tool runner shares: a bounded wait after cancellation, captured output, the context error joined into the cause, and one error shape that names the tool, its command, and what it wrote to stderr.
Package subprocess runs one external command with the conventions every Dockhand tool runner shares: a bounded wait after cancellation, captured output, the context error joined into the cause, and one error shape that names the tool, its command, and what it wrote to stderr.
tart
Package tart provides shared mechanics for the local Tart installation and its images.
Package tart provides shared mechanics for the local Tart installation and its images.
tart/host
Package host controls concrete Tart VMs and their guest-agent transport.
Package host controls concrete Tart VMs and their guest-agent transport.
tart/provision
Package provision constructs and validates local Tart images for verification.
Package provision constructs and validates local Tart images for verification.
tcl/rpc
Package rpc exchanges framed calls with a Tcl child over its standard streams.
Package rpc exchanges framed calls with a Tcl child over its standard streams.
tcl/shell
Package shell manages Tcl child processes and their bounded output.
Package shell manages Tcl child processes and their bounded output.
tcl/syntax
Package syntax parses Tcl source into byte-addressed syntax without evaluating it.
Package syntax parses Tcl source into byte-addressed syntax without evaluating it.
text
Package text provides byte spans and edits for source-preserving transformations.
Package text provides byte spans and edits for source-preserving transformations.
tui
Package tui renders the live status table: the contribution projection polled from the state database, one row per contribution, with keys that map onto the existing verbs and add no authority of their own.
Package tui renders the live status table: the contribution projection polled from the state database, one row per contribution, with keys that map onto the existing verbs and add no authority of their own.
upstream
Package upstream selects and checks releases for interpreted MacPorts sources.
Package upstream selects and checks releases for interpreted MacPorts sources.
verify
Package verify defines verification plans, provider contracts, and evidence assessment.
Package verify defines verification plans, provider contracts, and evidence assessment.
verify/github
Package github verifies committed contributions through GitHub Actions on a personal MacPorts fork.
Package github verifies committed contributions through GitHub Actions on a personal MacPorts fork.
verify/staging
Package staging prepares indexed source archives for verification providers.
Package staging prepares indexed source archives for verification providers.
verify/tart
Package tart verifies ports in isolated local Tart virtual machines.
Package tart verifies ports in isolated local Tart virtual machines.
version
Package version describes the running dockhand build from the information the Go toolchain embeds: the module version when built from a tagged module, otherwise the VCS revision, marked when the tree was modified.
Package version describes the running dockhand build from the information the Go toolchain embeds: the module version when built from a tagged module, otherwise the VCS revision, marked when the tree was modified.
workflow
Package workflow accepts Dockhand requests and advances durable records toward their requested destinations.
Package workflow accepts Dockhand requests and advances durable records toward their requested destinations.
workflow/policy
Package policy answers read-only questions about recorded workflow state: which verification evidence applies to a build question, whether evidence covers a publication's whole cohort, and whether a publication action still matches its job.
Package policy answers read-only questions about recorded workflow state: which verification evidence applies to a build question, whether evidence covers a publication's whole cohort, and whether a publication action still matches its job.
workflow/preparation
Package preparation connects immutable Git sources to Portfile editing.
Package preparation connects immutable Git sources to Portfile editing.
workflow/view
Package view is the contribution-centric projection of the engine's recorded snapshot: the rows a person reads in status, its JSON, and the live table.
Package view is the contribution-centric projection of the engine's recorded snapshot: the rows a person reads in status, its JSON, and the live table.
tools
stateperf command
Command stateperf measures SQLite state and workflow-cycle costs with synthetic job histories.
Command stateperf measures SQLite state and workflow-cycle costs with synthetic job histories.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL