Conversation
Implements a full-featured CLI with stdin/stdout support and GoReleaser-based release automation with Homebrew tap integration. ## CLI Implementation - Add cmd/configdiff with main.go, root.go, version.go, compare.go - Add internal/cli package: - input.go: File/stdin reading, format detection - output.go: Output formatting (report, compact, json, patch) - options.go: CLI flags to library options mapping - Support all library features via flags - Stdin support with "-" notation - Exit code mode for CI integration - Version command with build info ## CLI Features - File comparison: configdiff old.yaml new.yaml - Stdin input: kubectl get -o yaml | configdiff old.yaml - - Output formats: report (default), compact, json, patch - All diff options: ignore paths, array keys, coercions - Exit code mode: --exit-code returns 1 if diffs found - Quiet mode: -q suppresses output ## Release Automation - Add .goreleaser.yml: - Cross-platform builds (Linux, macOS, Windows on amd64/arm64) - Version info injection via ldflags - Automatic Homebrew formula updates - Archive generation with README, LICENSE - Add .github/workflows/release.yml: - Triggers on version tags (v*) - Runs tests before release - Uses GoReleaser action - Requires HOMEBREW_TAP_GITHUB_TOKEN secret - Update CI workflow to build CLI binary ## Dependencies - github.com/spf13/cobra v1.10.2 - CLI framework - github.com/fatih/color v1.18.0 - Colored output (future use) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add CLI installation section (Homebrew + direct download) - Add CLI quick start examples - Add CLI reference with all flags documented - Add output formats explanation - Add exit codes reference - Reorganize Quick Start into CLI and Library sections Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add internal/cli/input_test.go: File/stdin reading, format detection tests - Add internal/cli/options_test.go: Options parsing and validation tests - Add internal/cli/output_test.go: Output formatting tests - Add cmd/configdiff/main_test.go: Basic integration tests Coverage improved from 68.8% to 83.9%, exceeding 80% threshold. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Code ReviewMissing Test CoverageThis PR adds substantial new CLI code without corresponding test files, which violates the project's CLAUDE.md requirements:
Affected files without tests:
What needs tests:
The existing codebase demonstrates this standard - every other package has comprehensive test coverage. Consider following the project's table-driven test pattern (see |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Expand Use Cases section with concrete examples: - Kubernetes deployment reviews with kubectl integration - GitOps PR validation with exit codes - Infrastructure drift detection with Terraform - Configuration management across environments - CI/CD integration with GitHub Actions examples - Docker Compose migration scenarios Includes practical commands and CI/CD workflow examples. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Code Review - Issue FoundSilent Error Handling Bug in
|
Print error messages to stderr before exiting when errors occur. Previously, errors were silently swallowed due to SilenceErrors: true in Cobra configuration, leaving users with no feedback. Resolves claude-review feedback. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Code reviewI found one issue that needs to be addressed: Missing Package DocumentationFile: The All other packages in the project follow this pattern: Please add a package-level comment before the // Package cli provides command-line interface support for configdiff,
// including input handling, output formatting, and option mapping.
package cliSummary: Checked for bugs and CLAUDE.md compliance. Found 1 issue related to missing documentation. |
Test Coverage - Resolved ✅The missing test coverage issue has been addressed. Added comprehensive test files:
Coverage Results:
All tests follow the project's table-driven test pattern and passed in CI. Commit: db7fcab |
Silent Error Handling Bug - Resolved ✅The silent error handling issue has been fixed. Change made to cmd/configdiff/main.go: func main() {
if err := rootCmd.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err) // ← Error now printed to stderr
os.Exit(1)
}
}Tested: Errors now properly display to users: $ configdiff /nonexistent/file.yaml test.yaml
Error: failed to read file "/nonexistent/file.yaml": open /nonexistent/file.yaml: no such file or directoryCommit: 0e4f164296c1e5f37c5bafa66a0a8e2450d51e68 |
Add missing package-level GoDoc comment to comply with CLAUDE.md documentation requirements. All packages should have package documentation explaining their purpose. Resolves claude-review feedback in PR #8. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds missing package-level GoDoc comment to comply with CLAUDE.md documentation requirements. Resolves claude-review feedback in PR #8.
Missing Package Documentation - Resolved ✅The missing package documentation issue has been addressed in PR #9 and released in v0.1.1. Change made to internal/cli/input.go: // Package cli provides command-line interface support for configdiff,
// including input handling, output formatting, and option mapping between
// CLI flags and library options.
package cliResolution:
The internal/cli package now has the same documentation standard as all other packages in the project (diff, parse, tree, patch, report). |
Summary
Adds a full-featured CLI with stdin/stdout support and GoReleaser-based release automation with Homebrew tap integration.
CLI Implementation
New Packages
cmd/configdiff: CLI entry point with Cobra framework
main.go: Entry point with version vars for ldflagsroot.go: Root command with all flagsversion.go: Version command with build infocompare.go: Main comparison logicinternal/cli: CLI support functions
input.go: File/stdin reading, format auto-detectionoutput.go: Output formatting (report/compact/json/patch)options.go: CLI flags → library options mappingCLI Features
Release Automation
GoReleaser Configuration (
.goreleaser.yml)pfrederiksen/homebrew-tapRelease Workflow (
.github/workflows/release.yml)v*)CI Updates
Dependencies
github.com/spf13/cobrav1.10.2 - Industry standard CLI frameworkgithub.com/fatih/colorv1.18.0 - Colored output supportInstallation (After v0.1.0 Release)
Testing Done
✅ CLI compiles and runs
✅ Basic file comparison works
✅ Stdin support works (
cat file | configdiff - file2)✅ All output formats work (report, compact, json, patch)
✅ Exit code mode works correctly
✅ All flags parse correctly
✅ GoReleaser config validates locally
✅ Homebrew tap token configured
Next Steps
Versioning
First release will be v0.1.0 (pre-1.0 initial release).
Breaking Changes
None - library API unchanged, CLI is a new addition.
🤖 Generated with Claude Code