@@ -58,41 +58,40 @@ func main() {
5858 Use : "worker" ,
5959 Short : "Run the worker" ,
6060 Run : func (cmd * cobra.Command , args []string ) {
61-
61+
6262 if ! isOllamaRunning () {
6363 log .Warn ().Msg ("Ollama server is not running" )
64-
64+
6565 if ! askForConfirmation ("Ollama is not running. Do you want me to start it for you?" ) {
6666 log .Fatal ().Msg ("Ollama is required to run the worker" )
6767 }
68-
68+
6969 log .Info ().Msg ("Starting Ollama..." )
7070 if err := startOllama (); err != nil {
7171 log .Fatal ().Err (err ).Msg ("Failed to start Ollama" )
7272 }
73-
73+
7474 log .Info ().Msg ("Waiting for Ollama to become ready..." )
7575 if err := waitForOllama (15 * time .Second ); err != nil {
7676 log .Fatal ().Err (err ).Msg ("Ollama did not become ready" )
7777 }
78-
78+
7979 log .Info ().Msg ("Ollama is running" )
8080 }
81-
81+
8282 ctx , cancel := context .WithCancel (context .Background ())
8383 defer cancel ()
84-
84+
8585 dbPool , err := NewDBPool (ctx , configPath )
8686 if err != nil {
8787 log .Fatal ().Err (err ).Msg ("Failed to connect to database" )
8888 }
8989 defer dbPool .Close ()
90-
90+
9191 driver := riverpgxv5 .New (dbPool )
9292 RunWorker (ctx , driver , cancel , dbPool )
9393 },
9494 }
95-
9695
9796 // ---- View subcommand ----
9897 var totalGroups bool
@@ -127,11 +126,6 @@ func main() {
127126 viewCmd .Flags ().IntVar (& groupID , "group" , 0 , "Display results for a specific group ID" )
128127 viewCmd .Flags ().IntVarP (& n , "number" , "n" , 10 , "Number of results to display" )
129128
130-
131-
132-
133-
134-
135129 // ---- Delete-group subcommand ----
136130 var deleteGroupID int
137131 // ---- Delete-group subcommand ----
@@ -163,9 +157,6 @@ func main() {
163157 }
164158 deleteGroupCmd .Flags ().IntVar (& deleteGroupID , "group-id" , 0 , "Group ID to delete" )
165159
166-
167-
168-
169160 // ---- Queue subcommands ----
170161 var queueN int
171162
@@ -207,7 +198,6 @@ func main() {
207198 },
208199 }
209200
210- // ---- Queue Clear subcommand ----
211201 queueClearCmd := & cobra.Command {
212202 Use : "clear" ,
213203 Short : "Clear queued jobs" ,
@@ -285,7 +275,6 @@ func main() {
285275 },
286276 }
287277 queueCompletedFirstCmd .Flags ().IntVarP (& queueN , "number" , "n" , 10 , "Number of jobs to display" )
288-
289278 queueCompletedLastCmd := & cobra.Command {
290279 Use : "last" ,
291280 Short : "View last completed jobs" ,
@@ -302,22 +291,16 @@ func main() {
302291 },
303292 }
304293 queueCompletedLastCmd .Flags ().IntVarP (& queueN , "number" , "n" , 10 , "Number of jobs to display" )
305-
306- // Wire completed commands
307294 queueCompletedCmd .AddCommand (queueCompletedCountCmd , queueCompletedFirstCmd , queueCompletedLastCmd )
308-
309- // Wire main queue commands
310295 queueCmd .AddCommand (queueViewCmd , queueCountCmd , queueClearCmd , queueFailedCmd , queueCompletedCmd )
311296
312-
313-
314297 // ---- Export subcommand ----
315298 var (
316- exportFormat string
317- exportOutDir string
318- exportFromDate string
319- exportDryRun bool
320- exportOverwrite bool
299+ exportFormat string
300+ exportOutDir string
301+ exportFromDate string
302+ exportDryRun bool
303+ exportOverwrite bool
321304 exportFullExport bool
322305 )
323306
@@ -341,7 +324,7 @@ func main() {
341324 DryRun : exportDryRun ,
342325 Overwrite : exportOverwrite ,
343326 })
344-
327+
345328 if err != nil {
346329 log .Fatal ().Err (err ).Msg ("Export failed" )
347330 }
@@ -351,7 +334,7 @@ func main() {
351334 Msg ("Export completed successfully" )
352335 },
353336 }
354-
337+
355338 exportCmd .Flags ().StringVar (& exportFormat , "format" , "json" , "Export format: json | txt" )
356339 exportCmd .Flags ().StringVar (& exportOutDir , "out" , "./dprompts_exports" , "Output directory" )
357340 exportCmd .Flags ().StringVar (& exportFromDate , "from-date" , "" , "Export results created after this date (YYYY-MM-DD)" )
@@ -363,12 +346,11 @@ func main() {
363346 false ,
364347 "Export all results (ignores --from-date)" ,
365348 )
366-
349+
367350 // Add subcommands
368- rootCmd .AddCommand (clientCmd , workerCmd , viewCmd , deleteGroupCmd , queueCmd ,exportCmd )
351+ rootCmd .AddCommand (clientCmd , workerCmd , viewCmd , deleteGroupCmd , queueCmd , exportCmd )
369352
370353 if err := rootCmd .Execute (); err != nil {
371354 log .Fatal ().Err (err ).Msg ("Command execution failed" )
372355 }
373356}
374-
0 commit comments