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
10 changes: 10 additions & 0 deletions internal/commands/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,13 @@ func (c *CreateCommand) createMCPToolsFromYAML(agentsYaml []common.YAMLDocument)

return nil
}

// DeprecatedCreateCommand deprecated create command
func DeprecatedCreateCommand(args0 string, options *CommandOptions) error {
createCmd := &CreateCommand{
BaseCommand: NewBaseCommand(options),
agentsFile: args0,
mcpServerURI: "",
}
return createCmd.Run()
}
10 changes: 10 additions & 0 deletions internal/commands/create_cr.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,13 @@ func sanitizeName(name string) string {

return newName
}


// DeprecatedCreateCommand deprecated create command
func DeprecatedCreateCrCommand(args0 string, options *CommandOptions) error {
createcrCmd := &CreateCrCommand{
BaseCommand: NewBaseCommand(options),
yamlFile: args0,
}
return createcrCmd.Run()
}
48 changes: 48 additions & 0 deletions internal/commands/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,51 @@ func (c *DeployCommand) deployToTarget(target string, env string) error {

return nil
}

// DeprecatedDeployCommand deprecated create command
func DeprecatedDeployCommand(args []string, options *CommandOptions, cmd *cobra.Command) error {
deployCmd := &DeployCommand{}
deployCmd.BaseCommand = NewBaseCommand(options)
deployCmd.agentsFile = args[0]
deployCmd.workflowFile = args[1]
deployCmd.env = args[2:]

// Get flag values
var err error
deployCmd.url, err = cmd.Flags().GetString("url")
if err != nil {
return err
}

deployCmd.k8s, err = cmd.Flags().GetBool("k8s")
if err != nil {
return err
}

deployCmd.kubernetes, err = cmd.Flags().GetBool("kubernetes")
if err != nil {
return err
}

deployCmd.docker, err = cmd.Flags().GetBool("docker")
if err != nil {
return err
}

deployCmd.streamlit, err = cmd.Flags().GetBool("streamlit")
if err != nil {
return err
}

deployCmd.autoPrompt, err = cmd.Flags().GetBool("auto-prompt")
if err != nil {
return err
}

deployCmd.mcpServerURI, err = cmd.Flags().GetString("mcp-server-uri")
if err != nil {
return err
}

return deployCmd.Run()
}
22 changes: 22 additions & 0 deletions internal/commands/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,25 @@ func (c *RunCommand) runWorkflow(workflow common.YAMLDocument, agents []common.Y
func (c *RunCommand) logWorkflowRun(logger *common.Logger, workflowID, workflowName, prompt, output string, modelsUsed []string, status string, startTime, endTime time.Time, durationMs int) {
c.Console().Ok(fmt.Sprintf("Workflow %s completed with status: %s", workflowID, status))
}

// DeprecatedRunCommand deprecated create command
func DeprecatedRunCommand(args []string, options *CommandOptions) error {
var agentsFile, workflowFile string
if len(args) == 1 {
agentsFile = ""
workflowFile = args[0]
} else if len(args) == 2 {
agentsFile = args[0]
workflowFile = args[1]
}

runCmd := &RunCommand{
BaseCommand: NewBaseCommand(options),
agentsFile: agentsFile,
workflowFile: workflowFile,
prompt: false,
mcpServerURI: "",
}

return runCmd.Run()
}
35 changes: 35 additions & 0 deletions internal/commands/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,3 +427,38 @@ func (c AgentServeCommand) serveFastAPIAgent() error {
return nil

}
// DeprecatedServeCommand deprecated create command
func DeprecatedServeCommand(args []string, options *CommandOptions, cmd *cobra.Command) error {
agentServeCmd := &AgentServeCommand{}
agentServeCmd.BaseCommand = NewBaseCommand(options)
agentServeCmd.agentsFile = args[0]

// Get flag values
var err error
agentServeCmd.agentName, err = cmd.Flags().GetString("agent-name")
if err != nil {
return err
}

agentServeCmd.host, err = cmd.Flags().GetString("host")
if err != nil {
return err
}

portStr, err := cmd.Flags().GetString("port")
if err != nil {
return err
}

if portStr == "" {
agentServeCmd.port = 8001
} else {
agentServeCmd.port, err = strconv.Atoi(portStr)
if err != nil {
return fmt.Errorf("invalid port number: %s", portStr)
}
}
agentServeCmd.mcpServerURI = ""

return agentServeCmd.Run()
}
81 changes: 81 additions & 0 deletions src/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"fmt"

"github.com/spf13/cobra"
"maestro/internal/common"
"maestro/internal/commands"
)

// VDB Commands
Expand Down Expand Up @@ -385,6 +387,85 @@ var metaAgentCmd = &cobra.Command{
Example: ` maestro metaagent run TEXT_FILE.`,
}

