Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions experimental/ssh/cmd/agent_shim.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package ssh

import (
"github.com/databricks/cli/cmd/root"
"github.com/databricks/cli/experimental/ssh/internal/client"
"github.com/databricks/cli/libs/cmdctx"
"github.com/spf13/cobra"
)

func newAgentShimCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "agent-shim",
Short: "Launch a coding agent configured against Unity AI Gateway (invoked on the remote)",
Hidden: true,
}
for _, agent := range client.SupportedAgentNames() {
cmd.AddCommand(newAgentShimAgentCommand(agent))
}
return cmd
}

func newAgentShimAgentCommand(agent string) *cobra.Command {
cmd := &cobra.Command{
Use: agent,
Short: "Launch " + agent + " configured against Unity AI Gateway",
// Disable flag parsing: forward everything after the agent name to the agent verbatim.
DisableFlagParsing: true,
}

cmd.PreRunE = func(cmd *cobra.Command, args []string) error {
// Runs on the driver with injected env auth; no bundle, no prompt.
cmd.SetContext(root.SkipLoadBundle(cmd.Context()))
cmd.SetContext(root.SkipPrompt(cmd.Context()))
return root.MustWorkspaceClient(cmd, args)
}

cmd.RunE = func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()
return client.RunAgentShim(ctx, cmdctx.WorkspaceClient(ctx), agent, args)
}

return cmd
}
1 change: 1 addition & 0 deletions experimental/ssh/cmd/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Use ` + "`databricks ssh connect --help`" + ` to see all available flags.`,
cmd.AddCommand(newSetupCommand())
cmd.AddCommand(newConnectCommand())
cmd.AddCommand(newServerCommand())
cmd.AddCommand(newAgentShimCommand())

return cmd
}
Loading
Loading