Skip to content

Conversation

@lionello
Copy link
Member

@lionello lionello commented Dec 21, 2025

Description

No functional changes, just merging cluster package with cli/client and renaming the imports.

Checklist

  • I have performed a self-review of my code
  • I have added appropriate tests
  • I have updated the Defang CLI docs and/or README to reflect my changes, if necessary

Summary by CodeRabbit

  • Refactor
    • Unified and simplified internal package references across the CLI, agent, login, and tooling codepaths to improve consistency and maintainability.
    • Updated interfaces and tool integrations to use the consolidated client surface; no user-facing behavior changes expected.
    • Tests and logging updated to match the new structure while preserving existing functionality.

✏️ Tip: You can customize this high-level summary in your review settings.

This ensures we can see debug messages during CLI startup.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 21, 2025

Walkthrough

This PR removes the cliClient import alias and replaces it with direct client imports across the codebase, and standardizes parameter names (e.g., clientfabric, fabriccluster) while updating many function signatures and type references without changing runtime behavior.

Changes

Cohort / File(s) Summary
CLI command refactoring
src/cmd/cli/command/cd.go, src/cmd/cli/command/commands.go, src/cmd/cli/command/commands_test.go, src/cmd/cli/command/compose.go, src/cmd/cli/command/compose_test.go, src/cmd/cli/command/estimate.go, src/cmd/cli/command/globals.go, src/cmd/cli/command/globals_test.go, src/cmd/cli/command/mcp.go, src/cmd/cli/command/stack_test.go, src/cmd/cli/command/workspace.go
Removed cliClient alias; replaced with direct client imports. Updated many function signatures, types and call sites from cliClient.* to client.* (Loader, Provider, ProviderID, AccountInfo, LoadProjectNameWithFallback, PrettyError, etc.) and adjusted parameter naming where applicable.
Agent/tools refactoring
src/pkg/agent/agent.go, src/pkg/agent/tools/create_aws_stack.go, src/pkg/agent/tools/create_gcp_stack.go, src/pkg/agent/tools/default_tool_cli.go, src/pkg/agent/tools/deploy.go, src/pkg/agent/tools/deploy_test.go, src/pkg/agent/tools/destroy.go, src/pkg/agent/tools/estimate.go, src/pkg/agent/tools/interfaces.go, src/pkg/agent/tools/listConfig.go, src/pkg/agent/tools/logs.go, src/pkg/agent/tools/provider.go, src/pkg/agent/tools/removeConfig.go, src/pkg/agent/tools/services.go, src/pkg/agent/tools/services_test.go, src/pkg/agent/tools/setConfig.go
Replaced alias imports with direct client package. Updated public and interface signatures to use client.ProjectLoader, client.Provider, client.ProviderID, client.FabricClient and standardized parameter names (notably fabric for gRPC client). Adjusted related types and small logging/error messages.
CLI core refactoring
src/pkg/cli/client/cluster.go, src/pkg/cli/client/cluster_test.go, src/pkg/cli/composeUp.go, src/pkg/cli/configList_test.go, src/pkg/cli/connect.go, src/pkg/cli/destroy_test.go, src/pkg/cli/getServices_test.go, src/pkg/cli/preview.go, src/pkg/cli/tail.go, src/pkg/cli/whoami_test.go
Removed cliClient alias; migrated signatures and internal calls to client.* types (Provider, FabricClient). Moved token/host helpers to use client APIs (GetExistingToken, NormalizeHost, GetWebIdentityTokenFile). Updated tests and package declaration in cluster test.
Login and authentication refactoring
src/pkg/login/login.go, src/pkg/login/login_test.go
Standardized parameter shapes: fabric becomes client.FabricClient, cluster becomes string. Replaced cluster package calls with client equivalents (NormalizeHost, SaveAccessToken, GetWebIdentityTokenFile) and updated related call sites and tests.
MCP, stacks and tracking
src/pkg/mcp/mcp_server.go, src/pkg/mcp/setup_test.go, src/pkg/stacks/stacks_test.go, src/pkg/stacks/wizard.go, src/pkg/stacks/wizard_test.go, src/pkg/track/track.go
Replaced cliClient alias usage with direct client imports. Updated provider ID/constant references (cliClient.ProviderIDclient.ProviderID, ProviderAWS/GCP/DO/etc.), public type alias in track.go now references client.Property. Minor test control-flow tweak in setup_test.go.
Other misc updates
src/pkg/cli/preview.go, src/pkg/cli/tail.go, various tests across repo
Numerous remaining import alias removals and corresponding symbol updates from cliClient to client, plus minor logging/string updates and parameter renames in mocks/tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas to focus:
    • Public interface and method signature changes (e.g., src/pkg/agent/tools/interfaces.go, src/pkg/agent/tools/default_tool_cli.go) — ensure all implementations and call sites were updated.
    • Login/token flows and host normalization changes (src/pkg/login/*, src/pkg/cli/client/cluster.go) — verify token file paths and SaveAccessToken/GetWebIdentityTokenFile usage.
    • Tests and mocks where parameter names changed (client → fabric) to ensure no subtle test breakages.
    • Any remaining references to the old alias or mismatched parameter ordering.

Suggested reviewers

  • jordanstephens

Poem

🐰 Hopping through imports, neat and bright,
I swapped aliases by moonlit night.
Client now stands where cliClient stood,
Names aligned and working good.
A little hop — the code feels light!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.39% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Rename packages' accurately describes the main objective of the changeset—consolidating the cluster package into cli/client and updating all import paths throughout the codebase.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch lio/rename-packages

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.5.0)

level=warning msg="[linters_context] running gomodguard failed: unable to read module file go.mod: current working directory must have a go.mod file: if you are not using go modules it is suggested to disable this linter"
level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/pkg/login/login.go (1)

22-24: Critical: Interface signature doesn't match implementation.

The AuthService interface at line 23 declares:

login(ctx context.Context, client client.FabricClient, fabric string, flow LoginFlow, mcpClient string)

But the OpenAuthService implementation at line 28 declares:

login(ctx context.Context, fabric client.FabricClient, cluster string, flow LoginFlow, mcpClient string)

The parameter names differ:

  • FabricClient parameter: client (interface) vs fabric (implementation)
  • string parameter: fabric (interface) vs cluster (implementation)

The interface definition needs to be updated to match the implementation.

🔎 Proposed fix
 type AuthService interface {
-	login(ctx context.Context, client client.FabricClient, fabric string, flow LoginFlow, mcpClient string) (string, error)
+	login(ctx context.Context, fabric client.FabricClient, cluster string, flow LoginFlow, mcpClient string) (string, error)
 }
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6a1b61 and 59ddb68.

📒 Files selected for processing (45)
  • src/cmd/cli/command/cd.go (2 hunks)
  • src/cmd/cli/command/commands.go (21 hunks)
  • src/cmd/cli/command/commands_test.go (5 hunks)
  • src/cmd/cli/command/compose.go (11 hunks)
  • src/cmd/cli/command/compose_test.go (2 hunks)
  • src/cmd/cli/command/estimate.go (2 hunks)
  • src/cmd/cli/command/globals.go (3 hunks)
  • src/cmd/cli/command/globals_test.go (7 hunks)
  • src/cmd/cli/command/mcp.go (2 hunks)
  • src/cmd/cli/command/stack_test.go (4 hunks)
  • src/cmd/cli/command/workspace.go (2 hunks)
  • src/pkg/agent/agent.go (2 hunks)
  • src/pkg/agent/tools/create_aws_stack.go (2 hunks)
  • src/pkg/agent/tools/create_gcp_stack.go (2 hunks)
  • src/pkg/agent/tools/default_tool_cli.go (3 hunks)
  • src/pkg/agent/tools/deploy.go (1 hunks)
  • src/pkg/agent/tools/deploy_test.go (2 hunks)
  • src/pkg/agent/tools/destroy.go (3 hunks)
  • src/pkg/agent/tools/estimate.go (4 hunks)
  • src/pkg/agent/tools/interfaces.go (1 hunks)
  • src/pkg/agent/tools/listConfig.go (3 hunks)
  • src/pkg/agent/tools/logs.go (2 hunks)
  • src/pkg/agent/tools/provider.go (3 hunks)
  • src/pkg/agent/tools/removeConfig.go (3 hunks)
  • src/pkg/agent/tools/services.go (3 hunks)
  • src/pkg/agent/tools/services_test.go (3 hunks)
  • src/pkg/agent/tools/setConfig.go (3 hunks)
  • src/pkg/cli/client/cluster.go (3 hunks)
  • src/pkg/cli/client/cluster_test.go (1 hunks)
  • src/pkg/cli/composeUp.go (1 hunks)
  • src/pkg/cli/configList_test.go (2 hunks)
  • src/pkg/cli/connect.go (1 hunks)
  • src/pkg/cli/destroy_test.go (2 hunks)
  • src/pkg/cli/getServices_test.go (2 hunks)
  • src/pkg/cli/preview.go (1 hunks)
  • src/pkg/cli/tail.go (1 hunks)
  • src/pkg/cli/whoami_test.go (3 hunks)
  • src/pkg/login/login.go (3 hunks)
  • src/pkg/login/login_test.go (3 hunks)
  • src/pkg/mcp/mcp_server.go (3 hunks)
  • src/pkg/mcp/setup_test.go (0 hunks)
  • src/pkg/stacks/stacks_test.go (14 hunks)
  • src/pkg/stacks/wizard.go (5 hunks)
  • src/pkg/stacks/wizard_test.go (26 hunks)
  • src/pkg/track/track.go (1 hunks)
💤 Files with no reviewable changes (1)
  • src/pkg/mcp/setup_test.go
🧰 Additional context used
🧬 Code graph analysis (42)
src/pkg/track/track.go (1)
src/pkg/utils.go (1)
  • GetenvBool (56-59)
src/pkg/cli/composeUp.go (2)
src/pkg/cli/client/client.go (1)
  • FabricClient (17-44)
src/pkg/cli/client/provider.go (1)
  • Provider (43-69)
src/pkg/agent/tools/deploy.go (2)
src/pkg/cli/client/client.go (1)
  • ProjectLoader (12-15)
src/pkg/agent/tools/interfaces.go (1)
  • CLIInterface (14-32)
src/pkg/login/login_test.go (1)
src/pkg/cli/client/cluster.go (2)
  • GetExistingToken (44-69)
  • GetTokenFile (40-42)
src/cmd/cli/command/stack_test.go (2)
src/pkg/cli/client/provider_id.go (2)
  • ProviderAWS (15-15)
  • ProviderGCP (17-17)
src/pkg/modes/modes.go (2)
  • Mode (12-12)
  • ModeAffordable (16-16)
src/cmd/cli/command/mcp.go (1)
src/pkg/cli/client/state.go (1)
  • StateDir (15-15)
src/pkg/cli/destroy_test.go (2)
src/pkg/cli/client/playground.go (1)
  • PlaygroundProvider (17-21)
src/pkg/cli/client/client.go (1)
  • FabricClient (17-44)
src/pkg/stacks/wizard_test.go (2)
src/pkg/cli/client/provider_id.go (4)
  • ProviderAWS (15-15)
  • ProviderGCP (17-17)
  • ProviderDefang (14-14)
  • ProviderDO (16-16)
src/pkg/stacks/stacks.go (1)
  • StackParameters (17-24)
src/pkg/agent/agent.go (1)
src/pkg/cli/client/cluster.go (2)
  • GetExistingToken (44-69)
  • NormalizeHost (18-26)
src/pkg/agent/tools/create_gcp_stack.go (1)
src/pkg/cli/client/provider_id.go (1)
  • ProviderGCP (17-17)
src/cmd/cli/command/compose_test.go (2)
src/pkg/cli/client/provider_id.go (1)
  • ProviderDefang (14-14)
src/pkg/cli/client/cluster.go (1)
  • DefaultCluster (14-14)
src/pkg/agent/tools/removeConfig.go (2)
src/pkg/cli/client/client.go (1)
  • ProjectLoader (12-15)
src/pkg/agent/tools/interfaces.go (1)
  • CLIInterface (14-32)
src/cmd/cli/command/cd.go (1)
src/pkg/cli/client/projectName.go (1)
  • LoadProjectNameWithFallback (10-26)
src/pkg/agent/tools/create_aws_stack.go (1)
src/pkg/cli/client/provider_id.go (1)
  • ProviderAWS (15-15)
src/pkg/agent/tools/logs.go (1)
src/pkg/cli/client/client.go (1)
  • ProjectLoader (12-15)
src/pkg/stacks/wizard.go (2)
src/pkg/cli/client/provider_id.go (6)
  • ProviderAuto (13-13)
  • AllProviders (30-32)
  • ProviderID (10-10)
  • ProviderDefang (14-14)
  • ProviderAWS (15-15)
  • ProviderGCP (17-17)
src/pkg/cli/client/region.go (1)
  • GetRegion (5-16)
src/cmd/cli/command/workspace.go (1)
src/pkg/cli/client/cluster.go (1)
  • GetExistingToken (44-69)
src/pkg/cli/tail.go (1)
src/pkg/term/colorizer.go (1)
  • Warn (310-312)
src/pkg/agent/tools/services.go (4)
src/pkg/cli/client/client.go (1)
  • ProjectLoader (12-15)
src/pkg/agent/tools/interfaces.go (1)
  • CLIInterface (14-32)
src/pkg/mcp/tools/tools.go (1)
  • StackConfig (14-17)
src/pkg/cli/getServices.go (1)
  • ErrNoServices (17-19)
src/pkg/stacks/stacks_test.go (1)
src/pkg/cli/client/provider_id.go (4)
  • ProviderID (10-10)
  • ProviderAWS (15-15)
  • ProviderGCP (17-17)
  • ProviderDO (16-16)
src/pkg/agent/tools/destroy.go (2)
src/pkg/cli/client/client.go (1)
  • ProjectLoader (12-15)
src/pkg/agent/tools/interfaces.go (1)
  • CLIInterface (14-32)
src/pkg/cli/client/cluster.go (3)
src/pkg/cli/client/state.go (1)
  • StateDir (15-15)
src/pkg/utils.go (1)
  • Getenv (48-53)
src/pkg/term/colorizer.go (1)
  • Debug (294-296)
src/pkg/cli/preview.go (3)
src/pkg/cli/client/client.go (1)
  • FabricClient (17-44)
src/pkg/cli/client/provider.go (1)
  • Provider (43-69)
src/pkg/cli/composeUp.go (1)
  • ComposeUpParams (24-29)
src/pkg/mcp/mcp_server.go (1)
src/pkg/cli/client/provider_id.go (1)
  • ProviderID (10-10)
src/pkg/agent/tools/setConfig.go (2)
src/pkg/cli/client/client.go (1)
  • ProjectLoader (12-15)
src/pkg/agent/tools/interfaces.go (1)
  • CLIInterface (14-32)
src/pkg/agent/tools/estimate.go (5)
src/pkg/cli/client/client.go (1)
  • ProjectLoader (12-15)
src/pkg/agent/tools/interfaces.go (1)
  • CLIInterface (14-32)
src/pkg/cli/connect.go (1)
  • Connect (16-18)
src/pkg/cli/client/provider_id.go (1)
  • ProviderID (10-10)
src/pkg/cli/estimate.go (1)
  • RunEstimate (23-41)
src/pkg/agent/tools/listConfig.go (5)
src/pkg/cli/client/client.go (1)
  • ProjectLoader (12-15)
src/pkg/agent/tools/interfaces.go (1)
  • CLIInterface (14-32)
src/pkg/agent/tools/default_tool_cli.go (1)
  • StackConfig (19-22)
src/pkg/mcp/mcp_server.go (1)
  • StackConfig (46-46)
src/pkg/mcp/tools/tools.go (1)
  • StackConfig (14-17)
src/pkg/cli/getServices_test.go (2)
src/pkg/cli/client/playground.go (1)
  • PlaygroundProvider (17-21)
src/pkg/cli/client/client.go (1)
  • FabricClient (17-44)
src/pkg/cli/configList_test.go (2)
src/pkg/cli/client/playground.go (1)
  • PlaygroundProvider (17-21)
src/pkg/cli/client/client.go (1)
  • FabricClient (17-44)
src/pkg/cli/connect.go (1)
src/pkg/cli/client/cluster.go (2)
  • NormalizeHost (18-26)
  • GetExistingToken (44-69)
src/cmd/cli/command/globals_test.go (3)
src/pkg/stacks/stacks.go (1)
  • StackParameters (17-24)
src/pkg/cli/client/provider_id.go (4)
  • ProviderAuto (13-13)
  • ProviderAWS (15-15)
  • ProviderGCP (17-17)
  • ProviderDefang (14-14)
src/pkg/cli/client/cluster.go (1)
  • DefangFabric (16-16)
src/cmd/cli/command/commands.go (6)
src/pkg/cli/client/cluster.go (1)
  • GetExistingToken (44-69)
src/pkg/cli/client/pretty_error.go (1)
  • PrettyError (12-23)
src/pkg/cli/client/provider.go (2)
  • Provider (43-69)
  • Loader (71-74)
src/pkg/cli/client/provider_id.go (7)
  • AllProviders (30-32)
  • ProviderID (10-10)
  • ProviderDefang (14-14)
  • ProviderAWS (15-15)
  • ProviderDO (16-16)
  • ProviderGCP (17-17)
  • ProviderAuto (13-13)
src/pkg/cli/client/projectName.go (1)
  • LoadProjectNameWithFallback (10-26)
src/pkg/cli/compose/loader.go (1)
  • Loader (38-41)
src/pkg/agent/tools/deploy_test.go (3)
src/pkg/login/login.go (1)
  • InteractiveLoginMCP (47-49)
src/pkg/cli/client/grpc.go (1)
  • GrpcClient (19-26)
src/pkg/cli/client/caniuse.go (1)
  • CanIUseProvider (10-43)
src/cmd/cli/command/compose.go (7)
src/pkg/cli/client/provider.go (1)
  • Provider (43-69)
src/pkg/cli/client/provider_id.go (2)
  • ProviderDefang (14-14)
  • ProviderID (10-10)
src/pkg/cli/client/cluster.go (1)
  • DefaultCluster (14-14)
src/pkg/cli/client/account_info.go (1)
  • AccountInfo (5-10)
src/pkg/cli/client/pretty_error.go (1)
  • PrettyError (12-23)
src/pkg/cli/client/errors.go (1)
  • ErrDeploymentFailed (5-8)
src/pkg/cli/client/projectName.go (1)
  • LoadProjectNameWithFallback (10-26)
src/cmd/cli/command/estimate.go (3)
src/pkg/cli/client/provider_id.go (4)
  • ProviderAuto (13-13)
  • ProviderID (10-10)
  • ProviderAWS (15-15)
  • ProviderGCP (17-17)
src/pkg/cli/client/playground.go (1)
  • PlaygroundProvider (17-21)
src/pkg/cli/client/region.go (1)
  • GetRegion (5-16)
src/pkg/cli/whoami_test.go (5)
src/pkg/cli/client/playground.go (1)
  • PlaygroundProvider (17-21)
src/pkg/cli/whoami.go (2)
  • Whoami (25-59)
  • ShowAccountData (14-23)
src/protos/io/defang/v1/fabric.pb.go (4)
  • Provider (28-28)
  • Provider (66-68)
  • Provider (70-72)
  • Provider (79-81)
src/pkg/cli/client/provider.go (1)
  • Provider (43-69)
src/pkg/cli/client/provider_id.go (1)
  • ProviderDefang (14-14)
src/pkg/agent/tools/services_test.go (2)
src/pkg/cli/client/grpc.go (1)
  • GrpcClient (19-26)
src/pkg/cli/composeUp.go (2)
  • ComposeUp (32-178)
  • ComposeUpParams (24-29)
src/pkg/agent/tools/default_tool_cli.go (5)
src/pkg/cli/client/grpc.go (1)
  • GrpcClient (19-26)
src/pkg/cli/client/provider_id.go (1)
  • ProviderID (10-10)
src/pkg/cli/connect.go (1)
  • NewProvider (61-75)
src/pkg/cli/client/playground.go (1)
  • PlaygroundProvider (17-21)
src/pkg/cli/client/client.go (1)
  • FabricClient (17-44)
src/pkg/agent/tools/interfaces.go (7)
src/pkg/cli/client/caniuse.go (1)
  • CanIUseProvider (10-43)
src/pkg/cli/client/grpc.go (1)
  • GrpcClient (19-26)
src/pkg/cli/connect.go (1)
  • NewProvider (61-75)
src/pkg/cli/getServices.go (1)
  • GetServices (28-42)
src/pkg/cli/client/projectName.go (1)
  • LoadProjectNameWithFallback (10-26)
src/pkg/cli/client/provider_id.go (1)
  • ProviderID (10-10)
src/pkg/modes/modes.go (1)
  • Mode (12-12)
src/cmd/cli/command/commands_test.go (5)
src/pkg/clouds/aws/secrets.go (2)
  • SsmParametersAPI (14-20)
  • SsmClientOverride (22-22)
src/pkg/cli/client/grpc.go (1)
  • GrpcClient (19-26)
src/pkg/cli/client/mock.go (1)
  • MockLoader (162-165)
src/pkg/cli/compose/loader.go (1)
  • Project (25-25)
src/pkg/cli/client/playground.go (1)
  • PlaygroundProvider (17-21)
src/pkg/agent/tools/provider.go (4)
src/pkg/cli/connect.go (1)
  • NewProvider (61-75)
src/pkg/cli/client/provider_id.go (1)
  • ProviderID (10-10)
src/pkg/cli/client/client.go (1)
  • FabricClient (17-44)
src/pkg/stacks/stacks.go (1)
  • StackParameters (17-24)
src/pkg/login/login.go (3)
src/pkg/cli/client/client.go (1)
  • FabricClient (17-44)
src/pkg/cli/client/cluster.go (3)
  • SaveAccessToken (77-85)
  • NormalizeHost (18-26)
  • GetWebIdentityTokenFile (71-75)
src/pkg/login/agree_tos.go (1)
  • NonInteractiveAgreeToS (46-57)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (go)
  • GitHub Check: go-test
🔇 Additional comments (61)
src/pkg/agent/tools/services_test.go (1)

69-69: LGTM: Parameter renaming improves semantic clarity.

The consistent renaming of the client parameter to fabric across all five MockCLI methods accurately reflects that these *client.GrpcClient instances connect to a fabric controller. The naming is now uniform and more descriptive.

Also applies to: 73-73, 85-85, 93-93, 109-109

src/pkg/cli/tail.go (1)

142-142: LGTM!

The TODO comment correctly references client.PrettyError to align with the updated import path, consistent with the package rename refactor.

src/pkg/cli/connect.go (1)

23-24: LGTM!

The calls to client.NormalizeHost and client.GetExistingToken correctly reference the consolidated client package, replacing the previous cluster package usage. The implementations are confirmed to exist in src/pkg/cli/client/cluster.go.

src/pkg/cli/whoami_test.go (1)

10-10: LGTM!

The test correctly updates to the unaliased client import and uses client.PlaygroundProvider and client.ProviderDefang consistently with the package rename refactor.

Also applies to: 42-42, 54-54, 60-60

src/pkg/agent/tools/create_gcp_stack.go (1)

8-8: LGTM!

The import and client.ProviderGCP reference are correctly updated to align with the package rename.

Also applies to: 36-36

src/pkg/agent/tools/deploy_test.go (1)

59-62: LGTM!

Renaming the parameter from client to fabric correctly avoids shadowing the client package import, improving code clarity. This aligns with the naming used in the actual implementations (e.g., login.go uses fabric client.FabricClient).

Also applies to: 80-83

src/pkg/track/track.go (1)

8-8: LGTM! Clean import alias migration.

The import alias has been successfully removed and the type alias has been updated to reflect the direct client package import. This change aligns with the PR's objective to standardize on direct imports.

Also applies to: 16-16

src/pkg/cli/client/cluster.go (2)

1-1: LGTM! Package merge executed correctly.

The package declaration has been updated from cluster to client, successfully merging the cluster functionality into the cli/client package as described in the PR objectives.


28-41: LGTM! Consistent parameter renaming throughout.

The parameter renaming from fabric to cluster has been applied consistently across all functions (tokenStorageName, GetTokenFile, GetExistingToken, GetWebIdentityTokenFile, SaveAccessToken). This improves semantic clarity and aligns with the package's purpose.

Also applies to: 44-80

src/pkg/cli/client/cluster_test.go (1)

1-1: LGTM! Test package updated to match production code.

The test package declaration correctly reflects the package merge from cluster to client.

src/pkg/agent/tools/default_tool_cli.go (2)

10-10: LGTM! Import alias successfully removed.

The import has been updated from the aliased cliClient to the direct client package, consistent with the PR-wide migration.


30-116: LGTM! All type references consistently updated.

All function signatures have been systematically updated to use the direct client package types (client.GrpcClient, client.Provider, client.ProviderID, client.Loader, client.FabricClient, client.PlaygroundProvider). The migration is complete and consistent throughout the file.

src/cmd/cli/command/mcp.go (1)

9-9: LGTM! Import and reference updated consistently.

The import alias has been removed and the StateDir reference has been correctly updated to use the direct client package.

Also applies to: 40-40

src/cmd/cli/command/cd.go (1)

8-8: LGTM! Import and function call updated correctly.

The import alias has been removed and the LoadProjectNameWithFallback function call has been updated to use the direct client package reference.

Also applies to: 45-45

src/pkg/login/login_test.go (1)

22-22: LGTM! Test updated to reflect package merge.

All function calls have been correctly updated from cluster.GetExistingToken and cluster.GetTokenFile to client.GetExistingToken and client.GetTokenFile, reflecting the merge of the cluster package into the client package. Test logic remains unchanged.

Also applies to: 30-30, 37-37, 66-66, 125-125

src/pkg/cli/configList_test.go (1)

9-9: LGTM! Test updated with direct client package usage.

The import alias has been removed and the PlaygroundProvider type reference has been correctly updated to use the direct client package.

Also applies to: 54-54

src/cmd/cli/command/stack_test.go (1)

7-7: LGTM! Import alias removal completed correctly.

The import path has been updated from an alias to direct package reference, and all provider constant usages are updated consistently throughout the test file.

Also applies to: 45-45, 51-51, 92-92, 102-102

src/pkg/agent/tools/create_aws_stack.go (1)

8-8: LGTM! Package refactoring applied correctly.

Import path updated to direct client package reference and provider constant usage updated accordingly.

Also applies to: 36-36

src/cmd/cli/command/workspace.go (1)

10-10: LGTM! Cluster package merge reflected correctly.

The token retrieval logic now uses client.GetExistingToken instead of cluster.GetExistingToken, reflecting the merge of the cluster package into cli/client. Functionality remains unchanged.

Also applies to: 19-19

src/cmd/cli/command/compose_test.go (1)

8-8: LGTM! Test updated for package refactoring.

Import alias removed and both provider and cluster constants now reference the unified client package. Test behavior remains unchanged.

Also applies to: 33-34

src/pkg/agent/agent.go (1)

17-17: LGTM! Agent updated for cluster package merge.

Token retrieval and host normalization now use the client package, reflecting the merge of cluster functionality into cli/client. Agent behavior remains unchanged.

Also applies to: 37-37, 40-40

src/pkg/stacks/wizard_test.go (1)

9-9: LGTM! Comprehensive test suite updated consistently.

Import alias removed and all provider constant references updated throughout the extensive test cases. Test coverage and behavior remain unchanged.

Also applies to: 126-126, 152-152, 180-180, 206-206, 228-228, 248-248, 483-483, 492-492, 504-504, 513-513, 525-525, 534-534, 549-549, 558-558, 573-573, 592-592, 610-610, 618-618, 630-630, 639-639, 649-649, 658-658, 668-668, 677-677, 685-685, 704-704, 724-724

src/cmd/cli/command/globals_test.go (1)

9-9: LGTM! Configuration tests updated for package refactoring.

Import alias removed and all provider/cluster constant references updated to use the unified client package. Test logic and configuration precedence validation remain unchanged.

Also applies to: 53-53, 118-118, 166-166, 202-202, 370-370, 440-440

src/pkg/agent/tools/deploy.go (1)

12-12: LGTM! Function signature updated for package refactoring.

The ProjectLoader type reference updated to use the direct client package import. Deployment logic remains unchanged.

Also applies to: 24-24

src/pkg/cli/getServices_test.go (1)

11-11: LGTM! Clean import refactoring.

The import alias removal and type reference updates are correct and consistent with the PR's package consolidation objectives.

Also applies to: 71-71

src/pkg/agent/tools/removeConfig.go (1)

8-8: LGTM! Function signature correctly updated.

The import change and type reference updates align with the package refactoring. The function maintains identical behavior with the new client.ProjectLoader type.

Also applies to: 21-21, 34-34

src/pkg/mcp/mcp_server.go (1)

9-9: LGTM! Type references correctly updated.

The import change and ProviderID type reference update maintain functionality while aligning with the package consolidation. The added comment enhances code documentation.

Also applies to: 25-25, 48-48

src/pkg/cli/composeUp.go (1)

32-32: LGTM! Function signature properly updated.

The parameter type change from aliased to direct client.Provider reference is correct and maintains the same functionality.

src/pkg/stacks/stacks_test.go (1)

8-8: LGTM! Comprehensive test update.

All type references and provider constants are correctly updated throughout the test suite. The changes maintain test functionality while using the new package import path.

Also applies to: 15-22, 48-60, 69-70, 118-120, 205-240, 267-279, 309-310, 340-342, 365-367

src/cmd/cli/command/globals.go (1)

9-10: LGTM! Global configuration correctly updated.

The Client field type and initialization logic properly reference the consolidated client package. All default values are correctly updated to use the new package paths.

Also applies to: 71-71, 93-94, 98-98

src/pkg/stacks/wizard.go (1)

11-11: LGTM! Wizard logic correctly refactored.

All provider-related type references, constants, and function calls are properly updated to use the client package. The wizard's functionality remains unchanged while using the consolidated package structure.

Also applies to: 39-60, 62-71, 84-108, 109-124

src/pkg/agent/tools/logs.go (1)

10-10: LGTM! Function signature correctly updated.

The import change and loader parameter type update maintain the same functionality while using the consolidated client package.

Also applies to: 25-25

src/pkg/agent/tools/destroy.go (1)

9-9: LGTM! Clean import alias migration.

The refactoring from cliClient to direct client import is consistent and correct. The type references and debug messages have been properly updated to reflect the new package structure.

Also applies to: 20-20, 33-33

src/cmd/cli/command/estimate.go (1)

7-7: LGTM! Consistent type reference updates.

All provider-related constants and types have been correctly migrated from cliClient.* to client.*. The changes align perfectly with the package rename objectives.

Also applies to: 29-39, 46-46

src/pkg/cli/destroy_test.go (1)

9-9: LGTM! Test updated correctly.

The test has been properly updated to use the new client.PlaygroundProvider type. The test logic remains unchanged, maintaining test coverage.

Also applies to: 57-57

src/pkg/agent/tools/setConfig.go (1)

9-9: LGTM! Refactoring applied consistently.

The import and type reference updates match the pattern used across the codebase. The debug message accurately reflects the new package structure.

Also applies to: 21-21, 36-36

src/pkg/cli/preview.go (1)

6-6: LGTM! Function signature updated correctly.

The Preview function signature has been properly updated to use client.FabricClient and client.Provider types, maintaining consistency with the package rename.

Also applies to: 11-11

src/pkg/agent/tools/listConfig.go (1)

9-9: LGTM! Consistent refactoring applied.

The changes follow the established pattern: import alias removal, type reference update, and debug message adjustment. All updates are correct.

Also applies to: 20-20, 33-33

src/pkg/agent/tools/services.go (1)

11-12: LGTM! Import aliases reorganized correctly.

The refactoring introduces a new cliTypes alias for CLI error types while removing the old cliClient alias. All type references have been updated consistently.

Also applies to: 23-23, 47-47

src/cmd/cli/command/commands_test.go (1)

14-14: LGTM! Test imports and types migrated correctly.

The test file has been comprehensively updated with both the client package migration and the AWS driver package rename from pkg to awsdriver. All type instantiations and assertions have been correctly updated.

Also applies to: 18-18, 33-33, 203-203, 263-269, 294-295

src/pkg/agent/tools/estimate.go (4)

8-8: LGTM - Import alias removed.

The removal of the cliClient import alias aligns with the PR objective to standardize on direct client package imports.


20-20: LGTM - Function signature updated.

The parameter type correctly updated from cliClient.ProjectLoader to client.ProjectLoader, consistent with the package rename.


29-49: LGTM - Variable renamed for clarity.

The variable rename from client to fabric improves code readability by avoiding confusion between the package name and the gRPC client instance. All usages are consistently updated.


36-36: LGTM - Type reference updated.

The ProviderID type reference correctly updated to use the client package.

src/pkg/agent/tools/provider.go (2)

8-8: LGTM - Import alias removed.

Consistent with the package rename refactoring across the codebase.


17-54: LGTM - Type references updated throughout.

All type references correctly updated from cliClient.* to client.*:

  • ProviderCreator interface method signature
  • providerPreparer struct field
  • Constructor and method signatures
  • Variable declarations

The changes are mechanical and consistent with the package migration.

src/cmd/cli/command/compose.go (5)

15-15: LGTM - Import alias removed.

Consistent with the standardization on direct client package imports.


37-37: LGTM - Constant references updated.

References to client.ProviderDefang and client.DefaultCluster correctly updated to reflect the new package structure.


222-256: LGTM - Function signatures and type references updated.

The handleExistingDeployments and printExistingDeployments functions correctly updated to use *client.AccountInfo and client.ProviderID types.


300-332: LGTM - Error handling updated.

Error types and utility functions correctly migrated:

  • client.Provider parameter type
  • client.PrettyError() calls
  • client.ErrDeploymentFailed error type

444-722: LGTM - Helper function calls updated.

All calls to client.LoadProjectNameWithFallback correctly updated to use the client package directly.

src/pkg/login/login.go (2)

28-77: LGTM - Login implementation updated correctly.

The login method implementation and all public login functions (InteractiveLogin, InteractiveLoginMCP, interactiveLogin) have been correctly updated to:

  • Use fabric client.FabricClient parameter for the gRPC client
  • Use cluster string parameter for the cluster address
  • Call client.SaveAccessToken, client.NormalizeHost, and NonInteractiveAgreeToS with correct parameters

79-114: LGTM - Non-interactive login updated correctly.

The NonInteractiveGitHubLogin function properly updated to:

  • Accept fabric client.FabricClient and cluster string parameters
  • Use fabric.Token() for token retrieval
  • Call client.SaveAccessToken() and client.GetWebIdentityTokenFile() with the cluster parameter
src/cmd/cli/command/commands.go (6)

21-21: LGTM - Import alias removed.

The cliClient import alias has been removed in favor of direct client package usage.


60-77: LGTM - Helper function calls updated.

Calls to client.GetExistingToken() and client.PrettyError() correctly reference the client package.


188-195: LGTM - Provider enumeration updated.

The client.AllProviders() function calls correctly use the client package for provider listing functionality.


799-1058: LGTM - Command implementations updated.

All command implementations correctly updated to use:

  • client.LoadProjectNameWithFallback()
  • client.PrettyError()
  • client.ProviderID type

The changes are consistent across multiple commands (config set, config delete, config list, delete).


1220-1233: LGTM - Type usage in loader configuration.

The ProviderID type correctly referenced as client.ProviderID in the configureLoader function.


1276-1431: LGTM - Provider selection logic updated.

All provider-related code correctly migrated:

  • providerDescription map uses client.ProviderID keys
  • Provider constants (client.ProviderDefang, client.ProviderAWS, etc.)
  • Function signatures use client.Loader and client.Provider
  • client.AllProviders() and client.CanIUseProvider() calls
  • interactiveSelectProvider parameter types

The refactoring is comprehensive and consistent.

src/pkg/agent/tools/interfaces.go (2)

8-8: LGTM - Import alias removed.

Consistent with the package rename across the codebase.


14-32: LGTM - Interface signatures updated.

All CLIInterface method signatures correctly updated to use client.* types:

  • *client.GrpcClient for fabric parameters
  • client.Provider for provider parameters
  • client.Loader for loader parameters
  • client.ProviderID for provider ID parameters
  • client.FabricClient for fabric client interface parameters

The changes are comprehensive and maintain consistency across all interface methods.

@lionello lionello force-pushed the lio/rename-packages branch from 59ddb68 to b81874d Compare December 21, 2025 05:29
@lionello lionello enabled auto-merge (squash) December 21, 2025 05:30
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/pkg/agent/tools/removeConfig.go (1)

21-26: Rename local variable to avoid shadowing the imported package.

The function signature update is correct, but the local variable client on line 23 shadows the imported client package from line 8. While this doesn't cause immediate issues, it reduces code clarity and prevents referencing types from the client package later in the function body.

🔎 Suggested fix
 func HandleRemoveConfigTool(ctx context.Context, loader client.ProjectLoader, params RemoveConfigParams, cli CLIInterface, ec elicitations.Controller, sc StackConfig) (string, error) {
 	term.Debug("Function invoked: cli.Connect")
-	client, err := cli.Connect(ctx, sc.Cluster)
+	fabric, err := cli.Connect(ctx, sc.Cluster)
 	if err != nil {
 		return "", fmt.Errorf("Could not connect: %w", err)
 	}
 
 	sm := stacks.NewManager(params.WorkingDirectory)
-	pp := NewProviderPreparer(cli, ec, client, sm)
+	pp := NewProviderPreparer(cli, ec, fabric, sm)
src/pkg/mcp/mcp_server.go (1)

24-28: Consider renaming the struct field to avoid naming collision.

The ToolTracker struct has a field named client (line 27), which is the same identifier as the imported package client (line 9). While this compiles correctly because the contexts differ (struct field vs. package identifier), it can cause confusion when reading the code.

Consider renaming the struct field to something like mcpClient or clientName to improve clarity.

🔎 Proposed refactor
 type ToolTracker struct {
 	providerId *client.ProviderID
 	cluster    string
-	client     string
+	mcpClient  string
 }

Then update the references accordingly in the file.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 59ddb68 and 008ef09.

📒 Files selected for processing (45)
  • src/cmd/cli/command/cd.go (2 hunks)
  • src/cmd/cli/command/commands.go (21 hunks)
  • src/cmd/cli/command/commands_test.go (5 hunks)
  • src/cmd/cli/command/compose.go (11 hunks)
  • src/cmd/cli/command/compose_test.go (2 hunks)
  • src/cmd/cli/command/estimate.go (2 hunks)
  • src/cmd/cli/command/globals.go (3 hunks)
  • src/cmd/cli/command/globals_test.go (7 hunks)
  • src/cmd/cli/command/mcp.go (2 hunks)
  • src/cmd/cli/command/stack_test.go (4 hunks)
  • src/cmd/cli/command/workspace.go (2 hunks)
  • src/pkg/agent/agent.go (2 hunks)
  • src/pkg/agent/tools/create_aws_stack.go (2 hunks)
  • src/pkg/agent/tools/create_gcp_stack.go (2 hunks)
  • src/pkg/agent/tools/default_tool_cli.go (3 hunks)
  • src/pkg/agent/tools/deploy.go (1 hunks)
  • src/pkg/agent/tools/deploy_test.go (2 hunks)
  • src/pkg/agent/tools/destroy.go (3 hunks)
  • src/pkg/agent/tools/estimate.go (4 hunks)
  • src/pkg/agent/tools/interfaces.go (1 hunks)
  • src/pkg/agent/tools/listConfig.go (3 hunks)
  • src/pkg/agent/tools/logs.go (2 hunks)
  • src/pkg/agent/tools/provider.go (3 hunks)
  • src/pkg/agent/tools/removeConfig.go (3 hunks)
  • src/pkg/agent/tools/services.go (3 hunks)
  • src/pkg/agent/tools/services_test.go (3 hunks)
  • src/pkg/agent/tools/setConfig.go (3 hunks)
  • src/pkg/cli/client/cluster.go (3 hunks)
  • src/pkg/cli/client/cluster_test.go (1 hunks)
  • src/pkg/cli/composeUp.go (1 hunks)
  • src/pkg/cli/configList_test.go (2 hunks)
  • src/pkg/cli/connect.go (1 hunks)
  • src/pkg/cli/destroy_test.go (2 hunks)
  • src/pkg/cli/getServices_test.go (2 hunks)
  • src/pkg/cli/preview.go (1 hunks)
  • src/pkg/cli/tail.go (1 hunks)
  • src/pkg/cli/whoami_test.go (3 hunks)
  • src/pkg/login/login.go (3 hunks)
  • src/pkg/login/login_test.go (4 hunks)
  • src/pkg/mcp/mcp_server.go (3 hunks)
  • src/pkg/mcp/setup_test.go (0 hunks)
  • src/pkg/stacks/stacks_test.go (14 hunks)
  • src/pkg/stacks/wizard.go (5 hunks)
  • src/pkg/stacks/wizard_test.go (26 hunks)
  • src/pkg/track/track.go (1 hunks)
💤 Files with no reviewable changes (1)
  • src/pkg/mcp/setup_test.go
🚧 Files skipped from review as they are similar to previous changes (29)
  • src/pkg/cli/configList_test.go
  • src/cmd/cli/command/stack_test.go
  • src/pkg/agent/agent.go
  • src/pkg/cli/preview.go
  • src/pkg/agent/tools/create_aws_stack.go
  • src/pkg/cli/connect.go
  • src/pkg/login/login_test.go
  • src/pkg/agent/tools/services.go
  • src/cmd/cli/command/commands_test.go
  • src/pkg/stacks/wizard.go
  • src/pkg/cli/composeUp.go
  • src/pkg/agent/tools/services_test.go
  • src/pkg/stacks/stacks_test.go
  • src/pkg/agent/tools/deploy.go
  • src/cmd/cli/command/compose.go
  • src/pkg/agent/tools/destroy.go
  • src/pkg/agent/tools/logs.go
  • src/cmd/cli/command/mcp.go
  • src/pkg/track/track.go
  • src/pkg/agent/tools/create_gcp_stack.go
  • src/pkg/cli/destroy_test.go
  • src/pkg/cli/tail.go
  • src/pkg/cli/getServices_test.go
  • src/pkg/agent/tools/interfaces.go
  • src/cmd/cli/command/compose_test.go
  • src/cmd/cli/command/cd.go
  • src/pkg/agent/tools/provider.go
  • src/pkg/stacks/wizard_test.go
  • src/pkg/agent/tools/setConfig.go
🧰 Additional context used
🧬 Code graph analysis (12)
src/cmd/cli/command/globals_test.go (4)
src/pkg/stacks/stacks.go (1)
  • StackParameters (17-24)
src/pkg/cli/client/provider_id.go (4)
  • ProviderAuto (13-13)
  • ProviderAWS (15-15)
  • ProviderGCP (17-17)
  • ProviderDefang (14-14)
src/pkg/modes/modes.go (2)
  • Mode (12-12)
  • ModeUnspecified (15-15)
src/pkg/cli/client/cluster.go (1)
  • DefangFabric (16-16)
src/cmd/cli/command/workspace.go (1)
src/pkg/cli/client/cluster.go (1)
  • GetExistingToken (44-69)
src/cmd/cli/command/globals.go (5)
src/pkg/cli/client/grpc.go (1)
  • GrpcClient (19-26)
src/pkg/cli/client/cluster.go (1)
  • DefangFabric (16-16)
src/pkg/utils.go (1)
  • GetenvBool (56-59)
src/pkg/stacks/stacks.go (1)
  • StackParameters (17-24)
src/pkg/cli/client/provider_id.go (1)
  • ProviderAuto (13-13)
src/pkg/cli/client/cluster.go (2)
src/pkg/cli/client/state.go (1)
  • StateDir (15-15)
src/pkg/term/colorizer.go (1)
  • Debug (294-296)
src/cmd/cli/command/estimate.go (4)
src/pkg/cli/client/provider_id.go (4)
  • ProviderAuto (13-13)
  • ProviderID (10-10)
  • ProviderAWS (15-15)
  • ProviderGCP (17-17)
src/pkg/cli/client/playground.go (1)
  • PlaygroundProvider (17-21)
src/pkg/cli/client/client.go (1)
  • FabricClient (17-44)
src/pkg/cli/client/region.go (1)
  • GetRegion (5-16)
src/pkg/agent/tools/estimate.go (8)
src/pkg/cli/client/client.go (1)
  • ProjectLoader (12-15)
src/pkg/agent/tools/interfaces.go (1)
  • CLIInterface (14-32)
src/pkg/agent/tools/default_tool_cli.go (1)
  • StackConfig (19-22)
src/pkg/mcp/mcp_server.go (1)
  • StackConfig (46-46)
src/pkg/mcp/tools/tools.go (1)
  • StackConfig (14-17)
src/pkg/cli/connect.go (1)
  • Connect (16-18)
src/pkg/cli/client/provider_id.go (1)
  • ProviderID (10-10)
src/pkg/cli/estimate.go (1)
  • RunEstimate (23-41)
src/pkg/cli/whoami_test.go (7)
src/pkg/cli/client/playground.go (1)
  • PlaygroundProvider (17-21)
src/pkg/cli/client/client.go (1)
  • FabricClient (17-44)
src/pkg/cli/whoami.go (2)
  • Whoami (25-59)
  • ShowAccountData (14-23)
src/pkg/types/tenant.go (1)
  • TenantNameOrID (5-5)
src/protos/io/defang/v1/fabric.pb.go (4)
  • Provider (28-28)
  • Provider (66-68)
  • Provider (70-72)
  • Provider (79-81)
src/pkg/cli/client/provider.go (1)
  • Provider (43-69)
src/pkg/cli/client/provider_id.go (1)
  • ProviderDefang (14-14)
src/pkg/mcp/mcp_server.go (1)
src/pkg/cli/client/provider_id.go (1)
  • ProviderID (10-10)
src/pkg/agent/tools/listConfig.go (4)
src/pkg/cli/client/client.go (1)
  • ProjectLoader (12-15)
src/pkg/agent/tools/interfaces.go (1)
  • CLIInterface (14-32)
src/pkg/agent/tools/default_tool_cli.go (1)
  • StackConfig (19-22)
src/pkg/mcp/tools/tools.go (1)
  • StackConfig (14-17)
src/pkg/login/login.go (2)
src/pkg/cli/client/client.go (1)
  • FabricClient (17-44)
src/pkg/cli/client/cluster.go (3)
  • SaveAccessToken (77-85)
  • NormalizeHost (18-26)
  • GetWebIdentityTokenFile (71-75)
src/pkg/agent/tools/default_tool_cli.go (6)
src/pkg/cli/client/grpc.go (1)
  • GrpcClient (19-26)
src/pkg/cli/connect.go (1)
  • Connect (16-18)
src/pkg/cli/composeUp.go (2)
  • ComposeUp (32-178)
  • ComposeUpParams (24-29)
src/pkg/cli/client/projectName.go (1)
  • LoadProjectNameWithFallback (10-26)
src/pkg/cli/getServices.go (1)
  • GetServices (28-42)
src/pkg/cli/client/client.go (1)
  • FabricClient (17-44)
src/pkg/agent/tools/removeConfig.go (3)
src/pkg/cli/client/client.go (1)
  • ProjectLoader (12-15)
src/pkg/agent/tools/interfaces.go (1)
  • CLIInterface (14-32)
src/pkg/mcp/tools/tools.go (1)
  • StackConfig (14-17)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: go-test
🔇 Additional comments (29)
src/cmd/cli/command/workspace.go (2)

10-10: LGTM! Import path updated correctly.

The import has been properly updated to reflect the new package location.


19-19: LGTM! Function call updated correctly.

The function call has been properly updated to use the new package name while maintaining the same functionality.

src/pkg/agent/tools/removeConfig.go (2)

8-8: Import path change looks good.

The removal of the cliClient alias and direct import of the client package is consistent with the PR's objective to rename packages and merge the cluster package with cli/client.


34-34: Debug message update is consistent with the refactoring.

The debug message now references cli.LoadProjectNameWithFallback, which matches the actual method call on line 35 using the cli parameter. This cosmetic change improves consistency.

src/pkg/cli/client/cluster_test.go (2)

11-58: Test logic is sound.

The test cases properly cover the token retrieval scenarios with appropriate cleanup and isolation. The logic is correct and comprehensive.


1-1: Package rename from cluster to client is complete.

All references to the old cluster package have been successfully updated across the codebase. No stale imports or references remain.

src/pkg/mcp/mcp_server.go (1)

9-9: LGTM! Import refactoring looks clean.

The import path changes and type reference updates are consistent with the PR's objective to rename packages. The added documentation comment for NewDefangMCPServer is also a nice improvement.

Also applies to: 25-25, 48-48

src/pkg/agent/tools/default_tool_cli.go (2)

10-10: LGTM: Import path updated correctly.

The removal of the cliClient alias and direct import of client package aligns with the PR objectives.


30-115: LGTM: Migration from cliClient to client package types is complete and verified.

All method signatures have been correctly updated to use the new client package types (client.GrpcClient, client.Provider, client.ProviderID, client.Loader, client.FabricClient). Parameter naming improvements (e.g., fabric for *client.GrpcClient) enhance code clarity. Codebase verification confirms zero remaining cliClient references exist across the repository, indicating the migration is complete.

src/pkg/login/login.go (5)

23-23: Interface signature updated correctly.

The method signature update from fabric string to cluster string aligns with the PR objective to rename parameters.


28-39: Method implementation updated consistently.

The parameter renames and package function calls are correctly updated. The call to client.SaveAccessToken(cluster, token) on line 32 matches the function signature from the relevant code snippets.


51-77: Implementation updated correctly with new package functions.

The function implementation is correctly updated:

  • Line 58: client.NormalizeHost(cluster) matches the signature from relevant snippets
  • Line 61: client.SaveAccessToken(cluster, token) matches the signature from relevant snippets
  • All parameter usages are consistent with the new naming

79-114: Function correctly refactored with preserved logic.

The parameter renames and function calls are correctly updated:

  • Line 86: fabric.Token(...) correctly uses the renamed parameter
  • Line 94: client.SaveAccessToken(cluster, resp.AccessToken) matches the signature
  • Line 100: client.GetWebIdentityTokenFile(cluster) matches the signature from relevant snippets

The AWS web identity token file handling logic is preserved correctly.


43-49: No action required. All call sites use positional arguments and are compatible with the parameter renames.

src/pkg/cli/client/cluster.go (1)

1-1: LGTM! Package rename aligns with PR objectives.

The package declaration correctly reflects the merge of the cluster package into cli/client.

src/pkg/cli/whoami_test.go (2)

10-10: LGTM! Import path updated correctly.

The removal of the import alias and direct use of the client package is consistent with the PR objectives.


42-42: Good variable naming improvement.

Renaming the variable from client to provider better reflects that this is a PlaygroundProvider instance, improving code clarity.

src/cmd/cli/command/globals_test.go (2)

9-9: LGTM! Import path updated correctly.

The direct import of the client package is consistent with the package refactoring objectives.


53-53: LGTM! Test expectations updated consistently.

All references to provider constants and fabric defaults have been correctly updated to use the new client package namespace throughout the test cases.

Also applies to: 118-118, 166-166, 202-202, 370-370, 440-440

src/cmd/cli/command/globals.go (2)

9-10: LGTM! Import reorganization aligns with package refactoring.

The addition of the pkg import and removal of the alias are consistent with the PR objectives.


94-94: Reconsider: The current implementation is intentional and documented behavior.

The Debug field reads from the DEFANG_DEBUG environment variable via pkg.GetenvBool(), which returns false by default (when the environment variable is not set or is unparseable). This is standard and documented behavior—the environment variable enables debug mode when explicitly set to a truthy value, rather than enabling it "by default." The pattern is used consistently across the codebase and documented in README files, indicating this is intentional design, not a change that contradicts the PR description.

Likely an incorrect or invalid review comment.

src/cmd/cli/command/estimate.go (2)

7-7: LGTM! Import path updated correctly.

The direct import of the client package is consistent with the package refactoring.


29-47: LGTM! Type references updated consistently.

All provider-related types and constants have been correctly updated to use the client package namespace.

src/pkg/agent/tools/deploy_test.go (1)

59-59: LGTM! Parameter naming improved for clarity.

Renaming the parameter from client to fabric improves code clarity by better distinguishing the gRPC client instance from the generic term "client." This aligns with the naming conventions used elsewhere in the codebase.

Also applies to: 80-80

src/pkg/agent/tools/listConfig.go (2)

9-9: LGTM! Import path updated correctly.

The direct import of the client package is consistent with the package refactoring.


20-20: LGTM! Type reference updated correctly.

The function signature now correctly uses client.ProjectLoader from the refactored package.

src/pkg/agent/tools/estimate.go (2)

8-8: LGTM! Import path updated correctly.

The direct import of the client package is consistent with the package refactoring.


20-20: LGTM! Type references and variable naming updated consistently.

The function signature and internal implementation have been correctly updated to use client.ProjectLoader and client.ProviderID types. The variable naming (fabric) is consistent with the pattern used elsewhere in the codebase.

Also applies to: 29-29, 34-34, 36-36, 49-49

src/cmd/cli/command/commands.go (1)

21-21: LGTM! The package refactoring is consistently applied.

The migration from cliClient alias to direct client package imports is correctly implemented throughout this file. All type references (client.Loader, client.Provider, client.ProviderID), function calls (client.GetExistingToken, client.PrettyError, client.AllProviders, etc.), constants (client.ProviderAuto, client.ProviderAWS, etc.), and function signatures have been consistently updated. Verification confirms no remaining cliClient references exist in the codebase, and the import at line 21 is properly converted to a direct import without any alias.

@lionello lionello disabled auto-merge December 21, 2025 05:43
@lionello lionello merged commit 44ec70f into main Dec 21, 2025
14 checks passed
@lionello lionello deleted the lio/rename-packages branch December 21, 2025 05:43
@coderabbitai coderabbitai bot mentioned this pull request Dec 22, 2025
3 tasks
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