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
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func init() {
sdklog.SetLogger(sdklog.NewNop())

// Configuration file flag
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.conductor-cli.yaml)")
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.conductor-cli/config.yaml)")

// Server and authentication flags
rootCmd.PersistentFlags().String("server", "", "Conductor server URL (can also be set via CONDUCTOR_SERVER_URL)")
Expand Down
2 changes: 1 addition & 1 deletion cmd/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

var schedulerCmd = &cobra.Command{
Use: "schedule",
Short: "Schedule Management",
Short: "Schedule management",
}

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/task_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

var taskCmd = &cobra.Command{
Use: "task",
Short: "Task Management",
Short: "Task definition management",
}

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/webhook_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

var webhookCmd = &cobra.Command{
Use: "webhook",
Short: "Webhooks Management",
Short: "Webhook management",
}

var (
Expand Down
42 changes: 21 additions & 21 deletions cmd/workflow_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

var workflowCmd = &cobra.Command{
Use: "workflow",
Short: "Workflow Management",
Short: "Workflow definition management",
}

var (
Expand Down Expand Up @@ -181,12 +181,12 @@ func updateWorkflowMetadata(cmd *cobra.Command, args []string) error {
if err != nil {
return fmt.Errorf("error checking stdin: %v", err)
}

// If running interactively (no pipe/redirect), show usage
if (stat.Mode() & os.ModeCharDevice) != 0 {
return cmd.Usage()
}

data = read()
if len(data) == 0 {
return fmt.Errorf("no workflow data received from stdin")
Expand Down Expand Up @@ -232,12 +232,12 @@ func createWorkflowMetadata(cmd *cobra.Command, args []string) error {
if err != nil {
return fmt.Errorf("error checking stdin: %v", err)
}

// If running interactively (no pipe/redirect), show usage
if (stat.Mode() & os.ModeCharDevice) != 0 {
return cmd.Usage()
}

data = read()
if len(data) == 0 {
return fmt.Errorf("no workflow data received from stdin")
Expand Down Expand Up @@ -282,12 +282,12 @@ func _deleteWorkflowMetadata(cmd *cobra.Command, args []string) error {
if err != nil {
return fmt.Errorf("error checking stdin: %v", err)
}

// If running interactively (no pipe/redirect), show usage
if (stat.Mode() & os.ModeCharDevice) != 0 {
return cmd.Usage()
}

workflows := readLines()
if len(workflows) == 0 {
return fmt.Errorf("no workflow data received from stdin")
Expand Down Expand Up @@ -335,12 +335,12 @@ func _deleteWorkflowMetadata(cmd *cobra.Command, args []string) error {
// parseJSONError provides helpful error messages for JSON parsing failures
func parseJSONError(err error, jsonContent string, contextName string) error {
errStr := err.Error()

// Common JSON syntax error patterns
if strings.Contains(errStr, "invalid character") && strings.Contains(errStr, "in string literal") {
// Find the approximate line number by counting newlines
lines := strings.Split(jsonContent, "\n")

// Look for unterminated strings (missing quotes)
for i, line := range lines {
// Simple heuristic: look for lines with odd number of quotes
Expand All @@ -349,26 +349,26 @@ func parseJSONError(err error, jsonContent string, contextName string) error {
return fmt.Errorf("JSON syntax error in %s: unterminated string on line %d\nLine content: %s\nHint: Check for missing closing quote (\") on this line", contextName, i+1, strings.TrimSpace(line))
}
}

return fmt.Errorf("JSON syntax error in %s: %s\nHint: Check for unterminated strings (missing quotes)", contextName, errStr)
}

if strings.Contains(errStr, "unexpected end of JSON input") {
return fmt.Errorf("JSON syntax error in %s: unexpected end of file\nHint: Check for missing closing braces } or brackets ]", contextName)
}

if strings.Contains(errStr, "invalid character") {
return fmt.Errorf("JSON syntax error in %s: %s\nHint: Check for invalid characters, missing commas, or malformed values", contextName, errStr)
}

// Fallback for other JSON errors
return fmt.Errorf("Invalid %s format: %s", contextName, errStr)
}

// parseAPIError extracts useful error information from API responses
func parseAPIError(err error, defaultMsg string) error {
errStr := err.Error()

// Try to extract JSON from error message
// Error format: "error: {...}, body: {...}"
var jsonStr string
Expand All @@ -379,13 +379,13 @@ func parseAPIError(err error, defaultMsg string) error {
jsonStr = parts[1]
}
} else if strings.Contains(errStr, "error: {") {
// Extract the error part
// Extract the error part
parts := strings.Split(errStr, "error: ")
if len(parts) > 1 {
jsonStr = strings.Split(parts[1], ", body:")[0]
}
}

if jsonStr != "" {
// Try to parse the JSON with validation errors
var errorResponse struct {
Expand All @@ -396,11 +396,11 @@ func parseAPIError(err error, defaultMsg string) error {
Message string `json:"message"`
} `json:"validationErrors"`
}

if json.Unmarshal([]byte(jsonStr), &errorResponse) == nil {
if errorResponse.Message != "" {
message := fmt.Sprintf("%s: %s", defaultMsg, errorResponse.Message)

// Add validation error details if available
if len(errorResponse.ValidationErrors) > 0 {
message += "\nValidation errors:"
Expand All @@ -412,16 +412,16 @@ func parseAPIError(err error, defaultMsg string) error {
}
}
}

if errorResponse.Status > 0 {
message += fmt.Sprintf(" (status: %d)", errorResponse.Status)
}

return fmt.Errorf(message)
}
}
}

// Fallback to original error if parsing fails
return fmt.Errorf("%s: %v", defaultMsg, err)
}
Expand Down
7 changes: 3 additions & 4 deletions cmd/workflow_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ var (
// Execution command group
executionCmd = &cobra.Command{
Use: "execution",
Short: "Workflow execution management",
Long: "Commands for managing workflow executions",
Short: "Workflow and Task execution",
Long: "Commands for managing workflow and task execution",
}

// Execution subcommands
Expand Down Expand Up @@ -145,7 +145,6 @@ var (
SilenceUsage: true,
Example: "execution update-state [workflow_id] --variables '{\"key\":\"value\"}'",
}

)

// parseTimeToEpochMillis parses human-readable time formats to epoch milliseconds
Expand Down Expand Up @@ -462,7 +461,7 @@ func deleteWorkflowExecution(cmd *cobra.Command, args []string) error {
}

archive, _ := cmd.Flags().GetBool("archive")

workflowClient := internal.GetWorkflowClient()
for i := 0; i < len(args); i++ {
workflowId := args[i]
Expand Down
Loading