From b19128b77ecd3874b1591c20446f1954b0062a4b Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Thu, 4 Jun 2026 12:04:42 +0000 Subject: [PATCH] Refresh README and CLI documentation --- README.md | 19 ++-- docs/cli.md | 280 +++++++++++++++++++++++++--------------------------- 2 files changed, 143 insertions(+), 156 deletions(-) diff --git a/README.md b/README.md index 397c8c6..15584c2 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,19 @@ # distributor -`distributor` validates manifested report bundles and publishes selected source or generated artifacts to configured destinations. +`distributor` validates manifested report bundles, plans destination updates, and publishes selected source files or generated HTML outputs to configured destinations. -It is a local-first CLI with SSH/SFTP, S3-compatible storage, and HTTP upload -support: source bundles can be read from local or remote storage, pushed to the -upload API, published to local directories or remote paths, and rendered from -Markdown to HTML sidecars or `index.html`. +It is a local-first Go CLI for report distribution. A pipeline reads one source bundle tree, validates `manifest.json`, fans out to one or more local, SSH/SFTP, or S3-compatible destinations, records destination state in `.distributor.json`, and can also accept authenticated tar or tar.gz uploads through the HTTP upload server. -Go producers can use `gitea.maximumdirect.net/eric/distributor/pkg/bundle` to build, write, parse, and validate complete local source bundles with the same manifest contract used by `distributor`. - -Run the local example pipeline: +Run the maintained local example: ```sh go run ./cmd/distributor run --config examples/local-publish.yml ``` -See [docs/cli.md](docs/cli.md), [docs/config.md](docs/config.md), [docs/operations.md](docs/operations.md), and [docs/troubleshooting.md](docs/troubleshooting.md) for the implemented CLI, configuration, operating notes, and common failure modes. Future and deferred work lives under `docs/roadmap/`. +Go producers can use `gitea.maximumdirect.net/eric/distributor/pkg/bundle` to build, write, parse, and validate local source bundles with the same manifest contract used by the CLI. + +- [CLI reference](docs/cli.md) +- [Configuration reference](docs/config.md) +- [Operations guide](docs/operations.md) +- [Troubleshooting](docs/troubleshooting.md) +- [Development architecture](docs/policy/architecture.md) diff --git a/docs/cli.md b/docs/cli.md index 504fbbf..f22b056 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -1,17 +1,24 @@ # Distributor CLI -## Shortest useful command +Audience: operators, integrators, and developers who run `distributor` from a shell or automation. + +This document is the canonical command and flag reference. Configuration schema details live in [Configuration](config.md), operational recovery guidance lives in [Operations](operations.md), and failure diagnosis lives in [Troubleshooting](troubleshooting.md). + +## Shortest Useful Command + +Run the maintained local publishing example from the repository root: ```sh go run ./cmd/distributor run --config examples/local-publish.yml ``` -This discovers the example source bundle and publishes source files to `workspace/published/source-bundle`. +The example reads `examples/source-bundle/manifest.json`, publishes the configured files into `workspace/published/source-bundle`, and writes destination state metadata beside the published output. -## Command overview +## Command Overview -```sh +```text distributor [--help] +distributor help distributor version [--format text|json] distributor run [--config ] [--dry-run] [--force] [--format text|json] distributor serve [--config ] @@ -19,193 +26,176 @@ distributor validate [--format text|json] distributor validate --config --pipeline [--bundle ] [--format text|json] distributor inspect [--format text|json] distributor inspect --config --pipeline [--bundle ] [--format text|json] +distributor manifest distributor manifest create --id [options] +distributor manifest create --id [options] ``` -- `version`: prints the application name and version. Development builds print `distributor dev`. -- `run`: loads a YAML config, discovers source bundles, plans each configured destination, writes selected outputs unless `--dry-run` is set, and prints a final status summary. -- `serve`: loads a YAML config, resolves HTTP upload bearer tokens, and runs the HTTP upload API. -- `validate`: validates a local source bundle directory, a local source bundle tree, or one configured pipeline source. -- `inspect`: validates source bundles and prints normalized bundle metadata for a local path or one configured pipeline source. -- `manifest create`: creates `manifest.json` for a local source bundle directory. +- `version` prints the application name and version. +- `run` executes configured pipelines against their destinations. +- `serve` starts the authenticated HTTP upload API defined by the configuration file. +- `validate` checks a local bundle path or a configured source bundle. +- `inspect` reports manifest and file metadata for a local bundle path or a configured source bundle. +- `manifest create` writes a `manifest.json` file for an existing bundle directory. -`validate` and `inspect` have two mutually exclusive modes: a local path shortcut, or configured source mode with `--config --pipeline `. Configured source mode opens only the selected pipeline source and supports configured `local`, `ssh`, and `s3` sources. It does not open destinations. `run` executes configured `local`, `ssh`, and `s3` sources and destinations. `serve` executes configured `http_upload` sources through the upload API and normal destination fan-out. +## Flag Reference -## Flag reference +### Help -Root command: +`distributor`, `distributor --help`, `distributor -h`, `distributor help`, and `distributor manifest` print command help. Unknown commands and invalid argument combinations print usage guidance and exit non-zero. -- `--help`, `-h`, or `help`: print root help. +### Common Output Format -All subcommands: +`--format text|json` is supported by `version`, `run`, `validate`, `inspect`, and `manifest create`. -- `--help`, `-h`: print command-specific help. +- `text` is the default human-readable output. +- `json` emits one JSON document for successful command execution. +- Invalid formats are rejected before command execution. -Output-producing subcommands: +### `version` -- `--format text|json`: output format. `text` is the default. Help and usage output are always text. +```sh +distributor version [--format text|json] +``` -`run` flags: +`version` accepts no positional arguments. Text output prints the application name and version; JSON output includes `application` and `version` fields. -- `--config `: config file to load. If omitted, `run` uses `/usr/local/etc/distributor/config.yml`. -- `--dry-run`: load config, discover bundles, inspect destination state, print planned actions and final status, and do not write output files, destination state, or SSH `known_hosts` entries. -- `--force`: allow explicit destructive replacement for supported conflict cases in this run only. +### `run` -`serve` flags: +```sh +distributor run [--config ] [--dry-run] [--force] [--format text|json] +``` -- `--config `: config file to load. If omitted, `serve` uses `/usr/local/etc/distributor/config.yml`. +- `--config ` loads the pipeline configuration. If omitted, the application uses `/usr/local/etc/distributor/config.yml`. +- `--dry-run` validates inputs and reports destination actions without applying changes. +- `--force` permits a run when destination state indicates a conservative safety check would otherwise block it. +- `--format text|json` selects human-readable or machine-readable output. -`validate` and `inspect` configured source flags: +`run` accepts no positional arguments. -- `--config `: config file to load for source validation or inspection. Required in configured source mode. -- `--pipeline `: pipeline source to validate or inspect. Required in configured source mode. -- `--bundle `: source-root-relative bundle directory to validate or inspect instead of discovering every bundle under the source root. +### `serve` -`manifest create` flags: +```sh +distributor serve [--config ] +``` -- `--id `: source bundle id. Required. -- `--file `: bundle-relative file to include. Repeatable. If omitted, files are scanned recursively. -- `--created