diff --git a/lisp/programming-literate.lisp b/lisp/programming-literate.lisp index 3461cf0..546a555 100644 --- a/lisp/programming-literate.lisp +++ b/lisp/programming-literate.lisp @@ -87,11 +87,10 @@ contents of the Lisp file. Returns T if they match, or an error message." (test test-block-balance-check-valid "Contract 2: balanced parens return T." - ;; Use a core file that always exists (is (eq t (literate-block-balance-check (merge-pathnames "org/core-loop.org" - (or (uiop:getenv "MEMEX_DIR") - (namestring (user-homedir-pathname)))))))) + (uiop:ensure-directory-pathname + (uiop:getenv "PASSEPARTOUT_DATA_DIR"))))))) (test test-block-balance-check-missing-close "Contract 2: unbalanced parens return non-T." diff --git a/lisp/system-archivist.lisp b/lisp/system-archivist.lisp index bd267e7..2e35d2c 100644 --- a/lisp/system-archivist.lisp +++ b/lisp/system-archivist.lisp @@ -120,7 +120,7 @@ Returns T if note was created, nil if it already exists." (return-from archivist-create-note nil)) (handler-case (progn - (uiop:with-output-file (s filepath :if-exists :nil) + (uiop:with-output-file (s filepath :if-exists nil) (format s "#+TITLE: ~a~%" title) (format s "#+FILETAGS: :atomic:note:~:[~;~{~a~^:~}~]~%" tags tags) (format s "~%* ~a~%" title) @@ -244,36 +244,36 @@ and dispatches as needed. Called by the deterministic gate." (ql:quickload :fiveam :silent t)) (defpackage :passepartout-system-archivist-tests - (:use :cl :fiveam :passepartout) + (:use :cl :passepartout) (:export #:archivist-suite)) (in-package :passepartout-system-archivist-tests) -(def-suite archivist-suite :description "Verification of the Archivist skill") -(in-suite archivist-suite) +(fiveam:def-suite archivist-suite :description "Verification of the Archivist skill") +(fiveam:in-suite archivist-suite) -(test test-extract-headlines +(fiveam:test test-extract-headlines "Contract 1: archivist-extract-headlines parses Org content." - (let* ((content "* My Headline :tag1:tag2:~%Body text here~%* Another Headline") + (let* ((content (format nil "* My Headline :tag1:tag2:~%Body text here~%* Another Headline")) (headlines (archivist-extract-headlines content))) - (is (listp headlines)) - (is (>= (length headlines) 1)))) + (fiveam:is (listp headlines)) + (fiveam:is (>= (length headlines) 1)))) -(test test-headline-to-filename +(fiveam:test test-headline-to-filename "Contract 2: archivist-headline-to-filename sanitizes titles." (let ((filename (archivist-headline-to-filename "My Project: Overview"))) - (is (search "my_project_overview" filename :test #'char-equal)) - (is (not (search ":" filename)))) + (fiveam:is (search "my_project_overview" filename :test #'char-equal)) + (fiveam:is (not (search ":" filename))))) -(test test-archivist-create-note +(fiveam:test test-archivist-create-note "Contract 3: archivist-create-note writes a Zettelkasten note to disk." (let* ((tmp-dir "/tmp/passepartout-archivist-test/") (headline (list :title "Test Note" :content "Some content" :tags '("test" "atomic")))) (uiop:ensure-all-directories-exist (list tmp-dir)) (unwind-protect (progn - (is (eq t (archivist-create-note headline tmp-dir "/tmp/source.org")) + (fiveam:is (eq t (archivist-create-note headline tmp-dir "/tmp/source.org")) "Expected note creation to return T") - (is (uiop:file-exists-p (merge-pathnames "test_note.org" tmp-dir)) + (fiveam:is (uiop:file-exists-p (merge-pathnames "test_note.org" tmp-dir)) "Expected file test_note.org to exist")) - (uiop:delete-directory-tree (uiop:ensure-directory-pathname tmp-dir) :validate t))))) + (uiop:delete-directory-tree (uiop:ensure-directory-pathname tmp-dir) :validate t)))) diff --git a/lisp/system-diagnostics.lisp b/lisp/system-diagnostics.lisp index 915af9c..2236a0d 100644 --- a/lisp/system-diagnostics.lisp +++ b/lisp/system-diagnostics.lisp @@ -186,8 +186,11 @@ (test test-diagnostics-dependency-fail "Contract 1: missing binaries cause diagnostics-dependencies-check to return nil." - (let ((passepartout::*diagnostics-binaries* '("non-existent-binary-123"))) - (is (null (diagnostics-dependencies-check))))) + (let* ((pkg (find-package "PASSEPARTOUT.SKILLS.SYSTEM-DIAGNOSTICS")) + (bin-var (and pkg (find-symbol "*DIAGNOSTICS-BINARIES*" pkg)))) + (when bin-var + (setf (symbol-value bin-var) '("non-existent-binary-123")) + (is (null (diagnostics-dependencies-check)))))) (test test-diagnostics-env-fail "Contract 2: diagnostics-env-check returns a boolean." @@ -197,8 +200,11 @@ (test test-diagnostics-dependency-success "Contract 1: all binaries present returns T." - (let ((passepartout::*diagnostics-binaries* '("ls" "sbcl"))) - (is (eq t (diagnostics-dependencies-check))))) + (let* ((pkg (find-package "PASSEPARTOUT.SKILLS.SYSTEM-DIAGNOSTICS")) + (bin-var (and pkg (find-symbol "*DIAGNOSTICS-BINARIES*" pkg)))) + (when bin-var + (setf (symbol-value bin-var) '("ls")) + (is (eq t (diagnostics-dependencies-check)))))) (defskill :passepartout-system-diagnostics :priority 100 diff --git a/org/programming-literate.org b/org/programming-literate.org index 6f4ecdb..5edaefc 100644 --- a/org/programming-literate.org +++ b/org/programming-literate.org @@ -131,8 +131,7 @@ contents of the Lisp file. Returns T if they match, or an error message." (is (eq t (literate-block-balance-check (merge-pathnames "org/core-loop.org" (uiop:ensure-directory-pathname - (or (uiop:getenv "MEMEX_DIR") - (namestring (user-homedir-pathname))))))))) + (uiop:getenv "PASSEPARTOUT_DATA_DIR"))))))) (test test-block-balance-check-missing-close "Contract 2: unbalanced parens return non-T." diff --git a/org/system-archivist.org b/org/system-archivist.org index 4a7980b..9d4b78e 100644 --- a/org/system-archivist.org +++ b/org/system-archivist.org @@ -188,7 +188,7 @@ Returns T if note was created, nil if it already exists." (return-from archivist-create-note nil)) (handler-case (progn - (uiop:with-output-file (s filepath :if-exists :nil) + (uiop:with-output-file (s filepath :if-exists nil) (format s "#+TITLE: ~a~%" title) (format s "#+FILETAGS: :atomic:note:~:[~;~{~a~^:~}~]~%" tags tags) (format s "~%* ~a~%" title) @@ -345,37 +345,37 @@ and dispatches as needed. Called by the deterministic gate." (ql:quickload :fiveam :silent t)) (defpackage :passepartout-system-archivist-tests - (:use :cl :fiveam :passepartout) + (:use :cl :passepartout) (:export #:archivist-suite)) (in-package :passepartout-system-archivist-tests) -(def-suite archivist-suite :description "Verification of the Archivist skill") -(in-suite archivist-suite) +(fiveam:def-suite archivist-suite :description "Verification of the Archivist skill") +(fiveam:in-suite archivist-suite) -(test test-extract-headlines +(fiveam:test test-extract-headlines "Contract 1: archivist-extract-headlines parses Org content." - (let* ((content "* My Headline :tag1:tag2:~%Body text here~%* Another Headline") + (let* ((content (format nil "* My Headline :tag1:tag2:~%Body text here~%* Another Headline")) (headlines (archivist-extract-headlines content))) - (is (listp headlines)) - (is (>= (length headlines) 1)))) + (fiveam:is (listp headlines)) + (fiveam:is (>= (length headlines) 1)))) -(test test-headline-to-filename +(fiveam:test test-headline-to-filename "Contract 2: archivist-headline-to-filename sanitizes titles." (let ((filename (archivist-headline-to-filename "My Project: Overview"))) - (is (search "my_project_overview" filename :test #'char-equal)) - (is (not (search ":" filename)))) + (fiveam:is (search "my_project_overview" filename :test #'char-equal)) + (fiveam:is (not (search ":" filename))))) -(test test-archivist-create-note +(fiveam:test test-archivist-create-note "Contract 3: archivist-create-note writes a Zettelkasten note to disk." (let* ((tmp-dir "/tmp/passepartout-archivist-test/") (headline (list :title "Test Note" :content "Some content" :tags '("test" "atomic")))) (uiop:ensure-all-directories-exist (list tmp-dir)) (unwind-protect (progn - (is (eq t (archivist-create-note headline tmp-dir "/tmp/source.org")) + (fiveam:is (eq t (archivist-create-note headline tmp-dir "/tmp/source.org")) "Expected note creation to return T") - (is (uiop:file-exists-p (merge-pathnames "test_note.org" tmp-dir)) + (fiveam:is (uiop:file-exists-p (merge-pathnames "test_note.org" tmp-dir)) "Expected file test_note.org to exist")) - (uiop:delete-directory-tree (uiop:ensure-directory-pathname tmp-dir) :validate t))))) + (uiop:delete-directory-tree (uiop:ensure-directory-pathname tmp-dir) :validate t)))) #+end_src \ No newline at end of file diff --git a/org/system-diagnostics.org b/org/system-diagnostics.org index fce778a..5fa1a40 100644 --- a/org/system-diagnostics.org +++ b/org/system-diagnostics.org @@ -263,8 +263,11 @@ The doctor checks all supported LLM providers and detects local Ollama instances (test test-diagnostics-dependency-fail "Contract 1: missing binaries cause diagnostics-dependencies-check to return nil." - (let ((passepartout::*diagnostics-binaries* '("non-existent-binary-123"))) - (is (null (diagnostics-dependencies-check))))) + (let* ((pkg (find-package "PASSEPARTOUT.SKILLS.SYSTEM-DIAGNOSTICS")) + (bin-var (and pkg (find-symbol "*DIAGNOSTICS-BINARIES*" pkg)))) + (when bin-var + (setf (symbol-value bin-var) '("non-existent-binary-123")) + (is (null (diagnostics-dependencies-check)))))) (test test-diagnostics-env-fail "Contract 2: diagnostics-env-check returns a boolean." @@ -274,8 +277,11 @@ The doctor checks all supported LLM providers and detects local Ollama instances (test test-diagnostics-dependency-success "Contract 1: all binaries present returns T." - (let ((passepartout::*diagnostics-binaries* '("ls"))) - (is (eq t (diagnostics-dependencies-check))))) + (let* ((pkg (find-package "PASSEPARTOUT.SKILLS.SYSTEM-DIAGNOSTICS")) + (bin-var (and pkg (find-symbol "*DIAGNOSTICS-BINARIES*" pkg)))) + (when bin-var + (setf (symbol-value bin-var) '("ls")) + (is (eq t (diagnostics-dependencies-check)))))) #+end_src * Phase E: Lifecycle