36 lines
983 B
Org Mode
36 lines
983 B
Org Mode
#+TITLE: SKILL: Lisp Utils (org-skill-lisp-utils.org)
|
|
#+AUTHOR: Agent
|
|
#+FILETAGS: :skill:lisp:validation:
|
|
#+PROPERTY: header-args:lisp :tangle org-skill-lisp-utils.lisp
|
|
|
|
* Overview
|
|
The *Lisp Utils* skill provides advanced structural and semantic validation for Common Lisp code.
|
|
|
|
* Implementation
|
|
|
|
** Package Context
|
|
#+begin_src lisp
|
|
(in-package :opencortex)
|
|
#+end_src
|
|
|
|
** Validation Logic
|
|
#+begin_src lisp
|
|
(defun lisp-utils-validate (code &key (strict t))
|
|
"Performs deep validation of Lisp code strings."
|
|
(declare (ignore strict))
|
|
(handler-case
|
|
(let ((*read-eval* nil))
|
|
(with-input-from-string (s (format nil "(progn ~a)" code))
|
|
(loop for form = (read s nil :eof) until (eq form :eof)))
|
|
(list :status :success))
|
|
(error (c)
|
|
(list :status :error :reason (format nil "~a" c)))))
|
|
#+end_src
|
|
|
|
** Skill Registration
|
|
#+begin_src lisp
|
|
(defskill :skill-lisp-utils
|
|
:priority 400
|
|
:trigger (lambda (ctx) (declare (ignore ctx)) nil))
|
|
#+end_src
|