This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Deleterious is a Go CLI tool that finds AWS resources orphaned by CloudFormation stacks with retention policies. It also analyzes IAM access key usage. Built with Cobra/Viper, distributed via Homebrew, Scoop, and direct binary downloads.
This project uses Bazel (via Bazelisk) as the primary build system. Do not use go build directly.
bazel run :install # Build and install platform binaries to bdist/
bazel test //... # Run all tests
bazel coverage //... # Generate coverage reports
bazel run //:vendor # Sync Go dependencies and regenerate BUILD files (runs gazelle)After modifying go.mod or adding/removing Go files, run bazel run //:vendor to update BUILD files and vendored dependencies.
golangci-lint run # Go linting (config in .golangci.yml)
yamllint . # YAML linting
shellcheck scripts/*.sh # Shell script lintingKey golangci-lint settings: 120-char line limit, funlen max 100 lines/50 statements, gocyclo min complexity 10.
bazel test //... # Run all tests
bazel test //cmd:orphaned_test # Run a specific test targetTests use testify/mock with interface-based mocks generated by Mockery (cmd/mocks/). To regenerate mocks: go generate ./cmd/...
main.go— Entry point, callscmd.Execute(version)with version injected by Bazel linker flagscmd/root.go— Root Cobra command, sets up global flags (--config,--profile,--debug), initializes Zerolog logging and Viper config (~/.deleterious.yaml)cmd/orphaned.go—orphanedsubcommand: queries CloudFormation for all stack resources viagetRootedResources(), then compares against all resources of a given AWS type (DynamoDB, KMS, Kinesis, CloudWatch Logs, S3) to find orphans. Output as JSON or CSV.cmd/keys.go—apikeyssubcommand: finds IAM access keys filtered by age and usage statuscmd/mocks/— Mockery-generated mocks for AWS service interfaces (CloudformationAPI, DynamoDBAPI, etc.)
AWS service calls are abstracted behind interfaces defined in cmd/orphaned.go to enable testing without credentials.
Bazel builds native binaries for five targets: linux/amd64, linux/arm64, darwin/amd64, darwin/arm64, windows/amd64. Platform targets are defined in the root BUILD.bazel. GoReleaser (.goreleaser.yml) handles release packaging using pre-built binaries from bdist/.
- Uses AWS SDK v1 (
github.com/aws/aws-sdk-go), not v2 - Go modules with vendoring (
vendor/directory is checked in) - Renovate bot manages dependency update PRs; CI auto-commits vendor changes for bot PRs