Skip to content

fix(cli): make root quiet suppress status output - #931

Merged
teng-lin merged 1 commit into
mainfrom
cli-audit-fixes/p1t8-quiet-thread
May 21, 2026
Merged

teng-lin merged 1 commit into
mainfrom
cli-audit-fixes/p1t8-quiet-thread

Conversation

@teng-lin

@teng-lin teng-lin commented May 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add root quiet resolution plus quiet-aware CLI rendering helpers for status text and spinners
  • route representative mutating/status output through quiet-aware helpers while preserving JSON payloads and error diagnostics
  • update help/docs/changelog/CLI contract baseline and add quiet-thread regression coverage

Tests

  • uv run pytest
  • uv run ruff check .
  • uv run ruff format --check .
  • uv run mypy src/notebooklm

Summary by CodeRabbit

  • New Features

    • Enhanced --quiet flag to consistently suppress status output across all CLI commands while preserving structured output and error diagnostics.
  • Documentation

    • Clarified --quiet behavior in CLI reference and configuration guides.
    • Updated documentation for NOTEBOOKLM_NOTEBOOK environment variable usage.
  • Tests

    • Added comprehensive test coverage for --quiet flag functionality.

Review Change Stack

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented May 21, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8b273c75-1429-4b87-baed-b70ac39c297d

📥 Commits

Reviewing files that changed from the base of the PR and between f743959 and f5dad1f.

📒 Files selected for processing (14)
  • .sisyphus/phases/architecture-remediation/runs/phase-10-cli-contract-baseline.json
  • CHANGELOG.md
  • docs/cli-reference.md
  • docs/configuration.md
  • src/notebooklm/cli/artifact.py
  • src/notebooklm/cli/helpers.py
  • src/notebooklm/cli/note.py
  • src/notebooklm/cli/notebook.py
  • src/notebooklm/cli/rendering.py
  • src/notebooklm/cli/runtime.py
  • src/notebooklm/cli/source.py
  • src/notebooklm/notebooklm_cli.py
  • tests/unit/cli/test_quiet_flag.py
  • tests/unit/cli/test_root_group.py

📝 Walkthrough

Walkthrough

This PR implements the root --quiet flag to suppress human-readable status output across all CLI commands while preserving JSON payloads and error diagnostics. It introduces quiet-aware rendering helpers (cli_print, cli_status), updates command modules to use them, stores the quiet flag in Click context for downstream access, and adds comprehensive tests and documentation.

Changes

CLI Quiet Mode Implementation

Layer / File(s) Summary
Quiet mode detection and rendering helpers
src/notebooklm/cli/rendering.py
New _resolve_quiet(ctx) detects active --quiet from Click root context. New cli_print() and cli_status() wrap rich output and suppress it when quiet. Updated emit_status() accepts quiet parameter and early-returns when quiet mode is active.
Quiet mode runtime utilities
src/notebooklm/cli/runtime.py
New is_quiet(ctx) utility safely reads params["quiet"] from Click root context to determine quiet state; falls back to current context and returns False on missing/malformed data.
Root CLI quiet flag and context setup
src/notebooklm/notebooklm_cli.py
Root command stores quiet flag in ctx.obj["quiet"] for downstream access; updates --quiet help text to document suppression of status output and INFO/WARN logs.
Emit status helper extension
src/notebooklm/cli/helpers.py
emit_status() extended with quiet: bool = False parameter and forwards it to rendering_helpers.emit_status().
Command modules quiet-aware output
src/notebooklm/cli/artifact.py, src/notebooklm/cli/note.py, src/notebooklm/cli/notebook.py, src/notebooklm/cli/source.py
All commands replace console.print/console.status with cli_print/cli_status for human-readable output, passing ctx to enable quiet-aware suppression. Includes artifact rename/delete, note create/save/rename/delete, notebook create/delete/rename, and source add/delete/rename/refresh/clean commands.
Documentation and baseline updates
docs/cli-reference.md, docs/configuration.md, CHANGELOG.md, .sisyphus/phases/architecture-remediation/runs/phase-10-cli-contract-baseline.json
Updated quiet flag documentation to clarify it suppresses status output and INFO/WARN logs while preserving JSON payloads; documents mutual exclusivity with -v/-vv. Updated architecture baseline contract.
Comprehensive test coverage
tests/unit/cli/test_quiet_flag.py, tests/unit/cli/test_root_group.py
New test module validating quiet suppresses status/prose across artifact delete, source clean, and representative commands; preserves JSON and errors; is_quiet() and emit_status quiet parameter behavior; error diagnostics survive quiet mode. Updated root-group docstring to cross-reference new tests.

Sequence Diagram(s)

sequenceDiagram
  participant User as User
  participant CLI as CLI Command
  participant quiet_check as _resolve_quiet
  participant output as Rich Output
  
  User->>CLI: notebooklm artifact delete -y --quiet
  CLI->>quiet_check: cli_print("Deleted...")
  quiet_check->>quiet_check: Check ctx.root.params["quiet"]
  alt quiet mode active
    quiet_check-->>CLI: suppress=true
    CLI-->>User: (no output)
  else normal mode
    quiet_check-->>CLI: suppress=false
    CLI->>output: Print "Deleted..."
    output-->>User: Status message
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • teng-lin/notebooklm-py#521: Introduced the root --quiet flag implementation in the main CLI entry point; this PR builds directly on that foundation by adding quiet-aware output suppression across all commands.
  • teng-lin/notebooklm-py#261: Introduced the notebooklm source clean command; this PR adds quiet-mode awareness and suppression of candidate/progress tables to that command via is_quiet() and cli_print routing.
  • teng-lin/notebooklm-py#704: Earlier refactor that moved CLI rendering logic into src/notebooklm/cli/rendering.py; this PR extends that module with quiet-aware helpers (cli_print, cli_status, _resolve_quiet).

Poem

🐰 A quiet CLI, oh what a dream,
No status spam in the output stream,
JSON stays loud, errors ring clear,
But chatter and prose? They disappear!
With --quiet set, peace reigns supreme. 🤫

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.71% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(cli): make root quiet suppress status output' directly and concisely describes the main change: enabling the root --quiet flag to suppress status output in the CLI.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cli-audit-fixes/p1t8-quiet-thread

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@teng-lin
teng-lin merged commit 32475a4 into main May 21, 2026
19 checks passed
@teng-lin
teng-lin deleted the cli-audit-fixes/p1t8-quiet-thread branch June 4, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant