Skip to content

Conversation

bo0tzz
Copy link

@bo0tzz bo0tzz commented Oct 3, 2025

This adds a new local subcommand that diffs two local chart directories. My intended usecase is mainly for development and CI/CD, to see what effects a change has.

This code was written entirely by an LLM; if that is a dealbreaker, feel free to just close this PR outright.

If there is appetite for it, I'd like to next build on top of this with a git subcommand that diffs two git references against eachother (by checking them out to a temporary folder and then running local against them).

@yxxhero
Copy link
Collaborator

yxxhero commented Oct 10, 2025

@bo0tzz maybe we should add an e2e test?

@yxxhero
Copy link
Collaborator

yxxhero commented Oct 10, 2025

The rest is LGTM. @bo0tzz

@yxxhero yxxhero requested a review from Copilot October 10, 2025 08:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new local subcommand to the helm-diff plugin that allows comparing two local chart directories. The feature enables developers to see differences between chart versions during development and CI/CD workflows by rendering both charts with helm template and showing the resulting manifest differences.

Key changes:

  • Implements a new local subcommand with comprehensive flag support for chart rendering options
  • Adds comprehensive test coverage for argument validation and command execution
  • Updates documentation to include the new subcommand usage and examples

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
cmd/root.go Registers the new localCmd() subcommand in the main command structure
cmd/local.go Complete implementation of the local subcommand with chart rendering and diffing logic
cmd/local_test.go Test suite covering argument validation and basic execution scenarios
README.md Documentation update adding the local subcommand help text and usage examples

func (l *local) run() error {
manifest1, err := l.renderChart(l.chart1)
if err != nil {
return fmt.Errorf("Failed to render chart %s: %w", l.chart1, err)
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error messages should start with lowercase letters to follow Go conventions.

Suggested change
return fmt.Errorf("Failed to render chart %s: %w", l.chart1, err)
return fmt.Errorf("failed to render chart %s: %w", l.chart1, err)

Copilot uses AI. Check for mistakes.


manifest2, err := l.renderChart(l.chart2)
if err != nil {
return fmt.Errorf("Failed to render chart %s: %w", l.chart2, err)
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error messages should start with lowercase letters to follow Go conventions.

Suggested change
return fmt.Errorf("Failed to render chart %s: %w", l.chart2, err)
return fmt.Errorf("failed to render chart %s: %w", l.chart2, err)

Copilot uses AI. Check for mistakes.

args := []string{"template", l.release, chartPath}
args = append(args, flags...)

cmd := exec.Command(os.Getenv("HELM_BIN"), args...)
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using os.Getenv("HELM_BIN") without validation could allow execution of arbitrary commands. Consider validating the HELM_BIN path or providing a default fallback.

Suggested change
cmd := exec.Command(os.Getenv("HELM_BIN"), args...)
helmBin := os.Getenv("HELM_BIN")
if helmBin == "" {
helmBin = "helm"
}
cmd := exec.Command(helmBin, args...)

Copilot uses AI. Check for mistakes.

@bo0tzz
Copy link
Author

bo0tzz commented Oct 10, 2025

@yxxhero I'd be down for e2e tests, but I don't think the project has any yet right? How would you like those to look?

@yxxhero
Copy link
Collaborator

yxxhero commented Oct 11, 2025

@bo0tzz it will be better if we add e2e test. this is a new feature. thanks so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants