Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions src/notebooklm/cli/note.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from ..types import Note
from .helpers import (
console,
json_output_response,
require_notebook,
resolve_note_id,
resolve_notebook_id,
Expand Down Expand Up @@ -51,8 +52,9 @@ def note():
default=None,
help="Notebook ID (uses current if not set)",
)
@click.option("--json", "json_output", is_flag=True, help="Output as JSON")
@with_client
def note_list(ctx, notebook_id, client_auth):
def note_list(ctx, notebook_id, json_output, client_auth):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Verify the updated signature location
rg -nP '^\s*def\s+note_list\s*\(' src/notebooklm/cli/note.py

# Validate type-checking expectation for src/notebooklm
python -m mypy src/notebooklm --ignore-missing-imports

Repository: teng-lin/notebooklm-py

Length of output: 182


🏁 Script executed:

cd src/notebooklm/cli && head -80 note.py

Repository: teng-lin/notebooklm-py

Length of output: 2139


🏁 Script executed:

cd src/notebooklm/cli && tail -100 note.py | head -50

Repository: teng-lin/notebooklm-py

Length of output: 1546


🏁 Script executed:

cd src/notebooklm && grep -r "def note_list" --include="*.py"

Repository: teng-lin/notebooklm-py

Length of output: 136


🏁 Script executed:

cd src/notebooklm/cli && grep -A 1 "@with_client\|@artifact.command\|@note.command" note.py | grep "def " | head -10

Repository: teng-lin/notebooklm-py

Length of output: 443


🏁 Script executed:

cd src/notebooklm/cli && find . -name "*.py" -type f | xargs grep -l "def.*->.*:" | head -5

Repository: teng-lin/notebooklm-py

Length of output: 144


🏁 Script executed:

cd src/notebooklm/cli && head -100 chat.py | grep -A 5 "def chat"

Repository: teng-lin/notebooklm-py

Length of output: 48


🏁 Script executed:

cd src/notebooklm/cli && sed -n '1,150p' chat.py | tail -70

Repository: teng-lin/notebooklm-py

Length of output: 2750


Add type hints to the note_list function signature.

The function parameters should be annotated based on their Click decorators: ctx (Click context), notebook_id: str | None (from default=None), json_output: bool (from is_flag=True), and client_auth. Add a return type annotation as well. This is required by the coding guideline for src/notebooklm/**/*.py: "Use type hints and ensure type checking passes with mypy for src/notebooklm".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/notebooklm/cli/note.py` at line 57, Update the signature of note_list to
include type annotations: annotate ctx as click.Context, notebook_id as str |
None, json_output as bool, and client_auth as typing.Any (or a more specific
type if known), and add an explicit return type (-> None); also add necessary
imports (from typing import Any and import click) so mypy will type-check
src/notebooklm/cli/note.py successfully and the annotated signature for
note_list matches the Click-decorated parameters.

"""List all notes in a notebook."""
nb_id = require_notebook(notebook_id)

Expand All @@ -61,12 +63,29 @@ async def _run():
nb_id_resolved = await resolve_notebook_id(client, nb_id)
notes = await client.notes.list(nb_id_resolved)

if json_output:
data = {
"notebook_id": nb_id_resolved,
"notes": [
{
"id": n.id,
"title": n.title or "Untitled",
"preview": (n.content or "")[:100],
}
for n in notes
if isinstance(n, Note)
],
"count": len(notes),
}
json_output_response(data)
return

if not notes:
console.print("[yellow]No notes found[/yellow]")
return

table = Table(title=f"Notes in {nb_id_resolved}")
table.add_column("ID", style="cyan")
table.add_column("ID", style="cyan", no_wrap=True)
table.add_column("Title", style="green")
table.add_column("Preview", style="dim", max_width=50)

Expand Down
Loading