$ show alexellis/arkade
arkade is a command-line tool that functions as a marketplace and installer for developer tools and Kubernetes applications. It provides two primary workflows: downloading CLI binaries (over 200 tools) and installing Kubernetes Helm charts (over 50 apps) with custom overrides. The tool also supports OCI image installation/publishing, Helm chart image version upgrades, system-level package installation (e.g., Node.js, Caddy), and self-updating with SHA-256 verification. The architecture is a monolithic Go CLI built with Cobra, where each subcommand (get, install, update, system, oci, chart, etc.) is a separate command tree. Entry points include main.go (root command) and the various command files under cmd/. External dependencies include GitHub releases API, Helm CLI, kubectl, Docker (for qemu-static), and OCI registries. The codebase demonstrates solid engineering with reusable patterns such as template-based tool definitions, safe archive extraction, and a builder pattern for installer options, though it suffers from a large manual catalog that requires ongoing maintenance.
The LLM identified 3 files worth highlighting for reuse:
Implements tar.gz extraction with symlink escape detection and support for nested tarballs. The function checks extracted paths against the destination to prevent path traversal, and detects symlink loops. It also supports flat extraction (stripping top-level directories). This component is self-contained (only uses standard library) and can be reused in any project that needs secure archive extraction.
Defines a large catalog of CLI tools using a Tool struct with URLTemplate and BinaryTemplate fields powered by Go text/template. Each tool specifies owner, repo, name, version strategy (e.g., GitHubVersionStrategy, k8sVersionStrategy), and verification strategy (e.g., HashicorpShasumStrategy). The Tools type implements sorting. This pattern allows centralized management of download sources and is reusable for any project needing to maintain a dynamic tool catalog with platform-specific URLs.
Provides MergeFlags function that combines a base set of helm-style --set flags with user overrides, handling duplicate keys correctly. Also includes kubeconfig resolution and user directory setup. The pattern of merging default options with user-provided flags is clean and reusable across projects that need layered configuration (e.g., CLI with config file and command-line overrides).