Skip to content
smartyPublic

About

A simple (bare-bones) dependency manager.

Resources

Contributing

Stars

1 star

Watchers

3 watching

Forks

Repository files navigation

satisfy

satisfy is a lightweight package and version manager built around Google Cloud Storage (GCS). It uploads, downloads, and verifies versioned package archives, managing a JSON manifest and a compressed archive (zstd, gzip, or zip) for each version. Local integrity checks let it skip re-downloading content that is already present and correct.

It is typically used to publish and consume versioned data packages: a build job uploads a new version, and downstream pipelines or services download a specific version, the latest version, or a named tag.

Installation

Install the command with Go (see v2/go.mod for the required version):

go install github.com/smarty/satisfy/v2/cmd/satisfy@latest

Or build from a checkout:

make compile          # produces ./workspace/satisfy
# or
go -C v2 build -o ../satisfy ./cmd/satisfy

Print the version of a built binary:

satisfy version

Authentication

satisfy authenticates to GCS with the first of these that is configured:

  1. GOOGLE_OAUTH_ACCESS_TOKEN: a short-lived OAuth access token.
  2. GOOGLE_CREDENTIALS: a base64-encoded service-account key (JSON), as typically supplied by CI/CD pipelines.
  3. GOOGLE_APPLICATION_CREDENTIALS: the path to a service-account key file.
  4. Vault: when VAULT_ADDR, VAULT_TOKEN and VAULT_KEY are all set, a short-lived access token is generated by Vault's Google Cloud secrets engine.

If none is configured, the command fails. A download listing can also supply an access token directly (see Download).

How packages are stored

For a package named cat-sound-data, the remote layout is:

/cat-sound-data/manifest.json              <- root manifest (latest + tags)
/cat-sound-data/2026.01.A/manifest.json    <- per-version manifest
/cat-sound-data/2026.01.A/archive          <- per-version compressed archive
/cat-sound-data/2026.01.B/manifest.json
/cat-sound-data/2026.01.B/archive

The root manifest is a copy of the most recently uploaded version's manifest. It is what the keyword latest resolves to, and it is the only place tags are stored. A per-version manifest never contains tags.

A manifest looks like this:

{
  "name": "cat-sound-data",
  "version": "2026.01.B",
  "archive": {
    "filename": "archive",
    "size": 2506300011,
    "md5": "34GMLE2LaQI1QHKoHJFRbQ==",
    "contents": [
      { "path": "meows.txt", "size": 16087014133, "md5": "4ksM3tWryJom2O8XrU1l5A==" },
      { "path": "purrs.txt", "size": 39014497,    "md5": "E4LTd7kXWcP6kdAvTy9sHg==" }
    ],
    "compression": "zstd"
  }
}

The root manifest additionally carries a tags array (see Tags).

Commands

Command Purpose
(none) Download dependencies (the default action).
upload Build and upload a package version, optionally applying tags.
check Report whether a version has already been uploaded.
latest Print the latest published version of a package.
tags list List a package's tags and the versions they point to.
tags modify Add, update, or delete tags without re-uploading.
version Print the satisfy tool version.

Commands that take a JSON request read it from a file via -json <path>, or from standard input when -json is omitted (the default, _STDIN_).


Download (default)

Running satisfy with no subcommand downloads the dependencies described by a listing. Each dependency's package_version may be a literal version, the keyword latest, or a tag name.

satisfy -json dependencies.json
# or
cat dependencies.json | satisfy
{
  "dependencies": [
    {
      "package_name": "cat-sound-data",
      "package_version": "latest",
      "remote_address": "gcs://cats-data-dev",
      "local_directory": "."
    }
  ]
}
  • remote_address is the bucket (and optional path prefix), e.g. gcs://bucket/releases.
  • local_directory is where the archive is extracted. ~/, $HOME, and ${HOME} prefixes are expanded.
  • An optional top-level "credentials" field supplies an OAuth access token, used instead of the credentials described in Authentication.

satisfy writes a local manifest_<package>.json next to the extracted files and uses it to skip downloads when the installed version already matches and passes its integrity check.

Flags:

Flag Default Meaning
-json _STDIN_ Path to the dependency listing, or _STDIN_.
-max-retry 5 Retry attempts for downloads.
-concurrency number of CPUs How many packages to download and install at the same time.
-quick true When false, fully re-hash file contents during verification instead of the quick listing check.
-progress true Show extraction progress.

Package names passed as non-flag arguments filter the listing, e.g. satisfy -json deps.json cat-sound-data installs only that dependency.


Upload

Builds an archive from a source path, computes its manifest, and uploads both the versioned manifest/archive and the updated root manifest.

satisfy upload -json upload.json
{
  "package_name": "cat-sound-data",
  "package_version": "2026.02.B",
  "compression_algorithm": "zstd",
  "compression_level": 9,
  "remote_address": "gcs://cats-data-dev",
  "tags": ["experimental"],
  "source_path": "/data/satisfy/cats"
}
  • compression_algorithm is one of zstd, gzip, or zip.
  • Provide exactly one source: source_path, source_directory, or source_file.
  • tags is optional; see Tagging during upload.

Flags:

Flag Default Meaning
-json _STDIN_ Path to the upload request, or _STDIN_.
-max-retry 5 Retry attempts for uploads.
-overwrite false Upload even if the version already exists remotely.
-progress true Show archiving progress.

Exit codes: 0 success, 1 failure, 2 the version was already uploaded (unless -overwrite is set).


Check

Reports whether package@version (from an upload-style request) already exists remotely. Useful as a guard before an expensive upload. Exits 2 if the version is already present.

satisfy check -json upload.json

Latest

Prints the latest published version of a package (the version recorded in the root manifest) to stdout.

satisfy latest -bucket cats-data-dev -package cat-sound-data
Flag Default Meaning
-bucket — GCS bucket name (required, bare name — no scheme or slashes).
-path — Optional path prefix within the bucket.
-package — Package name (required).
-max-retry 5 Retry attempts.

Tags

A tag is a named pointer to a specific version that moves only when you move it. Unlike latest, which always tracks the most recent upload, a tag such as stable or release lets downstream consumers depend on a stable name and be promoted on your schedule — ideal for CI/CD, where a live service can always pull the release tag without knowing the exact version.

Tags live only in the root manifest:

{
  "name": "cat-sound-data",
  "version": "2026.02.A",
  "archive": { "...": "..." },
  "tags": [
    { "name": "experimental", "version": "2026.01.B" },
    { "name": "stable",       "version": "2026.01.A" }
  ]
}

Rules:

  • latest is a reserved name and cannot be used as a tag (the download keyword always wins). Tag names may not be blank.
  • The tag list is kept sorted by name for stable, reviewable diffs.

Downloading by tag

Put a tag name where you would put a version:

{
  "dependencies": [
    {
      "package_name": "cat-sound-data",
      "package_version": "stable",
      "remote_address": "gcs://cats-data-dev",
      "local_directory": "."
    }
  ]
}

Resolution is version-first: satisfy first checks for a manifest at the literal version path (a cheap HEAD request) and only falls back to resolving the string as a tag when no such version exists. So a real version always shadows a tag of the same name, and ordinary pinned-version downloads behave exactly as before with no extra cost. If a tag resolves to the version already installed locally, the download is skipped. If the string matches neither a version nor a tag, the download fails before removing any local files.

Tagging during upload

Add a tags array to an upload request to point those tag names at the version being uploaded:

{
  "package_name": "cat-sound-data",
  "package_version": "2026.02.B",
  "compression_algorithm": "zstd",
  "compression_level": 9,
  "remote_address": "gcs://cats-data-dev",
  "tags": ["experimental"],
  "source_path": "/data/satisfy/cats"
}

