Skip to content

feat: add validate-config subcommand#1

Open
ivyrhodes wants to merge 4 commits into
bitcomplete:mainfrom
ivyrhodes:ivy/kpl-19-validate-config
Open

feat: add validate-config subcommand#1
ivyrhodes wants to merge 4 commits into
bitcomplete:mainfrom
ivyrhodes:ivy/kpl-19-validate-config

Conversation

@ivyrhodes

Copy link
Copy Markdown

Summary

New CLI command: kploy validate-config — parses + validates a local kploy.yaml file and prints the hostnames it would render. Project owners can sanity-check their config locally before pushing.

Backed by bitcomplete/kployconfig. Tracks internal ticket KPL-19.

Usage

$ kploy validate-config --file kploy.yaml
OK

Sample hostnames:
ENV          HOSTNAME
prod         myapp.bitcomplete.dev
development  myapp-development.bitcomplete.dev

Example preview env (PR #1):
HOSTNAME                       SERVICE  PORT
myapp-pr-1.bitcomplete.dev     app      3000
myapp-pr-1-ws.bitcomplete.dev  socket   1999

The "Example preview env" section is only printed when preview envs are enabled in the file.

Errors propagate via cobra with a structured field path:

$ kploy validate-config --file bad.yaml
Error: project: must match ^[a-z][a-z0-9-]{2,12}$ (got "BadName")

--output json also supported, consistent with other commands.

What's in this PR

  • cmd/validate_config.go — new command (~100 lines).
  • cmd/root.go — register the command.
  • README.md — new "Validating kploy.yaml" section.
  • go.mod / go.sum — adds github.com/bitcomplete/kployconfig v0.1.1.

Test plan

  • go build ./...
  • go vet ./... / gofmt -l .
  • Smoke: valid file with preview → text output renders cleanly
  • Smoke: valid file without preview → no "Example preview env" section
  • Smoke: --output json → consistent lowerCamelCase JSON
  • Smoke: missing file → useful error message
  • Smoke: invalid config → validation errors with field paths

ivyrhodes and others added 4 commits June 11, 2026 11:04
Validates a local kploy.yaml file via the new
github.com/bitcomplete/kployconfig module. Prints OK + sample rendered
hostnames for prod/development/pr-1, plus the preview ingress hostnames
for PR bitcomplete#1 when preview envs are enabled. JSON output supported via the
existing --output flag.

Companion to bitcomplete/kploy#105 (the
library shipped) + https://github.com/bitcomplete/kployconfig (the
module's new public home).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Restructure the text-mode output so the "example PR preview" framing
is explicit:
- Drop the synthetic pr-1 row from the Sample hostnames table.
- Rename the ingress section header to "Example preview env (PR bitcomplete#1)"
  so the hypothetical-PR framing is unambiguous.
- Only print the example-preview section when preview envs are
  actually enabled — projects without preview just see prod +
  development.

Also adds a README section under Authenticate so the command is
discoverable from public-facing docs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`go get` left the previous version's checksums behind when bumping
to v0.1.1; CI catches it via `go mod tidy && git diff --exit-code`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
errcheck flags unchecked return values on new code; existing CLI
commands using the same pattern are exempted via the lint config's
only-new-issues setting. Match the convention by writing the discard
explicitly.

Co-Authored-By: Claude Opus 4.7 (1M context) <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