fix(chaos): use standard getenv for absolute tangle paths

This commit is contained in:
2026-04-28 17:57:57 -04:00
parent d787981d0d
commit d55384fb65
35 changed files with 234 additions and 234 deletions

View File

@@ -18,26 +18,26 @@ The skill strictly validates the POSIX standard paths resolved during bootstrap,
* Phase B: Protocol (Success Criteria)
** Test Suite Context
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/skills/diagnostics-tests.lisp" (expand-file-name ""))
#+begin_src lisp :tangle (concat (getenv "INSTALL_DIR") "/skills/diagnostics-tests.lisp" (expand-file-name ""))
(defpackage :opencortex-diagnostics-tests
(:use :cl :fiveam :opencortex)
(:export #:diagnostics-suite))
#+end_src
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/skills/diagnostics-tests.lisp" (expand-file-name ""))
#+begin_src lisp :tangle (concat (getenv "INSTALL_DIR") "/skills/diagnostics-tests.lisp" (expand-file-name ""))
(in-package :opencortex-diagnostics-tests)
#+end_src
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/skills/diagnostics-tests.lisp" (expand-file-name ""))
#+begin_src lisp :tangle (concat (getenv "INSTALL_DIR") "/skills/diagnostics-tests.lisp" (expand-file-name ""))
(def-suite diagnostics-suite :description "Verification of the Diagnostics skill")
#+end_src
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/skills/diagnostics-tests.lisp" (expand-file-name ""))
#+begin_src lisp :tangle (concat (getenv "INSTALL_DIR") "/skills/diagnostics-tests.lisp" (expand-file-name ""))
(in-suite diagnostics-suite)
#+end_src
** Dependency Tests
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/skills/diagnostics-tests.lisp" (expand-file-name ""))
#+begin_src lisp :tangle (concat (getenv "INSTALL_DIR") "/skills/diagnostics-tests.lisp" (expand-file-name ""))
(test test-dependency-check-fail
"Verify that missing binaries are correctly identified as failures."
(let ((opencortex::*doctor-required-binaries* '("non-existent-binary-123")))
@@ -47,12 +47,12 @@ The skill strictly validates the POSIX standard paths resolved during bootstrap,
* Phase C: Implementation (Build)
** Package Context
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
#+begin_src lisp :tangle (concat (getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
(in-package :opencortex)
#+end_src
** Skill Metadata
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
#+begin_src lisp :tangle (concat (getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
(defparameter *skill-diagnostics*
'(:name "diagnostics"
:description "Performs system health checks and environment validation."
@@ -62,13 +62,13 @@ The skill strictly validates the POSIX standard paths resolved during bootstrap,
#+end_src
** Global Configuration
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
#+begin_src lisp :tangle (concat (getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
(defvar *doctor-required-binaries* '("sbcl" "emacs" "git" "socat" "nc")
"List of external binaries required for full system operation.")
#+end_src
** Dependency Verification
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
#+begin_src lisp :tangle (concat (getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
(defun doctor-check-dependencies ()
"Verifies that required external binaries are available in the PATH via a shell probe."
(let ((all-ok t))
@@ -86,15 +86,15 @@ The skill strictly validates the POSIX standard paths resolved during bootstrap,
#+end_src
** Environment & XDG Validation
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
#+begin_src lisp :tangle (concat (getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
(defun doctor-check-env ()
"Validates XDG directories and environment configuration against the POSIX standard."
(harness-log "DOCTOR: Checking XDG environment...")
(let ((all-ok t)
(config-dir (uiop:getenv "OC_CONFIG_DIR"))
(data-dir (uiop:getenv "OC_DATA_DIR"))
(state-dir (uiop:getenv "OC_STATE_DIR"))
(memex-dir (uiop:getenv "MEMEX_DIR")))
(config-dir (getenv "OC_CONFIG_DIR"))
(data-dir (getenv "OC_DATA_DIR"))
(state-dir (getenv "OC_STATE_DIR"))
(memex-dir (getenv "MEMEX_DIR")))
(flet ((check-dir (name path critical)
(if (and path (> (length path) 0))
@@ -115,11 +115,11 @@ The skill strictly validates the POSIX standard paths resolved during bootstrap,
#+end_src
** LLM Connectivity
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
#+begin_src lisp :tangle (concat (getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
(defun doctor-check-llm ()
"Tests connectivity to primary LLM providers. Non-critical fallback allowed."
(harness-log "DOCTOR: Checking LLM connectivity...")
(let ((openrouter-key (uiop:getenv "OPENROUTER_API_KEY")))
(let ((openrouter-key (getenv "OPENROUTER_API_KEY")))
(if (and openrouter-key (> (length openrouter-key) 0))
(progn
(harness-log " [OK] OpenRouter API Key detected.")
@@ -130,7 +130,7 @@ The skill strictly validates the POSIX standard paths resolved during bootstrap,
#+end_src
** Orchestration
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
#+begin_src lisp :tangle (concat (getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
(defun doctor-run-all ()
"Executes the full diagnostic suite and returns T if system is healthy."
(harness-log "==================================================")
@@ -150,7 +150,7 @@ The skill strictly validates the POSIX standard paths resolved during bootstrap,
#+end_src
** CLI Entry Point
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
#+begin_src lisp :tangle (concat (getenv "INSTALL_DIR") "/skills/org-skill-diagnostics.lisp" (expand-file-name ""))
(defun doctor-main ()
"Entry point for the 'doctor' CLI command."
(if (doctor-run-all)