Existing tags are preserved: uploading with "tags": ["experimental"] moves only experimental to the new version and leaves an unrelated stable tag where it was. An upload with no tags field leaves all tags untouched.

Listing tags

satisfy tags list -bucket cats-data-dev -package cat-sound-data

Prints one name<TAB>version line per tag, sorted by name:

experimental	2026.01.B
stable	2026.01.A

A package with no tags prints nothing and exits 0. Add -json for a JSON array instead (an empty list prints []):

satisfy tags list -bucket cats-data-dev -package cat-sound-data -json
Flag Default Meaning
-bucket — GCS bucket name (required, bare name).
-path — Optional path prefix within the bucket.
-package — Package name (required).
-json false Emit a JSON array instead of tab-separated lines.
-max-retry 5 Retry attempts.

Modifying tags

Add, update, or delete tags on an already-uploaded package without re-uploading any data:

satisfy tags modify -json modify-tags.json
{
  "package_name": "cat-sound-data",
  "remote_address": "gcs://cats-data-dev",
  "add": [
    { "name": "stable",         "version": "2026.02.A" },
    { "name": "whiskers-favorite", "version": "2026.01.B" }
  ],
  "delete": [
    { "name": "active-build-test" }
  ]
}
  • add creates a tag, or updates it to the given version if it already exists.
  • delete removes a tag by name (any version is ignored). Deleting a tag that does not exist is a no-op, not an error.
  • Before writing anything, satisfy verifies that every version named in add actually exists remotely. If any target is missing, the whole request fails and nothing is written — no partial updates, no dangling tags.
Flag Default Meaning
-json _STDIN_ Path to the modification request, or _STDIN_.
-max-retry 5 Retry attempts.

Using satisfy as a Go library

go get github.com/smarty/satisfy/v2@latest

The github.com/smarty/satisfy/v2 package exposes everything the command does through a Client:

import "github.com/smarty/satisfy/v2"

client := satisfy.New(
	satisfy.WithLogger(slog.Default()), // logging is off unless a logger is given
	satisfy.WithMaxRetry(3),
)

// Remote addresses are satisfy.URL values: build one directly, e.g.
// satisfy.URL{Scheme: "gcs", Host: "cats-data-dev"}, or parse one.
remoteAddress, err := satisfy.ParseURL("gcs://cats-data-dev") // or just "cats-data-dev"

// Install (download) packages; already-installed versions are skipped.
err = client.Install(ctx, satisfy.Dependency{
	PackageName:    "cat-sound-data",
	PackageVersion: "stable", // a version, a tag, or "latest"
	RemoteAddress:  remoteAddress,
	LocalDirectory: "data",
})

// Upload a package version.
manifest, err := client.Upload(ctx, satisfy.UploadRequest{Package: satisfy.PackageConfig{ /* ... */ }})
if errors.Is(err, satisfy.ErrPackageExists) {
	// already uploaded; set Overwrite: true to replace it
}

// Inspect packages.
ref := satisfy.PackageRef{RemoteAddress: remoteAddress, Name: "cat-sound-data"}
exists, err := client.Exists(ctx, ref, "2026.01.B") // HEAD request; "latest" = any version uploaded
version, err := client.Latest(ctx, ref)
tags, err := client.Tags(ctx, ref)
err = client.ModifyTags(ctx, satisfy.TagModification{ /* ... */ })

The library never exits the process or writes to stdout/stderr. Every failure is returned as an error; use errors.Is with satisfy.ErrPackageExists, satisfy.ErrNotFound and satisfy.ErrInvalidConfig, and satisfy.StatusCode(err) for the HTTP status of an unexpected response from storage. Every method takes a context.Context, which cancels in-flight requests and retries. ValidateDependencies, ValidatePackageConfig and ValidateTagModification check input before any I/O.

LocalDirectory is used exactly as given: unlike the command line, the library does not expand ~ or $HOME.

Options:

