qatlas-kit

module
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0

README

Qatlas Kit

Qatlas Kit is a Go module with reusable building blocks for terminal and command-line applications: CLI output and diagnostics, terminal user interface texts and preferences, configuration files, hash-chained logs, local processes and channels, an encrypted vault, and signed updates and releases. Several independent applications build on it, so a fix, especially a security fix, reaches each of them with a version upgrade.

Packages

One line per package, in alphabetical order. The package documentation holds the contract.

  • approval: binds the use of a secret to a state a person approved, with fingerprints, a sealed approvals file and a readable diff.
  • archtest: checks import boundaries, forbidden names, key literals and text catalogs of a module's source against exceptions that can only shrink.
  • auditlog: appends entries to daily files linked by a signed hash chain and verifies, reads and aggregates them.
  • background: starts a detached background process and waits for its report.
  • cli: maps errors to exit codes and diagnostics and checks the confirmation of commands.
  • cmd/releasebuild: runs release/releasebuild for the module in the current directory.
  • cmd/tuidemo: shows the terminal building blocks at work with invented data, started with go run ./cmd/tuidemo.
  • cobracli: applies the shared flags, help, version and error conventions to a Cobra command tree.
  • configfile: writes configuration documents atomically, with locking, transactions and backups.
  • docker: reads containers from a Docker Engine over its Unix socket, groups them by Compose project, finds those that use a path, reads their CPU and memory use, streams their logs, starts, stops and restarts them and waits until they are healthy.
  • exteditor: hands a text to the user's editor on a private copy and returns the checked change, also as root for a target user.
  • filelock: provides an exclusive whole-file lock across processes.
  • fileretry: repeats a file operation that fails only because another process holds the file.
  • helptopics: shares plain-text help topics and terms between CLI, TUI and manpage.
  • highlight: turns a text and its file name into the sections a text view draws in its syntax roles, for YAML, env files, JSON, INI, TOML, shell and Dockerfile.
  • httpx: provides a client without redirects, bound cursors, status classes and bounded reading of answers.
  • i18n: holds the language choice of an application and the lookup of its texts.
  • jsonschema: checks JSON values against a strict subset of JSON Schema and names the first violation.
  • localipc: provides a local channel between processes with checked peer identity.
  • manpage: adds help topics to a manpage generated from a command tree.
  • notify: delivers notifications over a signed webhook, Slack, Telegram and SMTP with retries, spacing and redaction, receives replies to a Telegram bot by long polling, and verifies webhook signatures.
  • output: renders ordered results in the CLI output formats and defines the shared error codes.
  • projectpath: expands, resolves and compares paths, finds Git working tree roots and suggests completions for a typed path.
  • ptytest: runs a program at a pseudo-terminal or pseudo console in tests, types input and waits for its output.
  • ratelimit: spaces the requests of one credential, holds them when the remote side asks to wait, and counts units per key in a sliding or daily window.
  • redact: replaces registered secret values, also quoted or JSON-escaped, in text, errors and writers.
  • release: verifies signed release checksums and archive contents offline.
  • release/installer: renders the install.sh and install.ps1 installers of a signed release.
  • release/releasebuild: builds reproducible release archives, installers and checksums.txt, and documents the reusable release workflow.
  • release/releasetest: builds signed test releases and serves them from a local release server in tests.
  • selfupdate: selects, verifies and installs signed releases of the running program.
  • sqlite: opens an embedded SQLite database without cgo, migrates its schema in numbered steps and backs it up first.
  • sysservice: lays out a systemd system service for a program, checks its unit file and restarts the service after a self-update.
  • tui: provides the text catalogs, themes, styles, basic widgets, key table, frame with tabs, focus zones and footer, mouse targets, command line, lists, filter bar, forms, dialogs, a chat with a multi-line input, a file browser over entries the application supplies, a read-only text view with search and masked sections, help and explanations of a terminal user interface.
  • uiprefs: loads and saves the device-local preferences of a terminal user interface.
  • vault: stores secrets in an age-encrypted directory unlocked by a passphrase.
  • vaultproc: keeps an unlocked vault in a hardened background process and hands it to the program an update installs.
  • web: serves the browser interface of an application on loopback or, with TLS or declared proxies, on the network, with fixed host, origin and session checks, strict headers with a CSP nonce, size and time limits, detail-free error pages and redirects that stay on the server.

Installation

Add the module with an exact tagged version:

go get github.com/castrowithcee/qatlas-kit@vX.Y.Z

go.mod and go.sum of the application then pin that version. A newer version reaches the application only when it upgrades on purpose.

Strict by default, the application supplies names

Security checks are part of the kit and cannot be switched off or relaxed by an application. Where a legitimate second way exists, the kit offers it as an explicit, typed option whose zero value is the safe choice. Such an option replaces a check with an equivalent one, never with none.

The kit knows no application. Names, prefixes, paths, signing namespaces, trusted keys, cryptographic labels, texts and schemas come from the application through parameters, options or interfaces. Two applications never share a technical name.

Versioning

The module follows Semantic Versioning with tags vX.Y.Z. Before v1.0.0, a minor release may break the API, and its release notes name each break and how to adapt. Patch releases never break the API.

Local development

To develop an application against a local checkout of the kit, create a Go workspace in the application and keep it out of version control:

go work init . ../qatlas-kit

Do not commit go.work or go.work.sum. A release of the application builds without the workspace and binds only a tagged version of the kit.

Contributing and security

See CONTRIBUTING.md for conventions and checks, and SECURITY.md for reporting a vulnerability.

License

AGPL-3.0, see LICENSE. Origins of derived components are listed in THIRD_PARTY_NOTICES.md.

Directories

Path Synopsis
Package approval binds what an application may do with a secret to a state a person approved.
Package approval binds what an application may do with a secret to a state a person approved.
Package archtest checks the architecture of a Go module by reading its source, so a broken layer rule fails the test run instead of waiting for a review.
Package archtest checks the architecture of a Go module by reading its source, so a broken layer rule fails the test run instead of waiting for a review.
Package auditlog keeps an append-only log of entries in daily JSON Lines files, linked by a SHA-256 hash chain across day boundaries and optionally signed with an HMAC-SHA256 check value.
Package auditlog keeps an append-only log of entries in daily JSON Lines files, linked by a SHA-256 hash chain across day boundaries and optionally signed with an HMAC-SHA256 check value.
Package background starts a program as a background process that is detached from the terminal and session of the starter, hands it optional bytes through an inherited pipe, and waits for the report the process gives once it runs.
Package background starts a program as a background process that is detached from the terminal and session of the starter, hands it optional bytes through an inherited pipe, and waits for the report the process gives once it runs.
Package cli maps errors to the exit codes and stderr diagnostics of a command-line program and checks the confirmation of commands that ask or change data.
Package cli maps errors to the exit codes and stderr diagnostics of a command-line program and checks the confirmation of commands that ask or change data.
cmd
releasebuild command
Command releasebuild writes the assets of a signed release for the Go module in the current directory; see the releasebuild package for the archive layout and the checks.
Command releasebuild writes the assets of a signed release for the Go module in the current directory; see the releasebuild package for the archive layout and the checks.
tuidemo command
Command tuidemo shows the terminal building blocks of the kit at work, with invented sample data: a frame with product name, tabs, sub-tabs, a header and a footer with key hints, a key table, mouse support, dialogs and questions, help, explanations, a command line, and live switches for theme, language, icons and mouse.
Command tuidemo shows the terminal building blocks of the kit at work, with invented sample data: a frame with product name, tabs, sub-tabs, a header and a footer with key hints, a key table, mouse support, dialogs and questions, help, explanations, a command line, and live switches for theme, language, icons and mouse.
Package cobracli applies the shared command conventions to the Cobra command tree of an application.
Package cobracli applies the shared command conventions to the Cobra command tree of an application.
Package configfile provides schema-independent file operations for configuration documents.
Package configfile provides schema-independent file operations for configuration documents.
Package docker reads containers from a Docker Engine over its Unix socket: the container list, the details of one container, the Compose projects the containers belong to, the containers that use a path, one reading of a container's CPU and memory use, a container's logs as a stream of lines, and the actions start, stop and restart, with a wait until containers are healthy.
Package docker reads containers from a Docker Engine over its Unix socket: the container list, the details of one container, the Compose projects the containers belong to, the containers that use a path, one reading of a container's CPU and memory use, a container's logs as a stream of lines, and the actions start, stop and restart, with a wait until containers are healthy.
Package exteditor lets a terminal user interface hand a text to the user's own editor in the manner of sudoedit: the text goes to a copy in a private directory, the terminal goes to the editor through tea.ExecProcess, and when the editor has ended the copy is checked, read and removed, and the program gets an UnchangedMsg, a ChangedMsg with the new text or a FailedMsg.
Package exteditor lets a terminal user interface hand a text to the user's own editor in the manner of sudoedit: the text goes to a copy in a private directory, the terminal goes to the editor through tea.ExecProcess, and when the editor has ended the copy is checked, read and removed, and the program gets an UnchangedMsg, a ChangedMsg with the new text or a FailedMsg.
Package filelock provides an exclusive, blocking, whole-file lock that works the same way across processes on Linux, macOS and Windows.
Package filelock provides an exclusive, blocking, whole-file lock that works the same way across processes on Linux, macOS and Windows.
Package fileretry repeats a file operation that fails only because another process holds the file for a moment.
Package fileretry repeats a file operation that fails only because another process holds the file for a moment.
Package helptopics shares plain-text help topics and terms between a CLI, TUI, and manpage, so all of them show the same text.
Package helptopics shares plain-text help topics and terms between a CLI, TUI, and manpage, so all of them show the same text.
Package highlight turns a text and its file name into the sections a tui.TextView draws in its syntax roles.
Package highlight turns a text and its file name into the sections a tui.TextView draws in its syntax roles.
Package httpx holds the HTTP mechanics a client of a remote API needs regardless of the API: a client that never follows a redirect, the Retry-After wait, cursors bound to the request that issued them, the mapping of a failed status to a neutral Error, bounded reading of JSON answers, and the bounded, selective reading of an error answer into an Original kept apart from the message.
Package httpx holds the HTTP mechanics a client of a remote API needs regardless of the API: a client that never follows a redirect, the Retry-After wait, cursors bound to the request that issued them, the mapping of a failed status to a neutral Error, bounded reading of JSON answers, and the bounded, selective reading of an error answer into an Original kept apart from the message.
Package i18n holds the language choice of an application and the lookup of its texts.
Package i18n holds the language choice of an application and the lookup of its texts.
Package jsonschema checks JSON values against a subset of JSON Schema and names the first violation by its path, such as "$.items[2].name is required".
Package jsonschema checks JSON values against a subset of JSON Schema and names the first violation by its path, such as "$.items[2].name is required".
Package localipc provides a local process channel with checked peer identity.
Package localipc provides a local process channel with checked peer identity.
Package manpage adds application help topics to a manpage generated from its command tree, so the page shows the same text as the help command.
Package manpage adds application help topics to a manpage generated from its command tree, so the page shows the same text as the help command.
Package notify delivers notifications over a signed webhook, Slack, Telegram and SMTP, and receives the messages people send to a Telegram bot.
Package notify delivers notifications over a signed webhook, Slack, Telegram and SMTP, and receives the messages people send to a Telegram bot.
Package output renders ordered results in the table, JSON, compact and TOON formats and defines the error codes that applications share.
Package output renders ordered results in the table, JSON, compact and TOON formats and defines the error codes that applications share.
Package projectpath expands home-relative paths, resolves canonical paths, finds Git working tree roots, checks whether one path lies within another, and suggests completions for a typed file or directory path.
Package projectpath expands home-relative paths, resolves canonical paths, finds Git working tree roots, checks whether one path lies within another, and suggests completions for a typed file or directory path.
Package ptytest runs a program at a pseudo-terminal of its own, so tests can drive its terminal user interface and prompts the way a person at a terminal would.
Package ptytest runs a program at a pseudo-terminal of its own, so tests can drive its terminal user interface and prompts the way a person at a terminal would.
Package ratelimit spaces and counts the requests that share one credential.
Package ratelimit spaces and counts the requests that share one credential.
Package redact removes known secret values from text before it is shown.
Package redact removes known secret values from text before it is shown.
Package release verifies signed release files without network access.
Package release verifies signed release files without network access.
installer
Package installer renders the release installers install.sh, for Linux, macOS and WSL, and install.ps1, for Windows, of a caller-supplied program.
Package installer renders the release installers install.sh, for Linux, macOS and WSL, and install.ps1, for Windows, of a caller-supplied program.
releasebuild
Package releasebuild builds the assets of a signed release reproducibly: one archive per target, install.sh and install.ps1, and checksums.txt over all of them.
Package releasebuild builds the assets of a signed release reproducibly: one archive per target, install.sh and install.ps1, and checksums.txt over all of them.
releasetest
Package releasetest builds signed test releases: Ed25519 test keys, SSH signatures, archives, checksums.txt, and a local server for release downloads.
Package releasetest builds signed test releases: Ed25519 test keys, SSH signatures, archives, checksums.txt, and a local server for release downloads.
Package selfupdate selects, verifies and installs signed GitHub releases of the running program.
Package selfupdate selects, verifies and installs signed GitHub releases of the running program.
Package sqlite opens an embedded SQLite database without cgo, migrates its schema in numbered steps and backs it up before a migration.
Package sqlite opens an embedded SQLite database without cgo, migrates its schema in numbered steps and backs it up before a migration.
Package sysservice defines the layout of a systemd system service for a caller-supplied program and checks the unit file that runs it.
Package sysservice defines the layout of a systemd system service for a caller-supplied program and checks the unit file that runs it.
Package tui provides the neutral mechanics of a terminal user interface.
Package tui provides the neutral mechanics of a terminal user interface.
Package uiprefs loads and saves the device-local preferences of a terminal user interface in tui.yaml in the folder the application passes.
Package uiprefs loads and saves the device-local preferences of a terminal user interface in tui.yaml in the folder the application passes.
Package vault stores an application's secrets in an age-encrypted directory unlocked by a passphrase.
Package vault stores an application's secrets in an age-encrypted directory unlocked by a passphrase.
Package vaultproc keeps an unlocked vault in a hardened background process of its own, so later invocations of the application use it without asking for the passphrase again.
Package vaultproc keeps an unlocked vault in a hardened background process of its own, so later invocations of the application use it without asking for the passphrase again.
Package web serves the browser interface of an application with its protection built in.
Package web serves the browser interface of an application with its protection built in.

Jump to

Keyboard shortcuts

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