feat: Allow starting CLI without initial prompt (#2)

Make the initial prompt optional. When no arguments are provided,
the CLI now goes directly to interactive mode instead of exiting.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Leo Alho 2026-01-29 15:06:30 +02:00 committed by GitHub
parent 63d4ad95d0
commit 981683a405
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -178,12 +178,8 @@ func main() {
logFilePath = filepath.Join(stateDir, "klod", "sessions", sessionTime+".log")
}
// Get initial prompt from command-line arguments
if len(os.Args) < 2 {
fmt.Fprintln(os.Stderr, "Usage: klod <your prompt>")
os.Exit(1)
}
// Get initial prompt from command-line arguments (if provided)
if len(os.Args) >= 2 {
initialPrompt := strings.Join(os.Args[1:], " ")
// Add initial user message to conversation history
@ -211,6 +207,7 @@ func main() {
}
conversationHistory = append(conversationHistory, assistantMsg)
logConversation(assistantMsg)
}
// Interactive conversation loop
reader := bufio.NewReader(os.Stdin)