Option Default Meaning
WithCredentialsReader(reader) environment discovery (see Authentication) Read credentials on first use and again once they are 30 minutes old.
WithCredentials(credentials) — Use fixed credentials (tokens expire; prefer a reader for long uploads).
WithHTTPClient(client) tuned client HTTP client used to reach GCS.
WithMaxRetry(n) / WithRetryDelay(d) 5 / 3s Retry policy for failed requests.
WithConcurrency(n) number of CPUs Packages Install handles at once.
WithContentVerification(bool) false Re-hash installed files before skipping a download.
WithLogger(*slog.Logger) discard Structured logs.
WithProgress(func(satisfy.Progress)) none Byte-level progress while archiving, downloading and extracting.

Migrating from v0

v2 (github.com/smarty/satisfy/v2) lives alongside v0, so you can move when ready. v0 stays available at github.com/smarty/satisfy.

v0 v2
transfer.NewUploadApp(config).Run() (exits the process on failure, and with code 2 if the version exists) client.Upload(ctx, satisfy.UploadRequest{Package: pkg, Overwrite: overwrite}) returns an error; check errors.Is(err, satisfy.ErrPackageExists)
transfer.NewCheckApp(config).Run() client.Exists(ctx, ref, version)
transfer.NewDownloadApp(config).Run() client.Install(ctx, dependencies...)
core.NewPackageInstaller(core.NewRetryClient(shell.NewGoogleCloudStorageClient(...)), ...) wired by hand satisfy.New(options...)
transfer.NewLatestApp(config).Run() (prints to stdout) client.Latest(ctx, satisfy.PackageRef{RemoteAddress: remoteAddress, Name: name}) returns the version
transfer.NewTagsListApp / transfer.NewTagsApp client.Tags / client.ModifyTags
contracts.UploadConfig{GoogleCredentials, CredentialReader, MaxRetry, ...} satisfy.WithCredentialsReader, satisfy.WithMaxRetry, ...
contracts.PackageConfig, contracts.Dependency, contracts.Manifest, contracts.URL satisfy.PackageConfig, satisfy.Dependency, satisfy.Manifest, satisfy.URL (same JSON; same fields except PackageConfig.RemoteAddressPrefix *URL, which is now RemoteAddress URL)
contracts.DependencyListing and its Validate() client.Install(ctx, dependencies...), which validates them; satisfy.ValidateDependencies(dependencies...) to check without installing. ~ and $HOME in LocalDirectory are no longer expanded.
contracts.TagModificationConfig satisfy.TagModification (RemoteAddress is a URL value, not a pointer)
url.Parse(address) then contracts.URL(*parsed) satisfy.ParseURL("gcs://bucket/prefix") (a bare bucket/prefix works too)
contracts.IsNotFound(err) errors.Is(err, satisfy.ErrNotFound)
errors.As with *contracts.StatusCodeError, then StatusCode() satisfy.StatusCode(err)
transfer.FileWrapper for re-sendable upload bodies not needed: retries rewind the body
contracts, core, shell packages internal; use the satisfy package

The command line is unchanged apart from these additions:

  • -concurrency flag for downloads
  • progress shown on stderr
  • structured (key=value) log lines on stderr
  • satisfy version printing to stdout
  • -h exiting with code 0
  • JSON keys in request files must match exactly (they are case-sensitive) and may not repeat

Building and testing

All development happens in the v2/ module; the repository root holds the deprecated v0 module. The Makefile targets operate on v2/:

make test        # format the code, then run the tests
make coverage    # run the tests with the race detector
make compile     # build the binary into ./workspace/satisfy

SMARTY DISCLAIMER: Subject to the terms of the associated license agreement, this software is freely available for your use. This software is FREE, AS IN PUPPIES, and is a gift. Enjoy your new responsibility. This means that while we may consider enhancement requests, we may or may not choose to entertain requests at our sole and absolute discretion.

About

A simple (bare-bones) dependency manager.

Resources

Contributing

Stars

1 star

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages