Skip to content

feat(compose): add compose lint command#2124

Draft
simple-agent-manager[bot] wants to merge 3 commits into
mainfrom
feat/compose-lint
Draft

feat(compose): add compose lint command#2124
simple-agent-manager[bot] wants to merge 3 commits into
mainfrom
feat/compose-lint

Conversation

@simple-agent-manager
Copy link
Copy Markdown
Contributor

Summary

  • add unauthenticated defang compose lint command for offline Compose validation
  • enrich Compose validation and fixup warnings with remediation hints
  • update warning golden files and add lint command tests

Tests

  • /usr/local/go/bin/go test -short ./pkg/cli/compose/...
  • /usr/local/go/bin/go test -short ./cmd/cli/command
  • PATH=/tmp/gobin:/usr/local/go/bin:$PATH make test GO-VERSION=1.25.5 GO-NO-DEP-GO=1

Review: @raphaeltm

raphaeltm and others added 3 commits May 22, 2026 10:31
…ints

- Remove FixupServices dependency — lint now runs ValidateProject and
  ValidateServiceDockerfiles directly without needing a provider
- Aggregate all validation errors instead of early-returning on first phase
- Remove "suggest 512M" from memory reservation warning — we don't know
  what the user's service needs
- Revert healthcheck warning to original (no curl suggestion — image may
  not have curl)
- Revert golden files that only had memory/healthcheck hint changes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `defang compose lint --fix` to apply safe mechanical fixes and
write the result back to the compose file. Fixes include:
- Port mode assignment (ingress/host based on protocol/image)
- Limits-to-reservations copy
- Restart policy normalization
- Unsupported directive removal (dns, devices, etc.)

This follows the eslint `--fix` pattern: lint validates, --fix
applies deterministic corrections before validating.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant