refactor: Flatten directory structure library->harness, library/gen->skills

This commit is contained in:
2026-04-27 08:41:26 -04:00
parent 43dbe3cf2d
commit 664ba8243d
68 changed files with 637 additions and 666 deletions

View File

@@ -58,14 +58,14 @@ Single entry point `emacs-edit-modify` takes a file path, operation, and paramet
* Phase D: Build (Implementation)
** Package Context
#+begin_src lisp :tangle ../library/gen/org-skill-emacs-edit.lisp
#+begin_src lisp :tangle ./org-skill-emacs-edit.lisp
(in-package :opencortex)
#+end_src
** ID Generation
Generate unique IDs for headlines.
#+begin_src lisp :tangle ../library/gen/org-skill-emacs-edit.lisp
#+begin_src lisp :tangle ./org-skill-emacs-edit.lisp
(defun emacs-edit-generate-id ()
"Generates a unique ID for org-mode headlines.
Format: 8-char hex + timestamp for uniqueness."
@@ -84,7 +84,7 @@ Format: 8-char hex + timestamp for uniqueness."
** Org Printer (AST → Org Format)
Converts AST back to org format, preserving structure.
#+begin_src lisp :tangle ../library/gen/org-skill-emacs-edit.lisp
#+begin_src lisp :tangle ./org-skill-emacs-edit.lisp
(defun emacs-edit-print-headline (ast &key indent-level)
"Converts a HEADLINE AST node to org text.
INDENT-LEVEL is number of leading asterisks."
@@ -154,7 +154,7 @@ Preserves structure including #+begin_src blocks."
** Read Operation
Parse org file to AST.
#+begin_src lisp :tangle ../library/gen/org-skill-emacs-edit.lisp
#+begin_src lisp :tangle ./org-skill-emacs-edit.lisp
(defvar *org-parser-cache* (make-hash-table :test 'equal)
"Cache for parsed org files.")
@@ -180,7 +180,7 @@ Returns the parsed AST. Uses cache for performance."
** Write Operation
Write AST back to file preserving structure.
#+begin_src lisp :tangle ../library/gen/org-skill-emacs-edit.lisp
#+begin_src lisp :tangle ./org-skill-emacs-edit.lisp
(defun emacs-edit-write-file (file-path ast)
"Writes AST back to FILE-PATH, preserving org structure.
Clears cache after write."
@@ -194,7 +194,7 @@ Clears cache after write."
** Add Headline Operation
Add a new headline to an existing AST.
#+begin_src lisp :tangle ../library/gen/org-skill-emacs-edit.lisp
#+begin_src lisp :tangle ./org-skill-emacs-edit.lisp
(defun emacs-edit-add-headline (ast title &key todo properties)
"Adds a new headline to AST.
Returns modified AST."
@@ -223,7 +223,7 @@ Returns modified AST."
** Set Property Operation
Set a property on an existing headline (by ID or TITLE).
#+begin_src lisp :tangle ../library/gen/org-skill-emacs-edit.lisp
#+begin_src lisp :tangle ./org-skill-emacs-edit.lisp
(defun emacs-edit-find-headline-by-id (ast target-id)
"Recursively finds headline with matching :ID: property."
(when (eq (getf ast :type) :headline)
@@ -267,7 +267,7 @@ Returns modified AST."
** Set TODO State Operation
Change TODO state (TODO → DONE → etc).
#+begin_src lisp :tangle ../library/gen/org-skill-emacs-edit.lisp
#+begin_src lisp :tangle ./org-skill-emacs-edit.lisp
(defun emacs-edit-set-todo (ast target new-state)
"Sets TODO state on headline matching TARGET.
NEW-STATE should be 'TODO', 'DONE', 'IN-PROGRESS', etc."
@@ -278,7 +278,7 @@ NEW-STATE should be 'TODO', 'DONE', 'IN-PROGRESS', etc."
** Unified Entry Point
Main operation dispatcher.
#+begin_src lisp :tangle ../library/gen/org-skill-emacs-edit.lisp
#+begin_src lisp :tangle ./org-skill-emacs-edit.lisp
(defun emacs-edit-modify (file-path operation &key params)
"Main entry point for org-mode file manipulation.
OPERATIONS:
@@ -321,7 +321,7 @@ OPERATIONS:
** Cognitive Tools
Exposes operations to the Probabilistic Engine.
#+begin_src lisp :tangle ../library/gen/org-skill-emacs-edit.lisp
#+begin_src lisp :tangle ./org-skill-emacs-edit.lisp
(def-cognitive-tool :org-read
"Reads an org-mode file and parses it to structured AST.
Use this BEFORE modifying org files to understand their structure."
@@ -388,7 +388,7 @@ Use this AFTER modifications to save changes."
#+end_src
* Phase E: Chaos (Verification)
#+begin_src lisp :tangle ../tests/emacs-edit-tests.lisp
#+begin_src lisp :tangle ./tests/emacs-edit-tests.lisp
(defpackage :opencortex-emacs-edit-tests
(:use :cl :fiveam :opencortex)
(:export #:emacs-edit-suite))