From 13e50d46956f35af285ee7e26688d6d29ea49053 Mon Sep 17 00:00:00 2001 From: Lars Date: Tue, 9 Sep 2025 16:47:13 +0200 Subject: [PATCH] =?UTF-8?q?scripts/debug=5Fnote=5Fpayload.py=20hinzugef?= =?UTF-8?q?=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/debug_note_payload.py | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 scripts/debug_note_payload.py diff --git a/scripts/debug_note_payload.py b/scripts/debug_note_payload.py new file mode 100644 index 0000000..333bc66 --- /dev/null +++ b/scripts/debug_note_payload.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +scripts/debug_note_payload.py +Zeigt, welche app.core.note_payload geladen wird, ruft make_note_payload auf +und druckt Typ/Preview der Rückgabe. + +Aufruf: + python3 -m scripts.debug_note_payload --file ./test_vault/40_concepts/concept-alpha.md --vault-root ./test_vault +""" +import argparse, json, os, pprint +from app.core import 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__", "")) + parsed = read_markdown(args.file) + res = np.make_note_payload(parsed, vault_root=args.vault_root, + hash_mode=args.hash_mode, + 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()