Skip to content

feat: Add validate command - #307

Open
eberle1080 wants to merge 4 commits into
mainfrom
feat/validate-command
Open

feat: Add validate command#307
eberle1080 wants to merge 4 commits into
mainfrom
feat/validate-command

Conversation

@eberle1080

@eberle1080 eberle1080 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What

Adds amp validate [ampYamlSourcePath] — validates an amp.yaml manifest without deploying it.

The path argument can be a directory containing amp.yaml/amp.yml or a path to the manifest file itself; it defaults to the current directory.

amp validate                    # validate ./amp.yaml
amp validate path/to/dir        # validate dir/amp.yaml
amp validate path/to/foo.yaml   # validate an explicitly named file
amp validate --project my-proj  # also check destinations & provider apps against the project

Flags:

  • --strict — treat warnings as errors
  • --skip-provider — skip provider-specific validation
  • --skip-async — skip async error-prevention validation

Exits non-zero when validation fails, so it can gate CI. Output lists each error/warning with its rule, YAML path, line/column, and a suggestion when available.

How

Validation logic lives in the new amp-labs/amp-yaml-validator library (shared so the same rules can run client-side and server-side). The CLI supplies it with live data through the library's dependency-injection hooks:

  • validate/catalog.go — a catalog.CatalogProvider backed by the live ("dynamic") provider catalog fetched from the public /v1/providers endpoint, so provider/module/capability checks stay current instead of relying on the catalog compiled into the connectors library. Fetched once per run and served from that snapshot.
  • validate/checkers.goDestinationChecker / ProviderAppChecker verify that destinations and provider apps referenced by the manifest actually exist in the project, backed by one-time snapshots from ListDestinations / ListProviderApps.
  • request/api.go — new FetchProviderCatalog for the catalog endpoint (public, unauthenticated, not project-scoped; honors AMP_API_URL).
  • files/zip.go — new FindManifestFile helper: explicit file paths are used as-is, directories are searched for the conventional manifest names.

Graceful degradation

The command never requires network or a project to be useful:

  • No --project configured → destination and provider-app checks are skipped (the validator emits reminder warnings instead of hard errors).
  • Catalog fetch fails (e.g. offline) → falls back to the catalog embedded in the connectors library.
  • Destination/provider-app fetch fails → that checker is skipped (debug-logged), schema validation still runs.

Dependencies

Adds amp-labs/amp-yaml-validator and amp-labs/connectors (plus their transitive tree — AWS SDK v2, OpenTelemetry, etc. — all indirect).

Screenshots

Example of valid YAML:
Screenshot 2026-07-27 at 10 38 17 AM

Example of invalid YAML:
Screenshot 2026-07-27 at 10 41 40 AM

Screenshot 2026-07-27 at 10 42 21 AM

🤖 Generated with Claude Code

@eberle1080
eberle1080 force-pushed the feat/validate-command branch 2 times, most recently from 71d0bce to 4b6d6a4 Compare July 23, 2026 18:03
@eberle1080
eberle1080 changed the base branch from main to fix/build-and-lint July 23, 2026 18:03
Base automatically changed from fix/build-and-lint to main July 23, 2026 18:20
amp validate checks an amp.yaml manifest without deploying it: schema
and best-practice checks via amp-yaml-validator, backed by the live
provider catalog and, when a project is configured, API-backed
destination and provider-app checkers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@eberle1080
eberle1080 force-pushed the feat/validate-command branch from 4b6d6a4 to 4da9af0 Compare July 23, 2026 18:31
@eberle1080
eberle1080 requested a review from laurenzlong July 23, 2026 18:36
@eberle1080 eberle1080 changed the title Add validate command feat: Add validate command Jul 23, 2026

@laurenzlong laurenzlong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For all CLI PRs, please attach screenshot showing the command in action.

@eberle1080

Copy link
Copy Markdown
Contributor Author

For all CLI PRs, please attach screenshot showing the command in action.

Attached

eberle1080 and others added 2 commits July 27, 2026 11:16
connectors uses Git LFS; proxy.golang.org serves LFS pointer files,
which fails go.sum verification against the real content hash.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Default setup can't set GOPRIVATE or install git-lfs, so its Go
autobuild fails module verification. Same languages and schedule,
Go built manually.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@eberle1080
eberle1080 requested a review from laurenzlong July 27, 2026 18:24
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