diff options
Diffstat (limited to 'claude_logbook')
| -rw-r--r-- | claude_logbook/__init__.py | 2 | ||||
| -rw-r--r-- | claude_logbook/cli.py | 222 | ||||
| -rw-r--r-- | claude_logbook/memory.py | 18 | ||||
| -rw-r--r-- | claude_logbook/sessions.py | 8 | ||||
| -rw-r--r-- | claude_logbook/template.html | 246 | ||||
| -rw-r--r-- | claude_logbook/terminal.py | 74 | ||||
| -rw-r--r-- | claude_logbook/webpage.py | 14 |
7 files changed, 292 insertions, 292 deletions
diff --git a/claude_logbook/__init__.py b/claude_logbook/__init__.py index 0929294..077c904 100644 --- a/claude_logbook/__init__.py +++ b/claude_logbook/__init__.py @@ -3,6 +3,6 @@ No dependencies: standard library only. """ -__version__ = "1.1.0" +__version__ = "1.2.0" __all__ = ["__version__"] diff --git a/claude_logbook/cli.py b/claude_logbook/cli.py index bf1a1af..6b1ebc2 100644 --- a/claude_logbook/cli.py +++ b/claude_logbook/cli.py @@ -20,101 +20,101 @@ from .terminal import ( from . import memory as mem from . import webpage -DEFAULT_HTML = "sesiones.html" +DEFAULT_HTML = "sessions.html" # A session written less than this long ago may be open in another terminal. RECENT_SECONDS = 300 EPILOG = """\ -ejemplos: - claude-logbook tabla de todas las sesiones - claude-logbook docker filtra por título, ruta o rama - claude-logbook -s 3 lee el chat nº 3 de la tabla - claude-logbook -s 5d10f1ee lo mismo, por prefijo de UUID - claude-logbook -g "port already" busca dentro de las conversaciones - claude-logbook -r 3 comando para reanudar la nº 3 - eval "$(claude-logbook -r 3)" reanudarla directamente - claude-logbook --html --open genera sesiones.html y lo abre - -el nº es la posición en la tabla que estás viendo, así que si filtraste -hay que repetir el filtro para leer esa fila: - - claude-logbook docker muestra 3 resultados - claude-logbook docker -s 2 lee el 2º de esos tres - -borrado (irreversible; pregunta antes, salvo con -y): - claude-logbook --delete-empty --dry-run qué borraría - claude-logbook --delete-empty borra las vacías - claude-logbook -D 101 -D e0a4300e borra sesiones puntuales - claude-logbook -p /tmp --delete-empty solo las vacías de ese proyecto - -memoria de los proyectos (-m cambia de sesiones a memorias y reusa los mismos -verbos: filtro, -s para leer, -D para borrar): - claude-logbook -m tabla de memorias - claude-logbook -m docker busca en nombre, descripción y cuerpo - claude-logbook -m -s 3 lee la memoria nº 3 - claude-logbook -m -s deadlock lo mismo, por nombre - claude-logbook -m --check audita índices, enlaces y orígenes - claude-logbook -m -D 3 la borra y la saca de MEMORY.md +examples: + claude-logbook table of every session + claude-logbook docker filter by title, path or branch + claude-logbook -s 3 read chat #3 from the table + claude-logbook -s 5d10f1ee same, by UUID prefix + claude-logbook -g "port already" search inside the conversations + claude-logbook -r 3 command to resume #3 + eval "$(claude-logbook -r 3)" resume it right away + claude-logbook --html --open write sessions.html and open it + +the # is the position in the table you are looking at, so if you filtered +you have to repeat the filter to read that row: + + claude-logbook docker shows 3 results + claude-logbook docker -s 2 reads the 2nd of those three + +deleting (irreversible; asks first unless -y): + claude-logbook --delete-empty --dry-run what it would delete + claude-logbook --delete-empty delete the empty ones + claude-logbook -D 101 -D e0a4300e delete specific sessions + claude-logbook -p /tmp --delete-empty only the empty ones in that project + +project memory (-m switches from sessions to memories and reuses the same +verbs: filter, -s to read, -D to delete): + claude-logbook -m table of memories + claude-logbook -m docker search name, description and body + claude-logbook -m -s 3 read memory #3 + claude-logbook -m -s deadlock same, by name + claude-logbook -m --check audit indexes, links and sources + claude-logbook -m -D 3 delete it and drop it from MEMORY.md """ def build_parser(): ap = argparse.ArgumentParser( prog="claude-logbook", - description="Explorador de sesiones de Claude Code para la terminal.", + description="Claude Code session browser for the terminal.", formatter_class=argparse.RawDescriptionHelpFormatter, epilog=textwrap.dedent(EPILOG), ) - ap.add_argument("query", nargs="*", help="texto a buscar en título, ruta o rama") + ap.add_argument("query", nargs="*", help="text to search in title, path or branch") ap.add_argument("-s", "--show", metavar="REF", - help="muestra el chat: índice de la tabla o prefijo de UUID") + help="show the chat: table index or UUID prefix") ap.add_argument("-r", "--resume", metavar="REF", - help="imprime el comando para reanudar esa sesión") - ap.add_argument("-g", "--grep", metavar="TEXTO", - help="filtra por contenido de las conversaciones") - ap.add_argument("-p", "--project", metavar="RUTA", - help="filtra por ruta del proyecto") + help="print the command to resume that session") + ap.add_argument("-g", "--grep", metavar="TEXT", + help="filter by conversation content") + ap.add_argument("-p", "--project", metavar="PATH", + help="filter by project path") ap.add_argument("-n", "--limit", type=int, metavar="N", - help="muestra solo las N más recientes") + help="show only the N most recent") ap.add_argument("-E", "--hide-empty", action="store_true", - help="oculta las sesiones sin mensajes") + help="hide sessions with no messages") ap.add_argument("--no-tools", action="store_true", - help="en el chat, oculta las llamadas a herramientas") + help="hide tool calls in the chat") ap.add_argument("--no-pager", action="store_true", - help="no usa $PAGER para el chat") - ap.add_argument("--no-color", action="store_true", help="salida sin color") + help="do not use $PAGER for the chat") + ap.add_argument("--no-color", action="store_true", help="plain output, no color") - memories_list = ap.add_argument_group("memoria de los proyectos") + memories_list = ap.add_argument_group("project memory") memories_list.add_argument("-m", "--memory", action="store_true", - help="trabaja sobre las memorias en vez de las sesiones") - memories_list.add_argument("--type", metavar="TIPO", choices=mem.TYPES, - help="filtra por tipo: " + " | ".join(mem.TYPES)) + help="work on memories instead of sessions") + memories_list.add_argument("--type", metavar="TYPE", choices=mem.TYPES, + help="filter by type: " + " | ".join(mem.TYPES)) memories_list.add_argument("--check", action="store_true", - help="audita índices, enlaces y sesiones de origen") + help="audit indexes, links and source sessions") - output_path = ap.add_argument_group("exportar") + output_path = ap.add_argument_group("export") output_path.add_argument("--json", action="store_true", - help="vuelca todas las sesiones en JSON") - output_path.add_argument("--html", nargs="?", const=DEFAULT_HTML, metavar="ARCHIVO", - help=f"genera una página autocontenida (por defecto {DEFAULT_HTML})") - output_path.add_argument("--template", metavar="ARCHIVO", - help="usa otro template para --html") + help="dump every session as JSON") + output_path.add_argument("--html", nargs="?", const=DEFAULT_HTML, metavar="FILE", + help=f"write a self-contained page (default {DEFAULT_HTML})") + output_path.add_argument("--template", metavar="FILE", + help="use another template for --html") output_path.add_argument("--open", action="store_true", - help="abre en el navegador lo que genere --html") + help="open what --html writes in the browser") - delete_items = ap.add_argument_group("borrado") + delete_items = ap.add_argument_group("delete") delete_items.add_argument("-D", "--delete", metavar="REF", nargs="+", - help="borra esas sesiones (índice o prefijo de UUID)") + help="delete those sessions (index or UUID prefix)") delete_items.add_argument("--delete-empty", action="store_true", - help="borra todas las sesiones sin mensajes") + help="delete every session with no messages") delete_items.add_argument("-y", "--yes", action="store_true", - help="no pregunta antes de borrar") + help="do not ask before deleting") delete_items.add_argument("--dry-run", action="store_true", - help="muestra qué se borraría y no toca nada") + help="show what would be deleted and touch nothing") ap.add_argument("--no-cache", action="store_true", - help="ignora el caché y re-parsea todo") + help="ignore the cache and re-parse everything") ap.add_argument("--version", action="version", version=f"claude-logbook {__version__}") return ap @@ -141,7 +141,7 @@ def confirm(question): try: sys.stderr.write(question) sys.stderr.flush() - return tty.readline().strip().lower() in ("s", "si", "sí", "y", "yes") + return tty.readline().strip().lower() in ("y", "yes") except (OSError, KeyboardInterrupt): return False finally: @@ -151,45 +151,45 @@ def confirm(question): def delete_sessions(targets, args, st): """Deletes the given sessions. Returns the exit code.""" if not targets: - print("No hay sesiones que borrar con ese criterio.", file=sys.stderr) + print("No sessions to delete with those criteria.", file=sys.stderr) return 0 - print(f"{st.bold}Se van a borrar " - f"{plural(len(targets), 'sesión', 'sesiones')}:{st.reset}\n") + print(f"{st.bold}About to delete " + f"{plural(len(targets), 'session', 'sessions')}:{st.reset}\n") total_kb = 0 recent = [] for s in targets: path = session_path(s) total_kb += s["k"] - title = s["t"] or "sesión abierta sin mensajes" + title = s["t"] or "session opened with no messages" flag = "" try: if time.time() - os.stat(path).st_mtime < RECENT_SECONDS: recent.append(s) - flag = f" {st.copper}← modificada hace menos de 5 min{st.reset}" + flag = f" {st.copper}← modified less than 5 min ago{st.reset}" except OSError: - flag = f" {st.copper}← ya no existe{st.reset}" + flag = f" {st.copper}← no longer exists{st.reset}" print(f" {st.faint}{s['id'][:8]}{st.reset} {clip(title, 52):<52} " f"{st.grey}{clip(s['p'], 34):<34}{st.reset} " f"{fmt_date(s['l'])} {st.faint}{s['k']:>7.1f} KB{st.reset}{flag}") - print(f"\n{st.faint}{fmt_size(total_kb)} en total{st.reset}") + print(f"\n{st.faint}{fmt_size(total_kb)} in total{st.reset}") if recent: - verb = "se escribió" if len(recent) == 1 else "se escribieron" - print(f"\n{st.copper}Ojo: {len(recent)} de estas {verb} hace menos de " - f"5 minutos. Si es una sesión abierta ahora mismo, Claude Code la " - f"sigue usando y va a volver a escribirla al cerrarse.{st.reset}") + verb = "was" if len(recent) == 1 else "were" + print(f"\n{st.copper}Careful: {len(recent)} of these {verb} written less than " + f"5 minutes ago. If one is a session open right now, Claude Code is " + f"still using it and will write it again when it closes.{st.reset}") if args.dry_run: - print(f"\n{st.faint}--dry-run: no se tocó nada.{st.reset}") + print(f"\n{st.faint}--dry-run: nothing was touched.{st.reset}") return 0 if not args.yes: - print(f"\n{st.copper}Esto no se puede deshacer.{st.reset}") - if not confirm("¿Confirmás? [s/N] "): - print("Cancelado.", file=sys.stderr) + print(f"\n{st.copper}This cannot be undone.{st.reset}") + if not confirm("Confirm? [y/N] "): + print("Cancelled.", file=sys.stderr) return 1 done, failed, paths = 0, 0, [] @@ -205,7 +205,7 @@ def delete_sessions(targets, args, st): drop_from_cache(paths) - print(f"\n{plural(done, 'sesión borrada', 'sesiones borradas')}.") + print(f"\n{plural(done, 'session deleted', 'sessions deleted')}.") return 1 if failed else 0 @@ -245,9 +245,9 @@ def cmd_html(sessions, args): memories = mem.public_records(mem.load_memories(sessions)) stats = webpage.write(public_records(sessions), out, memories=memories, template=webpage.template_text(args.template)) - print(f"{stats['sesiones']} sesiones · {stats['proyectos']} proyectos · " - f"{stats['mensajes']} mensajes · {stats['bloques']} bloques " - f"de transcripción · {stats['memorias']} memorias → {out}", + print(f"{stats['sessions']} sessions · {stats['projects']} projects · " + f"{stats['messages']} messages · {stats['blocks']} transcript " + f"blocks · {stats['memories']} memories → {out}", file=sys.stderr) if args.open: webbrowser.open("file://" + os.path.abspath(out)) @@ -270,7 +270,7 @@ def cmd_show(sessions, args, st): def cmd_table(sessions, args, st): shown = filtered(sessions, args) if not shown: - print("Ninguna sesión coincide con ese filtro.", file=sys.stderr) + print("No session matches that filter.", file=sys.stderr) return 1 if args.limit: shown = shown[: args.limit] @@ -278,10 +278,10 @@ def cmd_table(sessions, args, st): print_table(shown, st, latest_activity(sessions), sys.stdout) total, projects = len(sessions), len({s["p"] for s in sessions}) - tail = (f"{len(shown)} de {total} sesiones" if len(shown) != total - else f"{plural(total, 'sesión', 'sesiones')} · " - f"{plural(projects, 'proyecto', 'proyectos')}") - print(f"\n{st.faint}{tail} · -s <nº> para leer una{st.reset}") + tail = (f"{len(shown)} of {total} sessions" if len(shown) != total + else f"{plural(total, 'session', 'sessions')} · " + f"{plural(projects, 'project', 'projects')}") + print(f"\n{st.faint}{tail} · -s <#> to read one{st.reset}") return 0 @@ -308,22 +308,22 @@ def cmd_mem_check(memories, sessions, st): report = mem.audit(memories, sessions) total = print_audit(report, st, sys.stdout) if total: - print(f"{st.faint}{plural(total, 'cosa para mirar', 'cosas para mirar')} " - f"en {plural(len(memories), 'memoria', 'memorias')}.{st.reset}") + print(f"{st.faint}{plural(total, 'thing to look at', 'things to look at')} " + f"across {plural(len(memories), 'memory', 'memories')}.{st.reset}") return 1 - print(f"{st.amber}Todo en orden: " - f"{plural(len(memories), 'memoria', 'memorias')}, " - f"índices y enlaces consistentes.{st.reset}") + print(f"{st.amber}All good: " + f"{plural(len(memories), 'memory', 'memories')}, " + f"indexes and links consistent.{st.reset}") return 0 def delete_memories(targets, args, st): if not targets: - print("No hay memorias que borrar con ese criterio.", file=sys.stderr) + print("No memories to delete with those criteria.", file=sys.stderr) return 0 - print(f"{st.bold}Se van a borrar " - f"{plural(len(targets), 'memoria', 'memorias')}:{st.reset}\n") + print(f"{st.bold}About to delete " + f"{plural(len(targets), 'memory', 'memories')}:{st.reset}\n") total_kb = 0 for m in targets: total_kb += m["k"] @@ -334,17 +334,17 @@ def delete_memories(targets, args, st): if m["desc"]: print(f" {st.faint}{clip(m['desc'], 86)}{st.reset}") - print(f"\n{st.faint}{fmt_size(total_kb)} en total · " - f"también se quita su línea de MEMORY.md{st.reset}") + print(f"\n{st.faint}{fmt_size(total_kb)} in total · " + f"their MEMORY.md lines are removed too{st.reset}") if args.dry_run: - print(f"\n{st.faint}--dry-run: no se tocó nada.{st.reset}") + print(f"\n{st.faint}--dry-run: nothing was touched.{st.reset}") return 0 if not args.yes: - print(f"\n{st.copper}Esto no se puede deshacer.{st.reset}") - if not confirm("¿Confirmás? [s/N] "): - print("Cancelado.", file=sys.stderr) + print(f"\n{st.copper}This cannot be undone.{st.reset}") + if not confirm("Confirm? [y/N] "): + print("Cancelled.", file=sys.stderr) return 1 done = failed = unlisted = 0 @@ -357,31 +357,31 @@ def delete_memories(targets, args, st): print(f"error: {m['name']}: {e}", file=sys.stderr) failed += 1 - extra = f", {unlisted} sacadas del índice" if unlisted else "" - print(f"\n{plural(done, 'memoria borrada', 'memorias borradas')}{extra}.") + extra = f", {unlisted} removed from the index" if unlisted else "" + print(f"\n{plural(done, 'memory deleted', 'memories deleted')}{extra}.") return 1 if failed else 0 def cmd_mem_table(memories, args, st, total): if not memories: - print("Ninguna memoria coincide con ese filtro.", file=sys.stderr) + print("No memory matches that filter.", file=sys.stderr) return 1 shown = memories[: args.limit] if args.limit else memories print_memories(shown, st, latest_activity(shown), sys.stdout) projects = len({m["p"] for m in memories}) - tail = (f"{len(shown)} de {total} memorias" if len(shown) != total - else f"{plural(total, 'memoria', 'memorias')} · " - f"{plural(projects, 'proyecto', 'proyectos')}") - print(f"\n{st.faint}{tail} · -m -s <nº> para leer una{st.reset}") + tail = (f"{len(shown)} of {total} memories" if len(shown) != total + else f"{plural(total, 'memory', 'memories')} · " + f"{plural(projects, 'project', 'projects')}") + print(f"\n{st.faint}{tail} · -m -s <#> to read one{st.reset}") return 0 def run_memory(sessions, args, st): memories = mem.load_memories(sessions) if not memories: - print("Ningún proyecto tiene memorias todavía.", file=sys.stderr) + print("No project has memories yet.", file=sys.stderr) return 1 if args.check: @@ -406,13 +406,13 @@ def run_memory(sessions, args, st): def run(args): root = default_root() if not os.path.isdir(root): - print(f"error: no existe {root} — ¿usaste Claude Code en esta máquina?", + print(f"error: {root} does not exist — have you used Claude Code on this machine?", file=sys.stderr) return 2 sessions = load_sessions(root=root, use_cache=not args.no_cache) if not sessions: - print("No hay ninguna sesión registrada todavía.", file=sys.stderr) + print("No sessions recorded yet.", file=sys.stderr) return 1 st = Style.from_stream(sys.stdout, args.no_color) diff --git a/claude_logbook/memory.py b/claude_logbook/memory.py index 955628c..a1b027d 100644 --- a/claude_logbook/memory.py +++ b/claude_logbook/memory.py @@ -192,7 +192,7 @@ def pick(memories, ref): if 1 <= i <= len(memories): return memories[i - 1] raise SessionError( - f"el índice {i} está fuera de rango (hay {len(memories)} memorias)") + f"index {i} is out of range (there are {len(memories)} memories)") needle = ref.lower() hits = [m for m in memories if m["name"].lower().startswith(needle)] @@ -201,10 +201,10 @@ def pick(memories, ref): if len(hits) == 1: return hits[0] if not hits: - raise SessionError(f"ninguna memoria coincide con '{ref}'") + raise SessionError(f"no memory matches '{ref}'") name_list = ", ".join(m["name"] for m in hits[:4]) raise SessionError( - f"'{ref}' es ambiguo, coincide con {len(hits)}: {name_list}" + f"'{ref}' is ambiguous, it matches {len(hits)}: {name_list}" + (", …" if len(hits) > 4 else "")) @@ -216,20 +216,20 @@ def audit(memories, sessions, root=None): session_ids = {s["id"] for s in sessions} report = { - "sin_indice": [m for m in memories if not m["hix"]], - "sin_listar": [m for m in memories if m["hix"] and not m["ix"]], - "enlaces_rotos": [(m, link) for m in memories + "no_index": [m for m in memories if not m["hix"]], + "unlisted": [m for m in memories if m["hix"] and not m["ix"]], + "broken_links": [(m, link) for m in memories for link in m["ln"] if link not in known], - "origen_perdido": [m for m in memories + "lost_source": [m for m in memories if m["src"] and m["src"] not in session_ids], - "indice_fantasma": [], + "ghost_entries": [], } for project_dir in sorted({m["project_dir"] for m in memories if m["hix"]}): real = {m["file"][:-3] for m in memories if m["project_dir"] == project_dir} for missing in sorted(read_index(project_dir, root) - real): - report["indice_fantasma"].append((project_dir, missing)) + report["ghost_entries"].append((project_dir, missing)) return report diff --git a/claude_logbook/sessions.py b/claude_logbook/sessions.py index e4fa9b2..63b4886 100644 --- a/claude_logbook/sessions.py +++ b/claude_logbook/sessions.py @@ -142,7 +142,7 @@ def parse_ts(ts): def read_session(path): """Parses a whole .jsonl and returns that session's record.""" - session_id = os.path.basename(path)[:-6] # sin .jsonl + session_id = os.path.basename(path)[:-6] # without .jsonl first_ts = last_ts = cwd = git_branch = version = None ai_title = fallback_title = None user_msgs = assistant_msgs = 0 @@ -399,11 +399,11 @@ def pick(sessions, ref): if 1 <= i <= len(sessions): return sessions[i - 1] raise SessionError( - f"el índice {i} está fuera de rango (hay {len(sessions)})") + f"index {i} is out of range (there are {len(sessions)})") hits = [s for s in sessions if s["id"].startswith(ref.lower())] if len(hits) == 1: return hits[0] if not hits: - raise SessionError(f"ninguna sesión empieza con '{ref}'") - raise SessionError(f"'{ref}' es ambiguo, coincide con {len(hits)} sesiones") + raise SessionError(f"no session starts with '{ref}'") + raise SessionError(f"'{ref}' is ambiguous, it matches {len(hits)} sessions") diff --git a/claude_logbook/template.html b/claude_logbook/template.html index 7c8ba76..c018320 100644 --- a/claude_logbook/template.html +++ b/claude_logbook/template.html @@ -1,18 +1,18 @@ <!doctype html> -<html lang="es"> +<html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="color-scheme" content="light dark"> <meta name="robots" content="noindex, nofollow"> -<title>Sesiones de Claude Code</title> +<title>Claude Code sessions</title> <script> - // Corre antes del primer pintado para que el tema elegido no parpadee: - // primero la preferencia guardada, si no la del sistema. + // Runs before the first paint so the chosen theme does not flicker: + // the saved preference first, otherwise the system one. (function () { var saved = null; - try { saved = localStorage.getItem('cs-tema'); } catch (e) {} + try { saved = localStorage.getItem('cl-theme'); } catch (e) {} var dark = saved ? saved === 'dark' : matchMedia('(prefers-color-scheme: dark)').matches; document.documentElement.dataset.theme = dark ? 'dark' : 'light'; @@ -20,9 +20,9 @@ </script> <style> - /* Una paleta por tema y nada más: el data-theme lo pone el script de arriba - antes de pintar, así que no hace falta repetir los valores dentro de una - @media. El botón del toolbar cambia ese mismo atributo. */ + /* One palette per theme and nothing else: data-theme is set by the script + above before painting, so there is no need to repeat the values inside an + @media. The toolbar button toggles that same attribute. */ :root, :root[data-theme="light"] { --ground: #EDEEF2; @@ -237,7 +237,7 @@ outline-offset: 1px; } - /* ---------- tabla ---------- */ + /* ---------- table ---------- */ .grid { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); } @@ -367,7 +367,7 @@ .none { padding: 48px 20px; text-align: center; color: var(--muted); font-family: var(--mono); font-size: 13px; } .count { font-family: var(--mono); font-size: 11.5px; color: var(--faint); padding: 10px 2px 0; letter-spacing: .04em; } - /* ---------- lector ---------- */ + /* ---------- reader ---------- */ .scrim { position: fixed; @@ -570,7 +570,7 @@ .reader { width: 100%; border-left: 0; } } - /* ---------- pestañas y memorias ---------- */ + /* ---------- tabs and memories ---------- */ .tabs { display: flex; @@ -639,7 +639,7 @@ .ty-feedback { color: var(--copper, var(--amber)); border-color: var(--amber-lo); } .ty-reference { color: var(--muted); } - /* Una memoria fuera de MEMORY.md sigue en disco pero no se carga en contexto. */ + /* A memory missing from MEMORY.md is still on disk but is not loaded into context. */ .chip-unlisted { color: var(--amber); border-color: var(--amber-lo); background: var(--amber-bg); } .mem-body { @@ -727,22 +727,22 @@ <div class="wrap"> <header class="masthead"> <span class="eyebrow">~/.claude/projects</span> - <h1>Tus sesiones de Claude Code</h1> - <p class="lede">Cada conversación queda en un <code>.jsonl</code> local. Hacé clic en cualquier fila para leerla, o copiá el comando para retomarla — el <code>--resume</code> solo encuentra la sesión desde su directorio original, así que el botón copia el <code>cd</code> también.</p> + <h1>Your Claude Code sessions</h1> + <p class="lede">Every conversation is kept in a local <code>.jsonl</code>. Click any row to read it, or copy the command to pick it up again — <code>--resume</code> only finds the session from its original directory, so the button copies the <code>cd</code> too.</p> </header> <noscript> - <p class="noscript">Esta página arma la lista con JavaScript. Con JavaScript - desactivado no se ve nada — los datos igual están adentro del archivo, en el + <p class="noscript">This page builds the list with JavaScript. With JavaScript + disabled nothing shows up — the data is still inside the file, in the <code><script id="payload"></code>.</p> </noscript> - <div class="tabs" role="tablist" aria-label="Qué mirar"> + <div class="tabs" role="tablist" aria-label="What to browse"> <button type="button" class="tab" role="tab" data-mode="s" aria-selected="true"> - Sesiones <span class="n" id="nS"></span> + Sessions <span class="n" id="nS"></span> </button> <button type="button" class="tab" role="tab" data-mode="m" aria-selected="false"> - Memorias <span class="n" id="nM"></span> + Memories <span class="n" id="nM"></span> </button> </div> @@ -751,34 +751,34 @@ <div class="toolbar"> <div class="field"> <svg width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6"><circle cx="7" cy="7" r="4.5"/><path d="M10.5 10.5 14 14"/></svg> - <input type="search" id="q" placeholder="buscar título, ruta o uuid… (/)" autocomplete="off" spellcheck="false" aria-label="Buscar sesiones"> + <input type="search" id="q" placeholder="search title, path or uuid… (/)" autocomplete="off" spellcheck="false" aria-label="Search sessions"> </div> - <select id="proj" aria-label="Filtrar por proyecto"></select> - <label class="toggle only-s"><input type="checkbox" id="deep"> buscar dentro del chat</label> - <label class="toggle only-s"><input type="checkbox" id="hideEmpty"> ocultar vacías</label> - <select id="mtype" class="only-m" aria-label="Filtrar por tipo de memoria"></select> - <label class="toggle only-m"><input type="checkbox" id="unlisted"> solo fuera del índice</label> - <button type="button" class="tbtn" id="theme" title="Cambiar entre claro y oscuro" aria-label="Cambiar tema"> + <select id="proj" aria-label="Filter by project"></select> + <label class="toggle only-s"><input type="checkbox" id="deep"> search inside chats</label> + <label class="toggle only-s"><input type="checkbox" id="hideEmpty"> hide empty</label> + <select id="mtype" class="only-m" aria-label="Filter by memory type"></select> + <label class="toggle only-m"><input type="checkbox" id="unlisted"> only unindexed</label> + <button type="button" class="tbtn" id="theme" title="Switch between light and dark" aria-label="Toggle theme"> <svg class="moon" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4"><path d="M13.5 9.6A5.8 5.8 0 0 1 6.4 2.5a5.8 5.8 0 1 0 7.1 7.1Z"/></svg> <svg class="sun" width="14" height="14" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.4"><circle cx="8" cy="8" r="3.1"/><path d="M8 1v1.6M8 13.4V15M1 8h1.6M13.4 8H15M3.1 3.1l1.1 1.1M11.8 11.8l1.1 1.1M12.9 3.1l-1.1 1.1M4.2 11.8l-1.1 1.1"/></svg> </button> </div> - <div class="grid" role="table" aria-label="Sesiones de Claude Code"> + <div class="grid" role="table" aria-label="Claude Code sessions"> <div class="row head only-s" role="row"> <span></span> - <button type="button" data-sort="t" class="pad-l">Sesión <span class="car">▾</span></button> - <button type="button" data-sort="l">Fecha <span class="car">▾</span></button> + <button type="button" data-sort="t" class="pad-l">Session <span class="car">▾</span></button> + <button type="button" data-sort="l">Date <span class="car">▾</span></button> <button type="button" data-sort="u" class="num">Msgs <span class="car">▾</span></button> <button type="button" data-sort="d" class="num">Dur. <span class="car">▾</span></button> - <span class="pad-r" style="text-align:right">Reanudar</span> + <span class="pad-r" style="text-align:right">Resume</span> </div> <div class="row head mem only-m" role="row"> <span></span> - <button type="button" data-msort="name" class="pad-l">Memoria <span class="car">▾</span></button> - <button type="button" data-msort="ty">Tipo <span class="car">▾</span></button> - <button type="button" data-msort="p">Proyecto <span class="car">▾</span></button> - <button type="button" data-msort="l">Fecha <span class="car">▾</span></button> + <button type="button" data-msort="name" class="pad-l">Memory <span class="car">▾</span></button> + <button type="button" data-msort="ty">Type <span class="car">▾</span></button> + <button type="button" data-msort="p">Project <span class="car">▾</span></button> + <button type="button" data-msort="l">Date <span class="car">▾</span></button> </div> <div id="rows"></div> </div> @@ -786,26 +786,26 @@ <p class="count" id="count"></p> <div class="legend only-s"> - <span>Franja izquierda = antigüedad:</span> - <span><i style="background:var(--amber)"></i>hoy / ayer</span> - <span><i style="background:var(--amber);opacity:.55"></i>última semana</span> - <span><i style="background:var(--amber);opacity:.26"></i>dos semanas</span> - <span><i style="background:var(--line)"></i>más viejo</span> + <span>Left stripe = age:</span> + <span><i style="background:var(--amber)"></i>today / yesterday</span> + <span><i style="background:var(--amber);opacity:.55"></i>last week</span> + <span><i style="background:var(--amber);opacity:.26"></i>two weeks</span> + <span><i style="background:var(--line)"></i>older</span> </div> <div class="legend only-m"> - <span><span class="chip chip-unlisted">fuera del índice</span> = está en disco pero no figura en MEMORY.md, así que no se carga en contexto</span> + <span><span class="chip chip-unlisted">unindexed</span> = on disk but not listed in MEMORY.md, so it is not loaded into context</span> </div> <div class="foot only-m"> - <p>Cada proyecto guarda sus recuerdos en <code><proyecto>/memory/</code>: un <code>.md</code> por memoria y un <code>MEMORY.md</code> que los indexa. El índice es lo único que se lee al arrancar una sesión.</p> - <p>Los tipos los define Claude al escribirlas: <b>project</b> es trabajo en curso, <b>user</b> quién sos y cómo trabajás, <b>feedback</b> correcciones tuyas, <b>reference</b> punteros a recursos externos.</p> + <p>Each project keeps its memories in <code><project>/memory/</code>: one <code>.md</code> per memory and a <code>MEMORY.md</code> that indexes them. The index is the only thing read when a session starts.</p> + <p>Claude picks the type when it writes them: <b>project</b> is ongoing work, <b>user</b> who you are and how you work, <b>feedback</b> your corrections, <b>reference</b> pointers to external resources.</p> </div> <div class="foot only-s"> - <p>Los títulos los genera Claude durante la sesión. Cuando falta, cae al primer mensaje tuyo — y ahí se nota, porque arranca en minúscula o suena a pregunta suelta.</p> - <p><b>Vacía</b> es una sesión que se abrió pero nunca recibió un mensaje: un <code>/resume</code> cancelado, un <code>/login</code>. <b>No interactiva</b> es un <code>claude -p</code> con algo piped por stdin — típicamente un <code>git diff</code> para redactar el mensaje de commit, no un chat.</p> - <p>La transcripción trae el texto de la conversación y una línea por herramienta usada, pero no lo que esas herramientas devolvieron: son el 95 % del volumen en disco.</p> + <p>Titles are generated by Claude during the session. When there is none, it falls back to your first message — which shows, because it starts in lowercase or reads like a stray question.</p> + <p><b>Empty</b> is a session that was opened but never got a message: a cancelled <code>/resume</code>, a <code>/login</code>. <b>Non-interactive</b> is a <code>claude -p</code> with something piped through stdin — typically a <code>git diff</code> to draft a commit message, not a chat.</p> + <p>The transcript has the conversation text and one line per tool used, but not what those tools returned: that is 95% of the size on disk.</p> <p id="snap"></p> </div> </div> @@ -819,10 +819,10 @@ <div class="meta" id="rMeta"></div> </div> <div class="rh-acts"> - <button type="button" class="xbtn" id="rCopy" title="Copiar comando para reanudar" aria-label="Copiar comando para reanudar"> + <button type="button" class="xbtn" id="rCopy" title="Copy resume command" aria-label="Copy resume command"> <svg width="13" height="13" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="5.5" y="5.5" width="8" height="9" rx="1.5"/><path d="M10.5 3.5H3a.5.5 0 0 0-.5.5v8"/></svg> </button> - <button type="button" class="xbtn" id="rClose" title="Cerrar (Esc)" aria-label="Cerrar"> + <button type="button" class="xbtn" id="rClose" title="Close (Esc)" aria-label="Close"> <svg width="13" height="13" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6"><path d="m4 4 8 8M12 4l-8 8"/></svg> </button> </div> @@ -837,13 +837,13 @@ const PAYLOAD = JSON.parse(document.getElementById('payload').textContent); const DATA = PAYLOAD.s || []; const MEM = PAYLOAD.m || []; -// Instantánea = la actividad más reciente de los datos, para que "hoy" siga siendo -// cierto respecto de cuándo se leyeron los logs y no del reloj de quien mira. +// Snapshot = the most recent activity in the data, so that "today" stays true +// relative to when the logs were read and not to the viewer's clock. const NOW = new Date(Math.max( ...DATA.map(d => +new Date(d.l)), ...MEM.map(m => +new Date(m.l)))); const BY_ID = new Map(DATA.map(d => [d.id, d])); const BY_NAME = new Map(MEM.map(m => [m.name, m])); -// Los enlaces [[...]] pueden apuntar al nombre declarado o al del archivo. +// [[...]] links may point to the declared name or to the file name. MEM.forEach(m => { const f = m.file.replace(/\.md$/, ''); if (!BY_NAME.has(f)) BY_NAME.set(f, m); }); const $ = s => document.querySelector(s); @@ -854,28 +854,28 @@ const rowsEl = $('#rows'), qEl = $('#q'), projEl = $('#proj'), deepEl = $('#deep let sortKey = 'l', sortDir = -1, lastFocus = null; let mSortKey = 'l', mSortDir = -1; -// Qué hay abierto en el lector: {kind: 's'|'m', key} o null. +// What is open in the reader: {kind: 's'|'m', key} or null. let open_ = null; -// Sin memorias la pestaña no aporta nada, así que arrancamos siempre en sesiones. +// Without memories the tab adds nothing, so we always start on sessions. let mode = 's'; -/* ---------- formato ---------- */ +/* ---------- formatting ---------- */ const DAY = 864e5; -const MES = ['ene','feb','mar','abr','may','jun','jul','ago','sep','oct','nov','dic']; +const MONTHS = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; const pad = n => String(n).padStart(2, '0'); const daysAgo = iso => (NOW - new Date(iso)) / DAY; -const fmtDate = iso => { const d = new Date(iso); return `${pad(d.getDate())} ${MES[d.getMo |