aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml6
-rw-r--r--.github/workflows/publish.yml22
-rw-r--r--.gitignore7
-rw-r--r--README.es.md37
-rw-r--r--README.md31
-rw-r--r--claude_logbook/__init__.py2
-rw-r--r--claude_logbook/cli.py222
-rw-r--r--claude_logbook/memory.py18
-rw-r--r--claude_logbook/sessions.py8
-rw-r--r--claude_logbook/template.html246
-rw-r--r--claude_logbook/terminal.py74
-rw-r--r--claude_logbook/webpage.py14
-rw-r--r--tests/fixtures.py46
-rw-r--r--tests/test_cli.py94
-rw-r--r--tests/test_memory.py80
-rw-r--r--tests/test_sessions.py66
-rw-r--r--tests/test_terminal.py78
-rw-r--r--tests/test_webpage.py40
18 files changed, 547 insertions, 544 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6151b64..ac2cec4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -24,12 +24,12 @@ jobs:
with:
python-version: ${{ matrix.python }}
- # Sin dependencias a propósito: si algún día hace falta instalar algo
- # para correr los tests, es que el proyecto dejó de ser stdlib-only.
+ # No dependencies on purpose: if installing something is ever needed
+ # to run the tests, the project is no longer stdlib-only.
- name: Tests
run: python -m unittest discover -s tests -t . -v
- - name: Se instala y el comando arranca
+ - name: Installs and the command starts
run: |
pip install .
claude-logbook --version
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 4fc675c..552aaa7 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -1,17 +1,17 @@
name: Publish
-# Publica en PyPI cuando se publica un release de GitHub.
+# Publishes to PyPI when a GitHub release is published.
#
-# No hay ningún token guardado: PyPI confía en este workflow por OIDC
-# (trusted publishing). Del lado de pypi.org hay que haber dado de alta un
-# "pending publisher" con exactamente estos cuatro datos:
+# No token is stored anywhere: PyPI trusts this workflow through OIDC
+# (trusted publishing). On pypi.org a "pending publisher" must have been
+# registered with exactly these four values:
#
# Owner ElvisClaros
# Repository claude-logbook
# Workflow publish.yml
# Environment pypi
#
-# Si alguno no coincide, PyPI rechaza el upload.
+# If any of them does not match, PyPI rejects the upload.
on:
release:
@@ -28,7 +28,7 @@ jobs:
url: https://pypi.org/p/claude-logbook
permissions:
- id-token: write # lo único que habilita el trusted publishing
+ id-token: write # the only thing trusted publishing needs
steps:
- uses: actions/checkout@v4
@@ -37,10 +37,10 @@ jobs:
with:
python-version: "3.13"
- # El número vive en claude_logbook/__init__.py y es fácil olvidarse de
- # subirlo. Mejor fallar acá que publicar algo mal rotulado: una versión
- # subida a PyPI no se puede reemplazar nunca, solo yankear.
- - name: El tag coincide con __version__
+ # The number lives in claude_logbook/__init__.py and it is easy to forget
+ # to bump it. Better to fail here than publish something mislabelled: a
+ # version uploaded to PyPI can never be replaced, only yanked.
+ - name: Tag matches __version__
run: |
tag="${GITHUB_REF_NAME#v}"
ver="$(python -c 'import claude_logbook; print(claude_logbook.__version__)')"
@@ -52,7 +52,7 @@ jobs:
python -m pip install --upgrade build
python -m build
- - name: Los artefactos están sanos
+ - name: Artifacts are sound
run: |
python -m pip install --upgrade twine
twine check dist/*
diff --git a/.gitignore b/.gitignore
index e72b3e6..f5156d7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
-# Salida del propio comando: son transcripciones completas de tus chats.
-# Nunca las commitees.
+# The command's own output: full transcripts of your chats.
+# Never commit them.
+sessions.html
sesiones.html
data.json
*.html
@@ -14,7 +15,7 @@ dist/
.venv/
venv/
-# Editores / SO
+# Editors / OS
.DS_Store
.idea/
.vscode/
diff --git a/README.es.md b/README.es.md
index 00c4eb7..eef28ac 100644
--- a/README.es.md
+++ b/README.es.md
@@ -7,25 +7,28 @@ HTML autocontenida que se abre con doble clic.
Español · **[English](README.md)** · Sin dependencias, solo biblioteca estándar.
```
- # SESIÓN RUTA FECHA CUÁNDO MSG DUR ID
- 1 | Migrar el pool de conexiones a … /home/ana/api 16 ago hoy 4 9m 5d10f1ee
- 2 | Timeouts intermitentes en el he… /home/ana/api 16 ago hoy 2 3m 0f60f37a
- 3 | Reescribir el buscador con Fuse… /home/ana/web 15 ago ayer 7 18m b69c1fc2
- 4 | por qué tarda tanto npm ci /home/ana/web 13 ago hace 3d 1 <1m d4d2a5be
- 5 | sesión abierta sin mens… [vacía] /home/ana/infra 08 ago hace 1sem — <1m e0a4300e
-
-5 sesiones · 3 proyectos · -s <nº> para leer una
+ # SESSION PATH DATE WHEN MSG DUR ID
+ 1 | Migrate the connection pool t… /home/ana/api 16 Aug today 4 9m 5d10f1ee
+ 2 | Intermittent timeouts in the … /home/ana/api 16 Aug today 2 3m 0f60f37a
+ 3 | Rewrite search with Fuse.js /home/ana/web 15 Aug yesterday 7 18m b69c1fc2
+ 4 | why is npm ci so slow /home/ana/web 13 Aug 3d ago 1 <1m d4d2a5be
+ 5 | session opened with n… [empty] /home/ana/infra 08 Aug 1w ago — <1m e0a4300e
+
+5 sessions · 3 projects · -s <#> to read one
```
+> **La CLI, su salida y su ayuda están en inglés.** Este README es solo una
+> traducción. El comando lee archivos locales y nunca envía nada a ningún lado.
+
## ⚠️ Tus transcripciones son privadas
`--json` y `--html` escriben **el texto completo de tus conversaciones y de las
memorias de tus proyectos**:
-prompts, respuestas, rutas de archivos, nombres de ramas. El `sesiones.html` que
+prompts, respuestas, rutas de archivos, nombres de ramas. El `sessions.html` que
sale es una copia legible de todo lo que escribiste alguna vez en Claude Code.
No lo commitees, no lo subas, no lo pegues en un issue. El `.gitignore` del repo
-ya excluye `sesiones.html` y `data.json`, pero el archivo lo cuidás vos.
+ya excluye `sessions.html` y `data.json`, pero el archivo lo cuidás vos.
## Instalación
@@ -56,7 +59,7 @@ claude-logbook -s 5d10f1ee # lo mismo, por prefijo de UUID
claude-logbook -g "port already" # busca dentro de las conversaciones
claude-logbook -r 3 # imprime el comando para reanudarla
eval "$(claude-logbook -r 3)" # …o la reanuda directamente
-claude-logbook --html --open # genera sesiones.html y lo abre
+claude-logbook --html --open # genera sessions.html y lo abre
claude-logbook -m # las memorias de tus proyectos
```
@@ -74,20 +77,20 @@ claude-logbook docker -s 2 # lee el 2º de esos tres
| --- | --- |
| `-s`, `--show REF` | Muestra un chat (índice de la tabla o prefijo de UUID). |
| `-r`, `--resume REF` | Imprime `cd <proyecto> && claude --resume <uuid>`. |
-| `-g`, `--grep TEXTO` | Deja las sesiones cuya transcripción contenga `TEXTO`. |
-| `-p`, `--project RUTA` | Deja las sesiones cuya ruta de proyecto contenga `RUTA`. |
+| `-g`, `--grep TEXT` | Deja las sesiones cuya transcripción contenga `TEXT`. |
+| `-p`, `--project PATH` | Deja las sesiones cuya ruta de proyecto contenga `PATH`. |
| `-n`, `--limit N` | Solo las N más recientes. |
| `-E`, `--hide-empty` | Oculta las sesiones sin mensajes. |
| `--no-tools` | En el chat, oculta las llamadas a herramientas. |
| `--no-pager` | No manda el chat a `$PAGER`. |
| `--no-color` | Salida sin color (también respeta `NO_COLOR`). |
| `--json` | Vuelca todas las sesiones en JSON por stdout. |
-| `--html [ARCHIVO]` | Genera la página autocontenida (por defecto `sesiones.html`). |
-| `--template ARCHIVO` | Usa tu propio template para `--html`. |
+| `--html [FILE]` | Genera la página autocontenida (por defecto `sessions.html`). |
+| `--template FILE` | Usa tu propio template para `--html`. |
| `--open` | Abre en el navegador lo que haya generado `--html`. |
| `--no-cache` | Ignora el caché y re-parsea todo. |
| `-m`, `--memory` | Trabaja sobre las memorias en vez de las sesiones. |
-| `--type TIPO` | Con `-m`: filtra por `project`, `user`, `feedback` o `reference`. |
+| `--type TYPE` | Con `-m`: filtra por `project`, `user`, `feedback` o `reference`. |
| `--check` | Con `-m`: audita índices, enlaces y sesiones de origen. |
### Borrar sesiones
@@ -169,7 +172,7 @@ servidor, sin red, sin paso de build: lo copiás a otra máquina y sigue andando
código, títulos y una línea por herramienta usada.
- Botón para copiar el `cd … && claude --resume …` de cualquier sesión.
- Tema claro y oscuro, con un botón que recuerda cuál elegiste.
-- Cada sesión tiene su propio fragmento de URL: `sesiones.html#5d10f1ee-…` abre
+- Cada sesión tiene su propio fragmento de URL: `sessions.html#5d10f1ee-…` abre
esa conversación directamente.
- Teclado: `/` o `Ctrl`+`K` enfoca el buscador, `Esc` lo limpia o cierra el lector.
diff --git a/README.md b/README.md
index 91ad4cf..c756f9a 100644
--- a/README.md
+++ b/README.md
@@ -6,29 +6,28 @@ page you open with a double click.
**[Español](README.es.md)** · English · No dependencies, standard library only.
-> **The CLI, its output and its help text are in Spanish.** Only this README is
-> translated. The command reads local files and never sends anything anywhere.
-
```
- # SESIÓN RUTA FECHA CUÁNDO MSG DUR ID
- 1 | Migrar el pool de conexiones a … /home/ana/api 16 ago hoy 4 9m 5d10f1ee
- 2 | Timeouts intermitentes en el he… /home/ana/api 16 ago hoy 2 3m 0f60f37a
- 3 | Reescribir el buscador con Fuse… /home/ana/web 15 ago ayer 7 18m b69c1fc2
- 4 | por qué tarda tanto npm ci /home/ana/web 13 ago hace 3d 1 <1m d4d2a5be
- 5 | sesión abierta sin mens… [vacía] /home/ana/infra 08 ago hace 1sem — <1m e0a4300e
-
-5 sesiones · 3 proyectos · -s <nº> para leer una
+ # SESSION PATH DATE WHEN MSG DUR ID
+ 1 | Migrate the connection pool t… /home/ana/api 16 Aug today 4 9m 5d10f1ee
+ 2 | Intermittent timeouts in the … /home/ana/api 16 Aug today 2 3m 0f60f37a
+ 3 | Rewrite search with Fuse.js /home/ana/web 15 Aug yesterday 7 18m b69c1fc2
+ 4 | why is npm ci so slow /home/ana/web 13 Aug 3d ago 1 <1m d4d2a5be
+ 5 | session opened with n… [empty] /home/ana/infra 08 Aug 1w ago — <1m e0a4300e
+
+5 sessions · 3 projects · -s <#> to read one
```
+The command reads local files and never sends anything anywhere.
+
## ⚠️ Your transcripts are private
`--json` and `--html` write out **the full text of your conversations and your
projects' memories**: prompts,
-answers, file paths, branch names. The generated `sesiones.html` is a complete,
+answers, file paths, branch names. The generated `sessions.html` is a complete,
readable copy of everything you ever typed into Claude Code.
Do not commit it, do not upload it, do not paste it into a bug report. The
-repository's `.gitignore` already excludes `sesiones.html` and `data.json`, but
+repository's `.gitignore` already excludes `sessions.html` and `data.json`, but
the file itself is yours to look after.
## Install
@@ -60,7 +59,7 @@ claude-logbook -s 5d10f1ee # same, by UUID prefix
claude-logbook -g "port already" # search inside the conversations
claude-logbook -r 3 # print the command that resumes it
eval "$(claude-logbook -r 3)" # …or resume it right away
-claude-logbook --html --open # build sesiones.html and open it
+claude-logbook --html --open # build sessions.html and open it
claude-logbook -m # your projects' memories
```
@@ -86,7 +85,7 @@ claude-logbook docker -s 2 # reads the 2nd of those three
| `--no-pager` | Do not pipe the conversation through `$PAGER`. |
| `--no-color` | Plain output (`NO_COLOR` is honoured too). |
| `--json` | Dump every session as JSON on stdout. |
-| `--html [FILE]` | Build the standalone page (default `sesiones.html`). |
+| `--html [FILE]` | Build the standalone page (default `sessions.html`). |
| `--template FILE` | Use your own template for `--html`. |
| `--open` | Open whatever `--html` produced in your browser. |
| `--no-cache` | Ignore the cache and re-parse everything. |
@@ -173,7 +172,7 @@ works.
headings and one line per tool call.
- Copy the `cd … && claude --resume …` command for any session.
- Light and dark themes, with a toggle that remembers your choice.
-- Each session gets its own URL fragment, so `sesiones.html#5d10f1ee-…` opens
+- Each session gets its own URL fragment, so `sessions.html#5d10f1ee-…` opens
that conversation directly.
- Keyboard: `/` or `Ctrl`+`K` focuses the search box, `Esc` clears it or closes
the reader.
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):