#!/bin/bash
export LC_ALL=C
python3 - <<'PY'
import json, sqlite3
db = sqlite3.connect('/tmp/n8n_copy.db')
db.row_factory = sqlite3.Row
row = db.execute("select name,nodes,connections from workflow_entity where active=1").fetchone()
nodes = json.loads(row['nodes'])
print("ACTIVE:", row['name'], f"({len(nodes)} nodes)\n")
for n in nodes:
    t = n.get('type','')
    p = n.get('parameters',{}) or {}
    short = t.split('.')[-1]
    print(f"--- {short} | {n.get('name')}")
    keys = ('model','modelId','baseURL','url','options','collectionName','topK','limit','maxIterations','timeout','systemMessage','text','jsonBody','sessionIdType','promptType')
    shown = {k: p[k] for k in keys if k in p}
    blob = json.dumps(shown, ensure_ascii=False)
    print("   ", blob[:420])
    if n.get('credentials'):
        print("    creds:", list(n['credentials'].keys()))
    print()
PY
