All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 4s
87 lines
2.7 KiB
Python
87 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
FILE: scripts/debug_note_payload.py
|
|
VERSION: 2.1.0 (2025-12-15)
|
|
STATUS: Active (Debug-Tool)
|
|
COMPATIBILITY: v2.9.1 (Post-WP14/WP-15b)
|
|
|
|
Zweck:
|
|
-------
|
|
Debug-Tool zur Analyse der Note-Payload-Erzeugung.
|
|
Zeigt, welches Modul geladen wird und die erzeugte Payload-Struktur.
|
|
|
|
Funktionsweise:
|
|
---------------
|
|
1. Lädt Note-Payload-Modul
|
|
2. Liest Markdown-Datei
|
|
3. Ruft make_note_payload auf
|
|
4. Zeigt Modul-Pfad, Rückgabe-Typ und Payload-Inhalt
|
|
|
|
Ergebnis-Interpretation:
|
|
------------------------
|
|
- Ausgabe: Debug-Informationen
|
|
* module_path: Pfad zum geladenen Modul
|
|
* return_type: Typ der Rückgabe
|
|
* keys: Liste der Payload-Keys (falls Dict)
|
|
* JSON: Vollständige Payload (falls Dict)
|
|
|
|
Verwendung:
|
|
-----------
|
|
- Debugging von Payload-Erzeugungsproblemen
|
|
- Validierung der Modul-Ladung
|
|
- Analyse der Payload-Struktur
|
|
|
|
Hinweise:
|
|
---------
|
|
- Nutzt app.core.ingestion.ingestion_note_payload (nicht mehr app.core.note_payload)
|
|
- Zeigt vollständige Payload-Struktur
|
|
|
|
Aufruf:
|
|
-------
|
|
python3 -m scripts.debug_note_payload --file ./vault/note.md --vault-root ./vault
|
|
|
|
Parameter:
|
|
----------
|
|
--file PATH Pfad zur Markdown-Datei (erforderlich)
|
|
--vault-root PATH Vault-Root für relative Pfade (optional)
|
|
--hash-mode MODE Hash-Modus (optional)
|
|
--hash-normalize N Hash-Normalisierung (optional)
|
|
--hash-source SRC Hash-Quelle (optional)
|
|
|
|
Änderungen:
|
|
-----------
|
|
v2.1.0 (2025-12-15): Kompatibilität mit WP-14 Modularisierung
|
|
- Geändert: app.core.note_payload → app.core.ingestion.ingestion_note_payload
|
|
v1.0.0: Initial Release
|
|
"""
|
|
import argparse, json, os, pprint
|
|
from app.core.ingestion import ingestion_note_payload as np
|
|
from app.core.parser import read_markdown
|
|
|
|
def main():
|
|
ap = argparse.ArgumentParser()
|
|
ap.add_argument("--file", required=True)
|
|
ap.add_argument("--vault-root", default=None)
|
|
ap.add_argument("--hash-mode", default=None)
|
|
ap.add_argument("--hash-normalize", default=None)
|
|
ap.add_argument("--hash-source", default=None)
|
|
args = ap.parse_args()
|
|
|
|
print("module_path:", getattr(np, "__file__", "<unknown>"))
|
|
parsed = read_markdown(args.file)
|
|
res = np.make_note_payload(parsed, vault_root=args.vault_root,
|
|
hash_normalize=args.hash_normalize,
|
|
hash_source=args.hash_source,
|
|
file_path=args.file)
|
|
print("return_type:", type(res).__name__)
|
|
if isinstance(res, dict):
|
|
print("keys:", list(res.keys()))
|
|
print(json.dumps(res, ensure_ascii=False, indent=2))
|
|
else:
|
|
preview = repr(res)
|
|
if len(preview) > 600: preview = preview[:600] + "…"
|
|
print("preview:", preview)
|
|
|
|
if __name__ == "__main__":
|
|
main() |