Files
memex/projects/org-skill-scribe/tests/simulate_scribe.py

43 lines
1.6 KiB
Python

import os
import re
def simulate_distill(title, content, source):
filename = title.lower().replace(" ", "_") + ".org"
target_path = os.path.join("notes", filename)
# Mocking the note creation
note_content = f"#+TITLE: {title}\n#+ID: mock-id\n\nSource: [[file:{source}]]\n\n{content}"
# In simulation, we just verify the content structure
if f"Source: [[file:{source}]]" in note_content and title in note_content:
return target_path
return None
def simulate_audit(project_path):
violations = []
if not os.path.exists(os.path.join(project_path, "PRD.org")):
violations.append("MISSING_PRD")
if not os.path.exists(os.path.join(project_path, "PROTOCOL.org")):
violations.append("MISSING_PROTOCOL")
return violations
if __name__ == "__main__":
# Test 1: Distillation
path = simulate_distill("Lisp Sovereignty", "Control the code.", "daily/2026-03-31.org")
print(f"--- Test: Distillation ---")
print(f"Target Path: {path}")
print(f"Status: {'PASS' if path == 'notes/lisp_sovereignty.org' else 'FAIL'}")
# Test 2: Audit (Current Project)
print(f"\n--- Test: Audit (org-skill-scribe) ---")
violations = simulate_audit("projects/org-skill-scribe")
print(f"Violations: {violations}")
print(f"Status: {'PASS' if not violations else 'FAIL'}")
# Test 3: Audit (A broken project if exists)
# We'll just mock a non-existent one
print(f"\n--- Test: Audit (Non-existent) ---")
violations = simulate_audit("projects/missing-project")
print(f"Violations: {violations}")
print(f"Status: {'PASS' if 'MISSING_PRD' in violations else 'FAIL'}")