CLI Subsystem

CLI Subsystem An architecture diagram generated by Archify. AuthSource · precedence resolver · cli/ · imports no notebooklm._* except _app AuthSource precedence resolver CLI Context · context.json · cli/ · imports no notebooklm._* except _app · active notebook CLI Context context.json active notebook ID Resolver · partial-id match · cli/ · imports no notebooklm._* except _app ID Resolver partial-id match Root Group · notebooklm_cli.py · cli/ · imports no notebooklm._* except _app · SectionedGroup Root Group notebooklm_cli.py SectionedGroup Click Command · cli/*_cmd.py · cli/ · imports no notebooklm._* except _app Click Command cli/*_cmd.py Auth Runtime · guarded run_async bridge · cli/ · imports no notebooklm._* except _app · ADR-0004 Auth Runtime guarded run_async bridge ADR-0004 CLI Services · plans · retry · wait · cli/ · imports no notebooklm._* except _app · ADR-0008 CLI Services plans · retry · wait ADR-0008 NotebookLMClient · opened per command · Architecture component NotebookLMClient opened per command Error Handler · exit-code policy · cli/ · imports no notebooklm._* except _app · ADR-0015 Error Handler exit-code policy ADR-0015 Rendering · rich · text · JSON · cli/ · imports no notebooklm._* except _app Rendering rich · text · JSON Login Services · interactive · cookies · token · cli/ · imports no notebooklm._* except _app Login Services interactive · cookies · token Browser Login App · _app/login_browser.py · Architecture component · neutral orchestration Browser Login App _app/login_browser.py neutral orchestration dispatch auth + errors workflow public API resolve auth active profile partial ids raises stdout login flow typed plan cli/ · imports no notebooklm._* except _app Legend Frontend Backend Database Security

Thin adapter

  • • Commands own Click options, rendering and exit codes; services own workflows
  • • Browser orchestration lives in _app and reaches _browser through auth.py
  • • The CLI never builds batchexecute payloads or imports rpc/

One bridge implementation

  • • cli/runtime.py holds the shared guarded asyncio.run bridge used by normal sync Click handlers
  • • master_token_login.py directly injects asyncio.run for its bootstrap and refresh path
  • • Auth precedence is --storage, then NOTEBOOKLM_AUTH_JSON, then the active profile

Output contract

  • • Under --json, failures use the byte-stable typed error envelope
  • • Parse-time Click errors stay Click-owned and are not re-wrapped