diff --git a/.goreleaser.yaml b/cli/.goreleaser.yaml similarity index 100% rename from .goreleaser.yaml rename to cli/.goreleaser.yaml diff --git a/client/chatGPT_client.go b/cli/client/chatGPT_client.go similarity index 100% rename from client/chatGPT_client.go rename to cli/client/chatGPT_client.go diff --git a/client/flink_client.go b/cli/client/flink_client.go similarity index 100% rename from client/flink_client.go rename to cli/client/flink_client.go diff --git a/client/flink_client_test.go b/cli/client/flink_client_test.go similarity index 100% rename from client/flink_client_test.go rename to cli/client/flink_client_test.go diff --git a/client/flink_ui_client.go b/cli/client/flink_ui_client.go similarity index 100% rename from client/flink_ui_client.go rename to cli/client/flink_ui_client.go diff --git a/client/gemini_client.go b/cli/client/gemini_client.go similarity index 100% rename from client/gemini_client.go rename to cli/client/gemini_client.go diff --git a/client/network_chains.go b/cli/client/network_chains.go similarity index 100% rename from client/network_chains.go rename to cli/client/network_chains.go diff --git a/client/network_chains_test.go b/cli/client/network_chains_test.go similarity index 100% rename from client/network_chains_test.go rename to cli/client/network_chains_test.go diff --git a/commands/chat_manuscript.go b/cli/commands/chat_manuscript.go similarity index 100% rename from commands/chat_manuscript.go rename to cli/commands/chat_manuscript.go diff --git a/commands/commander.go b/cli/commands/commander.go similarity index 92% rename from commands/commander.go rename to cli/commands/commander.go index da56a1a..6045e00 100644 --- a/commands/commander.go +++ b/cli/commands/commander.go @@ -2,7 +2,6 @@ package commands import ( "fmt" - "log" "manuscript-core/pkg" "os" @@ -49,7 +48,7 @@ You'll be prompted to select: } var jobListCmd = &cobra.Command{ - Use: "list [directory]", + Use: "list", Aliases: []string{"ls"}, Short: "List all manuscript jobs", Long: `📋 View all running manuscript jobs @@ -71,20 +70,13 @@ Usage: - Specify a directory path to check manuscripts in that location`, Example: `>> manuscript-cli ls >> manuscript-cli list /path/to/manuscripts`, - Args: cobra.MaximumNArgs(1), + Args: cobra.MaximumNArgs(0), Run: func(cmd *cobra.Command, args []string) { - var dir string - // if no args, use default manuscript directory - if len(args) == 0 { - config, err := pkg.LoadConfig(manuscriptConfig) - if err != nil { - log.Fatalf("Error: Failed to load config: %v", err) - } - dir = fmt.Sprintf("%s/%s", config.BaseDir, manuscriptBaseName) - } else { - dir = args[0] // use specified directory if user input + config, err := pkg.LoadConfig(manuscriptConfig) + if err != nil { + fmt.Println("Error: Failed to load manuscript config: %v", err) } - ListJobs(dir) + ListJobs(config) }, } diff --git a/commands/deploy_manuscript.go b/cli/commands/deploy_manuscript.go similarity index 100% rename from commands/deploy_manuscript.go rename to cli/commands/deploy_manuscript.go diff --git a/commands/help_template.go b/cli/commands/help_template.go similarity index 100% rename from commands/help_template.go rename to cli/commands/help_template.go diff --git a/commands/init_manuscript.go b/cli/commands/init_manuscript.go similarity index 99% rename from commands/init_manuscript.go rename to cli/commands/init_manuscript.go index d2d6dbd..fbf027b 100644 --- a/commands/init_manuscript.go +++ b/cli/commands/init_manuscript.go @@ -18,7 +18,7 @@ import ( ) const ( - manuscriptBaseName = "manuscript" + manuscriptBaseName = "manuscripts" manuscriptBaseDir = "$HOME" manuscriptConfig = "$HOME/.manuscript_config.ini" networkChainURL = "https://api.chainbase.com" diff --git a/commands/init_manuscript_test.go b/cli/commands/init_manuscript_test.go similarity index 100% rename from commands/init_manuscript_test.go rename to cli/commands/init_manuscript_test.go diff --git a/commands/jobs_manuscript.go b/cli/commands/jobs_manuscript.go similarity index 94% rename from commands/jobs_manuscript.go rename to cli/commands/jobs_manuscript.go index 76e8c65..9daa855 100644 --- a/commands/jobs_manuscript.go +++ b/cli/commands/jobs_manuscript.go @@ -41,7 +41,7 @@ func formatDurationToMinutes(durationMs int64) string { return fmt.Sprintf("%d minutes", durationMinutes) } -func ListJobs(dir string) { +func ListJobs(config *pkg.Config) { _ = pkg.ExecuteStepWithLoading("Checking jobs", false, func() error { // Step 1: Check for running Docker containers dockers, err := getRunningContainers() @@ -54,21 +54,8 @@ func ListJobs(dir string) { fmt.Println("\r📍 There are no jobs running...") } - // Step 2: Get manuscripts based on source (config or directory) - manuscripts, err := getManuscripts(dir) - if err != nil { - return fmt.Errorf("failed to get manuscripts: %w", err) - } - - if len(manuscripts) == 0 { - if dir != "" { - fmt.Printf("\r⚠️ No manuscript files found in %s\n", dir) - } - return nil - } - // Step 3: Check and display state for each manuscript - displayManuscriptStates(manuscripts, dockers) + displayManuscriptStates(config.Manuscripts, dockers) return nil }) } diff --git a/commands/version_manuscript.go b/cli/commands/version_manuscript.go similarity index 100% rename from commands/version_manuscript.go rename to cli/commands/version_manuscript.go diff --git a/go.mod b/cli/go.mod similarity index 100% rename from go.mod rename to cli/go.mod diff --git a/go.sum b/cli/go.sum similarity index 100% rename from go.sum rename to cli/go.sum diff --git a/main.go b/cli/main.go similarity index 100% rename from main.go rename to cli/main.go diff --git a/pkg/common_command.go b/cli/pkg/common_command.go similarity index 100% rename from pkg/common_command.go rename to cli/pkg/common_command.go diff --git a/pkg/docker_command.go b/cli/pkg/docker_command.go similarity index 100% rename from pkg/docker_command.go rename to cli/pkg/docker_command.go diff --git a/pkg/execute_step_with_loading.go b/cli/pkg/execute_step_with_loading.go similarity index 100% rename from pkg/execute_step_with_loading.go rename to cli/pkg/execute_step_with_loading.go diff --git a/pkg/manuscript_config.go b/cli/pkg/manuscript_config.go similarity index 100% rename from pkg/manuscript_config.go rename to cli/pkg/manuscript_config.go diff --git a/pkg/manuscript_parse.go b/cli/pkg/manuscript_parse.go similarity index 100% rename from pkg/manuscript_parse.go rename to cli/pkg/manuscript_parse.go diff --git a/pkg/manuscript_state.go b/cli/pkg/manuscript_state.go similarity index 100% rename from pkg/manuscript_state.go rename to cli/pkg/manuscript_state.go diff --git a/static/docker_compose_template.go b/cli/static/docker_compose_template.go similarity index 100% rename from static/docker_compose_template.go rename to cli/static/docker_compose_template.go diff --git a/static/manuscript_template.go b/cli/static/manuscript_template.go similarity index 100% rename from static/manuscript_template.go rename to cli/static/manuscript_template.go