// Deprecated Create commands - agent/MCPtool
var deprecatedCreateCmd = &cobra.Command{
Use: "create",
Short: "*** Deprecated *** Create",
Long: `*** Deprecated *** Create: Use agent or tool create.`,
Aliases: []string{"create"},
Args: cobra.ExactArgs(1),
Example: ` maestro agent/tool create yaml_file.`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("***Deprecated Create: Use agent or tool create.***")
defs, _ := common.ParseYAML(args[0])
fmt.Println(defs[0]["kind"])
if defs[0]["kind"] == "Agent" || defs[0]["kind"] == "MCPTool"{
options := commands.NewCommandOptions(cmd)
return commands.DeprecatedCreateCommand(args[0], options)
}
return nil
},
}

// Deprecated CreateCr commands - agent/MCPtool
var deprecatedCreateCrCmd = &cobra.Command{
Use: "create-cr",
Short: "*** Deprecated *** Create-cr",
Long: `*** Deprecated *** Create-cr: Use curomresource create yaml_file.`,
Aliases: []string{"create"},
Args: cobra.ExactArgs(1),
Example: ` maestro agent/tool create-cr yaml_file.`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("***Deprecated Create: Use agent or tool create.***")
options := commands.NewCommandOptions(cmd)
return commands.DeprecatedCreateCrCommand(args[0], options)
},
}

// Deprecated Run commands - workflow
var deprecatedRunCmd = &cobra.Command{
Use: "run",
Short: "*** Deprecated *** Run",
Long: `Deprecated Run: Use workflow run.`,
Aliases: []string{"run"},
Example: ` maestro workflow run agentyaml_file workflowyaml_file.`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("***Deprecated Run: Use workflow run.***")
options := commands.NewCommandOptions(cmd)
return commands.DeprecatedRunCommand(args, options)
},
}

// Deprecated Deploy commands - workflow
var deprecatedDeployCmd = &cobra.Command{
Use: "deploy",
Short: "*** Deprecated *** Deploy",
Long: `*** Deprecated *** Deploy: Use workflow deploy.`,
Aliases: []string{"deploy"},
Args: cobra.MinimumNArgs(2),
Example: ` maestro deploy agentyaml_file workflowyaml_file.`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("***Deprecated Deploy: Use workflow deploy.***")
options := commands.NewCommandOptions(cmd)
return commands.DeprecatedDeployCommand(args, options, cmd)
},
}

// Deprecated Deploy commands - workflow
var deprecatedServeCmd = &cobra.Command{
Use: "serve",
Short: "*** Deprecated *** Serve",
Long: `*** Deprecated *** : Use workflow/agent serve.`,
Aliases: []string{"serve"},
Args: cobra.ExactArgs(1),
Example: ` maestro serve agentyaml_file.`,
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println("***Deprecated Serve: Use workflow serve.***")
options := commands.NewCommandOptions(cmd)
return commands.DeprecatedServeCommand(args, options, cmd)
},
}

func init() {
// Add flags to collection commands
collectionListCmd.Flags().String("vdb", "", "Vector database name")
Expand Down
18 changes: 18 additions & 0 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ A command-line interface for working with Maestro configurations.`,
rootCmd.AddCommand(workflowCmd)
rootCmd.AddCommand(customResourceCmd)
rootCmd.AddCommand(metaAgentCmd)
rootCmd.AddCommand(deprecatedCreateCmd)
rootCmd.AddCommand(deprecatedCreateCrCmd)
rootCmd.AddCommand(deprecatedRunCmd)
rootCmd.AddCommand(deprecatedDeployCmd)
rootCmd.AddCommand(deprecatedServeCmd)
rootCmd.AddCommand(vdbCmd)
rootCmd.AddCommand(collectionCmd)
rootCmd.AddCommand(documentCmd)
Expand All @@ -137,6 +142,19 @@ A command-line interface for working with Maestro configurations.`,
rootCmd.AddCommand(validateCmd)
rootCmd.AddCommand(statusCmd)

// Add flags
deprecatedDeployCmd.Flags().String("url", "127.0.0.1:5000", "The deployment URL")
deprecatedDeployCmd.Flags().Bool("k8s", false, "Deploy to Kubernetes")
deprecatedDeployCmd.Flags().Bool("kubernetes", false, "Deploy to Kubernetes")
deprecatedDeployCmd.Flags().Bool("docker", false, "Deploy to Docker")
deprecatedDeployCmd.Flags().Bool("streamlit", false, "Deploy as Streamlit application (default)")
deprecatedDeployCmd.Flags().Bool("auto-prompt", false, "Run prompt by default if specified")
deprecatedDeployCmd.Flags().StringVar(&mcpServerURI, "mcp-server-uri", "", "Maestro MCP server URI (overrides MAESTRO_MAESTRO_MCP_SERVER_URI environment variable)")
deprecatedServeCmd.Flags().String("agent-name", "", "Specific agent name to serve (if multiple in file)")
deprecatedServeCmd.Flags().String("host", "127.0.0.1", "Host to bind to")
deprecatedServeCmd.Flags().String("port", "8000", "Port to serve on")
deprecatedServeCmd.Flags().StringVar(&mcpServerURI, "mcp-server-uri", "", "Maestro MCP server URI (overrides MAESTRO_MAESTRO_MCP_SERVER_URI environment variable)")

// Add completion command
AddCompletionCommand(rootCmd)

Expand Down
Loading