Skip to content

feat(cli,api): migrate CLI and REST server to consume aicr.Client #1077

Description

@mchmarny

Summary

Migrate pkg/cli and pkg/api/server.go from constructing recipe.Builder / bundler.Bundler / validator.Validator directly to consuming the github.com/NVIDIA/aicr facade landed in #1072.

Motivation

After #1072 lands the facade, the repository carries three independent wiring paths:

Caller Mechanism Source
CLI recipe.SetDataProvider (process-global, deprecated) pkg/cli/root.go:382, 396 (//nolint:staticcheck // tracked by #983 Stage 2)
REST server recipe.NewBuilder + bundler.New directly pkg/api/server.go:85-91
Facade recipe.WithDataProvider(dp) + per-Client isolation aicr.go:180

Every change to wiring policy (new constructor option, new pre-flight, new lifecycle hook) has to be applied in all three places. Per CLAUDE.md — "business logic lives in functional packages so CLI and API can both use it" — the facade should be the single aggregation point; CLI and REST become thin presentation layers over aicr.Client.

CLI is also still on the deprecated global-state path; migrating onto aicr.Client retires it.

Acceptance

  • pkg/cli/root.go no longer calls recipe.SetDataProvider; bootstraps an aicr.Client per command invocation.
  • pkg/api/server.go constructs aicr.Client instances (one per recipe-source configuration), not recipe.Builder / bundler.Bundler directly.
  • All existing CLI flags and REST endpoints behave identically (chainsaw e2e + make qualify clean).
  • If the facade lacks a knob the CLI/REST need, extend the facade rather than reaching past it; document any such extensions.

Out of scope

Related

Metadata

Metadata

Assignees

Fields

No fields configured for Enhancement.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions