From fe32909d58a59407350043851970cb3004ad351e Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 12 Apr 2026 18:09:49 +0100 Subject: Rename project to kaagum. kaakaa reminds too many Europeans of shit. 😅 --- bin/kaagum | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/kaakaa | 109 ------------------------------------------------------------- 2 files changed, 109 insertions(+), 109 deletions(-) create mode 100755 bin/kaagum delete mode 100755 bin/kaakaa (limited to 'bin') diff --git a/bin/kaagum b/bin/kaagum new file mode 100755 index 0000000..4b9ab9f --- /dev/null +++ b/bin/kaagum @@ -0,0 +1,109 @@ +#!/usr/bin/env sh +# -*- mode: scheme; -*- +exec guile --no-auto-compile -e main -s "$0" "$@" +!# +;;; kaagum --- Tiny, security-focused AI agent in Guile +;;; Copyright © 2026 Arun Isaac +;;; +;;; This file is part of kaagum. +;;; +;;; kaagum is free software: you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; kaagum is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with kaagum. If not, see . + +(use-modules (rnrs io ports) + (srfi srfi-37) + (ice-9 match) + (kaagum config) + (kaagum openai) + (kaagum tea) + (kaagum tools base) + (kaagum utils)) + +(define (invalid-option opt name arg result) + (error "Invalid option" name)) + +(define (invalid-argument arg result) + (error "Invalid argument" arg)) + +(define %options + (list (option (list #\m "model") #t #f + (lambda (opt name arg result) + (acons 'model arg + result))) + (option (list #\a "api-base-uri") #t #f + (lambda (opt name arg result) + (acons 'api-base-uri arg result))) + (option (list #\k "api-key-command") #t #f + (lambda (opt name arg result) + (acons 'api-key-command arg result))) + (option (list #\v "version") #f #f + (lambda (opt name arg result) + (acons 'version #t result))) + (option (list #\h "help") #f #f + (lambda (opt name arg result) + (acons 'help #t result))))) + +(define (print-usage program) + "Print kaagum usage. @var{program} is the name of the executable used +to invoke kaagum." + (format (current-error-port) + "Usage: ~a [OPTIONS] +Run kaagum AI agent. + + --api-base-uri=URI base API URI of LLM provider + --api-key-command=COMMAND command to run to get API key + --model=MODEL LLM model name + + --version print version and exit + --help print this help and exit +" + program)) + +(define (die fmt . args) + "Print formatted message, followed by a newline and exit with failure." + (apply format (current-error-port) fmt args) + (newline (current-error-port)) + (exit #f)) + +(define (get-api-key api-key-command) + "Run @var{api-key-command} and get the API key." + ;; We use a shell to execute since + ;; 1. api-key-command is a string, not a list of string arguments + ;; 2. api-key-command may contain pipes + (call-with-input-pipe `("sh" "-c" ,api-key-command) + get-string-all)) + +(define main + (match-lambda + ((program args ...) + (let ((args (args-fold args + %options + invalid-option + invalid-argument + '((model . "anthropic/claude-opus-4.6") + (api-base-uri . "https://openrouter.ai"))))) + (when (assq-ref args 'help) + (print-usage program) + (exit #t)) + (when (assq-ref args 'version) + (format (current-output-port) + "~a ~a~%" + %project %version) + (exit #t)) + (unless (assq-ref args 'api-key-command) + (die "--api-key-command not specified")) + (tea-loop (initial-state) + (assq-ref args 'api-base-uri) + (get-api-key (assq-ref args 'api-key-command)) + (assq-ref args 'model) + %base-tools))))) diff --git a/bin/kaakaa b/bin/kaakaa deleted file mode 100755 index 5f94176..0000000 --- a/bin/kaakaa +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env sh -# -*- mode: scheme; -*- -exec guile --no-auto-compile -e main -s "$0" "$@" -!# -;;; kaakaa --- Tiny, security-focused AI agent in Guile -;;; Copyright © 2026 Arun Isaac -;;; -;;; This file is part of kaakaa. -;;; -;;; kaakaa is free software: you can redistribute it and/or modify it -;;; under the terms of the GNU General Public License as published by -;;; the Free Software Foundation, either version 3 of the License, or -;;; (at your option) any later version. -;;; -;;; kaakaa is distributed in the hope that it will be useful, but -;;; WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;; General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with kaakaa. If not, see . - -(use-modules (rnrs io ports) - (srfi srfi-37) - (ice-9 match) - (kaakaa config) - (kaakaa openai) - (kaakaa tea) - (kaakaa tools base) - (kaakaa utils)) - -(define (invalid-option opt name arg result) - (error "Invalid option" name)) - -(define (invalid-argument arg result) - (error "Invalid argument" arg)) - -(define %options - (list (option (list #\m "model") #t #f - (lambda (opt name arg result) - (acons 'model arg - result))) - (option (list #\a "api-base-uri") #t #f - (lambda (opt name arg result) - (acons 'api-base-uri arg result))) - (option (list #\k "api-key-command") #t #f - (lambda (opt name arg result) - (acons 'api-key-command arg result))) - (option (list #\v "version") #f #f - (lambda (opt name arg result) - (acons 'version #t result))) - (option (list #\h "help") #f #f - (lambda (opt name arg result) - (acons 'help #t result))))) - -(define (print-usage program) - "Print kaakaa usage. @var{program} is the name of the executable used -to invoke kaakaa." - (format (current-error-port) - "Usage: ~a [OPTIONS] -Run kaakaa AI agent. - - --api-base-uri=URI base API URI of LLM provider - --api-key-command=COMMAND command to run to get API key - --model=MODEL LLM model name - - --version print version and exit - --help print this help and exit -" - program)) - -(define (die fmt . args) - "Print formatted message, followed by a newline and exit with failure." - (apply format (current-error-port) fmt args) - (newline (current-error-port)) - (exit #f)) - -(define (get-api-key api-key-command) - "Run @var{api-key-command} and get the API key." - ;; We use a shell to execute since - ;; 1. api-key-command is a string, not a list of string arguments - ;; 2. api-key-command may contain pipes - (call-with-input-pipe `("sh" "-c" ,api-key-command) - get-string-all)) - -(define main - (match-lambda - ((program args ...) - (let ((args (args-fold args - %options - invalid-option - invalid-argument - '((model . "anthropic/claude-opus-4.6") - (api-base-uri . "https://openrouter.ai"))))) - (when (assq-ref args 'help) - (print-usage program) - (exit #t)) - (when (assq-ref args 'version) - (format (current-output-port) - "~a ~a~%" - %project %version) - (exit #t)) - (unless (assq-ref args 'api-key-command) - (die "--api-key-command not specified")) - (tea-loop (initial-state) - (assq-ref args 'api-base-uri) - (get-api-key (assq-ref args 'api-key-command)) - (assq-ref args 'model) - %base-tools))))) -- cgit 1.4.1