Skip to content
aaronfloreyPublic

About

Go CLI that updates project dependencies when you enter a repository.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

pupdate

CI Release License

pupdate is a fast Go CLI that keeps project dependencies up to date when you enter a repository. It detects dependency ecosystems in the current directory, other depth-1 subdirectories, and direct children of packages/, runs the matching package manager when work is needed, and skips unnecessary installs when dependency files have not changed.

It is built for shell-hook usage on cd, so the common path stays low-latency, safe by default, and easy to follow from concise stderr status output.

Detection uses a definition-backed signal registry with small local fallbacks for Kasetto and Git submodules. Install command construction is backed by github.com/git-pkgs/managers. pupdate preserves bounded traversal, local state, and safe default behavior.

Install

Homebrew:

brew install --cask aaronflorey/tap/pupdate

Go toolchain:

go install github.com/aaronflorey/pupdate/cmd/pupdate@latest

bin:

bin install github.com/aaronflorey/pupdate

Requires bin to be installed and available on PATH.

Project Docs

Release and CI

  • Supported release platforms are Linux and macOS.
  • Operating systems outside that support surface are best-effort only and are not shipped as release binaries.
  • CI runs on pull requests and pushes to main across Linux and macOS.
  • release-please maintains changelog and semver release PRs.
  • GoReleaser publishes tagged Linux/macOS release binaries and updates the Homebrew tap cask.
  • Release notes are published on the GitHub Releases page.

Quick Start

Run manually in a project:

pupdate run

Install the shell hook for your current session:

eval "$(pupdate init --shell bash)"
eval "$(pupdate init --shell zsh)"
eval "$(pupdate init --shell fish)"

Use explicit foreground mode when you want synchronous hook execution:

eval "$(pupdate init --shell bash --mode foreground)"

Preview and persist the hook in your shell startup file:

pupdate init install --shell bash
pupdate init install --shell bash --apply

Use pupdate init uninstall --shell bash to preview removal, then add --apply.

Escaped form for docs or templates that need literal shell interpolation text:

eval "\$(pupdate init --shell bash)"
eval "\$(pupdate init --shell zsh)"
eval "\$(pupdate init --shell fish)"

The generated hooks run the resolved pupdate executable path with hook --quiet on directory changes, but skip launching from $HOME. Quiet runs, manual or hook, suppress routine status and child-command output while still reporting install errors, so asynchronous updates do not overwrite the live shell prompt.

By default, pupdate init generates hooks that run hook --quiet --async in the background using the current executable path. The detached worker, manual runs, and resets use the same nonblocking repository advisory lock. Runs and hook workers create .pupdate.hook.lock only after detecting a supported project; empty and excluded folders do not get a lock file. Once created, it remains in place; lock ownership, not file contents or age, determines whether work is active.

Both .pupdate and .pupdate.hook.lock are generated local-machine state files. Add them to your application repository's ignore file and do not commit them.

What It Does

  • detects supported dependency ecosystems from lockfiles and manifests
  • resolves manager binaries from your current PATH
  • skips work when dependency inputs are unchanged since the last successful run
  • stores local state in .pupdate
  • explains current detection, freshness, config, and PATH readiness with pupdate status
  • respects .pupignore to skip the full run (detection, freshness checks, and installs)
  • uses safe defaults and requires explicit opt-in for lifecycle scripts or Python installs that can run install/build code

Supported Ecosystems

Ecosystem Detected By Manager Default Behavior
Node bun.lock, bun.lockb bun bun install --frozen-lockfile --ignore-scripts
Node package-lock.json, npm-shrinkwrap.json npm npm ci --ignore-scripts
Node pnpm-lock.yaml pnpm pnpm install --frozen-lockfile --ignore-scripts
Node yarn.lock Yarn Classic 1.x yarn install --frozen-lockfile --ignore-scripts; Yarn Modern is detected but blocked
PHP composer.lock composer composer install --no-interaction --prefer-dist --no-plugins --no-scripts
Python uv.lock uv skipped by default; --allow-scripts opts into uv sync --frozen
Python poetry.lock poetry skipped by default; --allow-scripts opts into poetry install --no-interaction --sync
Python requirements.txt pip skipped by default; --allow-scripts opts into pip install -r requirements.txt --disable-pip-version-check --no-input
Kasetto kasetto.lock, kasetto.yaml, kasetto.yml kst kst sync --project --config <local-config>
Go go.mod go go mod download
Rust cargo.lock cargo cargo fetch --locked
Git submodules .gitmodules git git submodule update --init --recursive

