(in-package #:nekod) ;; The Nekomata eval loop — infrastructure as a read-eval-print loop (defun nekod-eval (form) "Evaluate an infrastructure form. Returns the result." (typecase form (container-spec form) ; Already a spec, return as-is (symbol (if (boundp form) (symbol-value form) form)) (cons (case (car form) (define-container (eval form)) (with-failover (eval form)) (t (eval form)))) (t form))) (defun nekod-repl () "Interactive REPL for Nekomata infrastructure management." (format t "~&Nekomata ~a~%Type :quit to exit.~%nekod> " "0.1.0") (finish-output) (loop (let ((form (read *standard-input* nil :eof))) (when (eq form :eof) (return)) (when (eq form :quit) (return)) (handler-case (let ((result (nekod-eval form))) (format t "~&=> ~s~%nekod> " result) (finish-output)) (nekomata-error (e) (format t "~&Error: ~a~%nekod> " (error-message e)) (finish-output))))))