Manager binaries are resolved from the current process PATH, which keeps pupdate compatible with tools like nvm, asdf, and mise.

Kasetto installs only run when a local kasetto.yaml or kasetto.yml is detected. Lock-only Kasetto detections are skipped.

Commands

pupdate run

Detects supported ecosystems in the current directory and emits human-readable status lines on stderr. The command skips the user's home directory and can be restricted to top-level project directories inside configured roots.

Flags:

  • --quiet: suppress routine status output and child command output
  • --allow-scripts: allow dependency manager lifecycle scripts where supported, and opt into Python installs that can execute install/build code
  • --dry-run: show what would run without executing installs or saving state

Environment:

  • PUPDATE_SKIP_INSTALL=1: run detection only; installs and all .pupdate writes are disabled

User config:

  • PUPDATE_CONFIG=/path/to/config.yaml: override the config file path for this invocation; relative paths resolve from the current working directory
  • ~/.config/pupdate/config.yaml
  • root_directories: with one or more paths (for example ~/code): only run when the current working directory is a direct child of one of those roots; ~ expands to the user's home directory
  • workspace_globs: with one or more repo-relative directory globs (for example apps/* or services/*): opt in to scanning additional workspace directories that match those patterns
  • folder_blacklist: with one or more exact directory names (for example blah or vendor): skip traversing any matching directory name during detection, both in the default shallow scan and while expanding workspace_globs
  • quiet: true|false: set the default run quiet mode without needing --quiet in shell aliases or wrappers
  • allow_scripts: true|false: set the default lifecycle-script policy for run; explicit command flags still win
  • when missing, pupdate run and pupdate config use implicit defaults (root_directories: [], workspace_globs: [], folder_blacklist: []) without creating the config directory or writing config.yaml

A repository-local .pupdate.yaml is loaded automatically. It accepts only workspace_globs and folder_blacklist. Normalized project values are appended to user values with stable deduplication; blacklists are unioned, so a committed project config cannot remove a user exclusion. Project workspace globs can explicitly broaden traversal. Root restrictions, quiet mode, and script policy remain user-only. Unknown keys and additional YAML documents are errors.

workspace_globs is optional and does not change the default traversal unless you set it. Without any configured globs, pupdate still scans only the repository root, other depth-1 subdirectories, and direct children of packages/.

Example config for a monorepo that keeps the shallow default scan but also checks common workspace folders:

workspace_globs:
  - apps/*
  - services/*

Each glob is matched relative to the repository root, so the example above adds directories like apps/web and services/api. Matches add those exact workspace directories to the scan; pupdate does not continue scanning deeper nested directories under each match unless another configured glob matches them.

folder_blacklist is also optional. Each entry must be an exact directory name, not a path like foo/blah and not a glob like blah*. A blacklist entry such as blah skips traversal into any directory named blah, so it excludes both ./blah from the default shallow scan and nested paths like ./foo/blah when a configured workspace glob would otherwise reach them.

Example config for a monorepo that expands into workspaces but skips known directory names anywhere they appear during traversal:

workspace_globs:
  - apps/*
  - foo/*/*
folder_blacklist:
  - blah
  - vendor

folder_blacklist only skips matching subdirectories during traversal. It does not disable the whole repository. .pupignore is broader: it short-circuits the entire repo before detection, freshness checks, and installs.

pupdate init

Prints the shell hook snippet for bash, zsh, or fish.

Flags:

  • --shell <bash|zsh|fish>: choose the shell explicitly
  • --mode <foreground|async>: choose synchronous foreground execution, or use the default async background hook that detaches update execution from the shell transition

pupdate init install and pupdate init uninstall manage one marked block in a startup file. Both preview by default and require --apply to write. Default targets are ~/.bashrc, $ZDOTDIR/.zshrc (or ~/.zshrc), and $XDG_CONFIG_HOME/fish/config.fish (or ~/.config/fish/config.fish). Existing symlinks are resolved before editing. The first applied change saves the original as <target>.pupdate.bak; that backup is never overwritten or restored automatically. Writes are atomic and preserve existing permissions.

pupdate config

Prints the resolved user config path and active config values. If the config file is missing, it reports the missing path and the implicit default values without creating config.yaml.

Output includes:

  • whether the config file currently exists
  • the configured root_directories values from the file
  • the resolved root_directories values after ~ expansion and path normalization
  • the configured and resolved workspace_globs values
  • the configured and resolved folder_blacklist values
  • the configured quiet and allow_scripts values when set
  • project config path, existence, traversal values, and effective merged values

pupdate reset

Deletes the .pupdate state file in the current directory. The next pupdate run will treat all dependencies as stale and re-evaluate from scratch.

pupdate status

Prints a read-only diagnostic snapshot for the current directory so you can see whether pupdate run would skip, wait, or be blocked before it actually tries to execute anything.

Output includes:

  • overall run_status and run_reason for the current directory
  • config path, existence, and resolved root_directories
  • configured and effective quiet / allow_scripts run defaults
  • background hook lock path and whether a detached hook run is currently active
  • .pupdate path, existence, and any state decode warnings
  • project and effective traversal configuration
  • one section per detected target with matched files, freshness result, last_success_at, install readiness, and resolved manager path

How It Works

  1. pupdate run scans the current directory, other depth-1 subdirectories, and direct children of packages/ for known lockfiles and manifests. If you set workspace_globs, it also scans matching repo-relative workspace directories such as apps/* or services/*. If you set folder_blacklist, any directory whose exact name matches an entry is skipped during both kinds of traversal.
  2. It detects the matching ecosystem and package manager.
  3. It compares current file hashes against the local .pupdate state file using namespaced keys per ecosystem and directory.
  4. If dependency inputs are unchanged since the last successful run, it skips work.
  5. If inputs changed, or if no successful state exists yet, it runs the manager's safe default command. Managers without a verified safe mode (currently the Python managers) are skipped unless you explicitly allow scripts.
  6. Independent targets continue after a manager failure. Successful results are saved first, then manual pupdate run returns a stable aggregate error and a nonzero exit status if any manager failed.

For git submodules, pupdate also checks git submodule status --recursive so it can react to submodule drift even when .gitmodules itself has not changed.

On unsupported operating systems, freshness checks may rehash unchanged lockfiles more often because the file-identity shortcut used to skip rehashing is only implemented on supported platforms.

Status Output

Manual runs use stable, concise stderr prefixes:

  • pupdate: skip repo ($HOME)
  • pupdate: skip repo (outside configured root_directories)
  • pupdate: skip repo (.pupignore)
  • pupdate: installs disabled via PUPDATE_SKIP_INSTALL
  • pupdate: skip <target> (<reason>)
  • pupdate: run <manager> <args> (in <subdir>)
  • pupdate: done <manager> (in <subdir>)
  • pupdate: error: dependency installs failed: <manager> install failed for <target>: <err>
  • pupdate: error: operation canceled

Successful --quiet runs, manual or hook, are fully silent, including successful updates. Failures still produce one final error. Repository-derived control characters are rendered with quoted ASCII escapes so output cannot forge terminal lines. SIGINT and SIGTERM cancel the active manager, stop later targets, save earlier successful outcomes, and release the repository lock. On Linux and macOS, cancellation terminates the manager's process group so descendants do not keep the lock alive.

These messages are meant to stay readable in interactive shells and easy to grep from shell history or logs.

Safety Model

  • Safe and frozen install modes are used by default where supported.
  • Composer plugins and scripts are disabled by default; other lifecycle scripts are disabled where supported.
  • Python managers are skipped by default and only run when you explicitly pass --allow-scripts.
  • --allow-scripts is required to opt into lifecycle scripts and Python installs that can execute install/build code.
  • .pupignore short-circuits the full run for a repository before detection and state checks.
  • root_directories can restrict runs to top-level project directories under specific roots.
  • Hook-driven runs default to non-blocking async execution and avoid launching from $HOME.
  • Manual runs, hook workers, and resets are serialized with a repository advisory lock held through process-tree termination and state persistence.
  • Git submodule status failures are surfaced as stderr errors without crashing the command.

Development

For local setup, build, test, lint, and release commands, see docs/development.md.

About

Go CLI that updates project dependencies when you enter a repository.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages