Skip to content

teng-lin/notebooklm-py

notebooklm

Verified

Install, authenticate, troubleshoot, and operate Gemini Notebook through the notebooklm-py CLI or typed async Python API. Use for notebook and source management, grounded chat and research, and artifact generation or download when the user mentions Gemini Notebook, notebooklm-py, the notebooklm CLI, or its Python API. Do not use for the generic Gemini API or unrelated content creation.

FileKindSize
SKILL.mdskill md16.0 KB
examples/bulk-import.pyscript3.4 KB
examples/chat.pyscript6.9 KB
examples/notes.pyscript9.8 KB
examples/quickstart.pyscript2.3 KB
examples/refresh_browser_cookies.pyscript2.9 KB
examples/research-to-podcast.pyscript3.2 KB
examples/video.pyscript5.9 KB
scripts/__init__.pyscript73 B
scripts/_ci_e2e_notebooks.pyscript19.0 KB
scripts/_ci_progress.pyscript2.5 KB
scripts/_ci_rpc_progress.pyscript7.5 KB
scripts/_live_auth_scenarios/__init__.pyscript2.6 KB
scripts/_live_auth_scenarios/_contract.pyscript1.9 KB
scripts/_live_auth_scenarios/browser_refresh.pyscript3.1 KB
scripts/_live_auth_scenarios/crash_safe_writer.pyscript1.9 KB
scripts/_live_auth_scenarios/master_token_recovery.pyscript3.3 KB
scripts/_live_auth_scenarios/mcp_recovery.pyscript3.0 KB
scripts/_live_auth_scenarios/rest_recovery.pyscript5.9 KB
scripts/_live_auth_scenarios/sibling_concurrent_reload.pyscript3.9 KB
scripts/_live_auth_scenarios/storage_reload.pyscript2.9 KB
scripts/_onetime_rescrub_cookies.pyscript6.6 KB
scripts/_onetime_retarget_cassette_hosts.pyscript8.5 KB
scripts/_strip_audit_refs.pyscript15.9 KB
scripts/_tracked_files.pyscript872 B
scripts/aggregate_ci_e2e_outcomes.pyscript10.8 KB
scripts/android_grpc_canary.pyscript26.6 KB
scripts/api-compat-allowlist.jsonconfig163 B
scripts/audit_auth_import_graph.pyscript7.5 KB
scripts/audit_auth_patch_sites.pyscript83.6 KB
scripts/audit_auth_shared_mutations.pyscript41.7 KB
scripts/audit_backend_coupling.pyscript32.8 KB
scripts/audit_public_api_compat.pyscript47.4 KB
scripts/audit_test_suite.pyscript10.7 KB
scripts/capture_mobile_grpc.jsscript5.1 KB
scripts/capture_rpc_registry.pyscript44.5 KB
scripts/check_action_pinning.pyscript6.7 KB
scripts/check_auth_behavior_scenario_policy.pyscript37.1 KB
scripts/check_auth_coverage_delta.pyscript23.2 KB
scripts/check_auth_lifecycle_cleanup_policy.pyscript11.7 KB
scripts/check_base_wheel.pyscript6.3 KB
scripts/check_ci_install_parity.pyscript8.8 KB
scripts/check_claude_md_freshness.pyscript8.0 KB
scripts/check_coverage_thresholds.pyscript8.4 KB
scripts/check_deprecation_targets.pyscript33.1 KB
scripts/check_docs_module_refs.pyscript14.4 KB
scripts/check_rpc_health.pyscript112.0 KB
scripts/check_workflow_permissions.pyscript5.3 KB
scripts/check_workflow_secret_gates.pyscript40.4 KB
scripts/decode_mobile_grpc.pyscript7.2 KB
scripts/diagnose_get_notebook.pyscript9.1 KB
scripts/extract_blutter_grpc_signatures.pyscript7.6 KB
scripts/live_auth_matrix.pyscript40.2 KB
scripts/manage_ci_e2e_notebooks.pyscript67.4 KB
scripts/materialize_ci_auth.pyscript8.0 KB
scripts/mcp_live_smoke.pyexecutablescript224 B
scripts/parse_pbenums.pyscript8.6 KB
scripts/parse_pbschema.pyscript11.8 KB
scripts/regen_baselines.pyscript2.7 KB
scripts/regenerate_android_protos.pyscript16.3 KB
scripts/rescrub-cassettes.pyscript13.3 KB
scripts/scrub_rpc_har.pyscript9.4 KB
scripts/select_ci_account.pyscript4.8 KB
scripts/stress_fault_server.pyscript20.6 KB
scripts/test_taxonomy_inventory.pyscript16.1 KB
scripts/verify_ci_artifacts.pyscript35.3 KB

scripts/check_ci_install_parity.py

View on GitHub
"""Assert install-doc parity.

Two checks:

1. **Canonical install presence:** the canonical install command —
   ``uv sync --frozen --extra browser --extra dev --extra markdown`` — must
   appear verbatim in both ``.github/workflows/test.yml`` and
   ``CONTRIBUTING.md``. The exact wording is deliberate (per
   ``docs/installation.md``): the broader ``--all-extras`` form installs every
   optional group, including ``cookies`` plus ``mcp``/``server``; the default
   contributor command keeps optional adapters out of the environment.

2. **Block-mirror policy:** every fenced ``bash`` code block
   in ``docs/installation.md`` (the canonical install guide) must EITHER
   appear verbatim in ``CONTRIBUTING.md``, OR be marked with
   ``<!-- not mirrored: <reason> -->`` on the line directly before the
   opening fence in ``installation.md``. This forces a reviewer to *think*
   about parity each time they edit the install docs — a stale block
   silently drifting into ``installation.md`` without a corresponding
   contributor-doc update is the failure mode this guards.

Usage:
    python scripts/check_ci_install_parity.py
    python scripts/check_ci_install_parity.py --workflow X --contributing Y --installation Z
    python scripts/check_ci_install_parity.py --skip-block-mirror   # original check only

Exit codes:
    0  All checks pass.
    1  Drift detected.
    2  Argument error / file not found.
"""

from __future__ import annotations

import argparse
import re
import sys
from dataclasses import dataclass
from pathlib import Path

CANONICAL_INSTALL_CMD = "uv sync --frozen --extra browser --extra dev --extra markdown"

# Regex to find ``<!-- not mirrored: ... -->`` markers. The reason text is
# stripped — it's documentation for humans, not a key.
_MARKER_RE = re.compile(r"<!--\s*not\s+mirrored\s*:\s*(.+?)\s*-->", re.IGNORECASE)


@dataclass(frozen=True)
class _BashBlock:
    """A fenced ``bash`` code block extracted from a markdown source."""

    start_line: int  # 1-based line number of the opening ``` fence
    body: str  # block contents (no fences), exact characters


def _extract_bash_blocks(text: str) -> list[_BashBlock]:
    """Extract every fenced ``bash`` block from a markdown document.

    Indented blocks (e.g. inside numbered lists) are recognized: the script
    looks for a fence opener that begins with ``bash`` after any indentation.
    The block body is captured with the leading indentation stripped from
    each line so a verbatim search against another doc isn't foiled by
    purely-cosmetic indent differences.
    """
    blocks: list[_BashBlock] = []
    lines = text.splitlines(keepends=False)
    i = 0
    while i < len(lines):
        line = lines[i]
        stripped = line.lstrip()
        indent = len(line) - len(stripped)
        if stripped.rstrip() == "```bash":
            start = i + 1  # 1-based for human-friendly error messages
            body_lines: list[str] = []
            j = i + 1
            while j < len(lines):
                ln = lines[j]
                ln_stripped = ln.lstrip()
                ln_indent = len(ln) - len(ln_stripped)
                if ln_stripped.rstrip() == "```" and ln_indent == indent:
                    # Tolerate trailing whitespace on the closing fence so a
                    # file with stray spaces after ``` doesn't silently
                    # capture the rest of the document into one giant block.
                    break
                # Strip the opener's indent so the captured body is comparable
                # against blocks elsewhere that may use different indentation.
                if ln.startswith(" " * indent):
                    body_lines.append(ln[indent:])
                else:
                    body_lines.append(ln)
                j += 1
            blocks.append(_BashBlock(start_line=start, body="\n".join(body_lines)))
            i = j + 1
            continue
        i += 1
    return blocks


def _has_not_mirrored_marker(text: str, block: _BashBlock) -> bool:
    """Return True if a ``<!-- not mirrored: ... -->`` marker precedes ``block``.

    The marker must appear on the line directly above the opening fence
    (blank lines between are tolerated so the marker can sit above a
    heading or short paragraph without being forced inline with the fence).
    """
    lines = text.splitlines(keepends=False)
    fence_idx = block.start_line - 1
    k = fence_idx - 1
    while k >= 0 and lines[k].strip() == "":
        k -= 1
    if k < 0:
        return False
    return _MARKER_RE.search(lines[k]) is not None


def _check_canonical_install_presence(workflow_path: Path, contributing_path: Path) -> int:
    if not workflow_path.is_file():
        print(f"File not found: {workflow_path}", file=sys.stderr)
        return 2
    if not contributing_path.is_file():
        print(f"File not found: {contributing_path}", file=sys.stderr)
        return 2

    workflow_text = workflow_path.read_text(encoding="utf-8")
    contributing_text = contributing_path.read_text(encoding="utf-8")

    if CANONICAL_INSTALL_CMD not in workflow_text:
        print(
            f"DRIFT: {workflow_path} is missing the canonical install command:\n"
            f"  '{CANONICAL_INSTALL_CMD}'",
            file=sys.stderr,
        )
        return 1
    if CANONICAL_INSTALL_CMD not in contributing_text:
        print(
            f"DRIFT: {contributing_path} is missing the canonical install command:\n"
            f"  '{CANONICAL_INSTALL_CMD}'",
            file=sys.stderr,
        )
        return 1

    print(f"OK: both files use '{CANONICAL_INSTALL_CMD}'")
    return 0


def _check_block_mirror_policy(installation_path: Path, contributing_path: Path) -> int:
    """Every bash block in installation.md must be mirrored or explicitly marked."""
    if not installation_path.is_file():
        print(f"File not found: {installation_path}", file=sys.stderr)
        return 2
    if not contributing_path.is_file():
        print(f"File not found: {contributing_path}", file=sys.stderr)
        return 2

    installation_text = installation_path.read_text(encoding="utf-8")
    contributing_text = contributing_path.read_text(encoding="utf-8")

    blocks = _extract_bash_blocks(installation_text)
    if not blocks:
        print(f"WARN: no fenced ``bash`` blocks found in {installation_path}", file=sys.stderr)
        return 0

    # Compare against the SET of fenced bash blocks in CONTRIBUTING.md, not
    # the raw text. A naive substring check would let an installation block
    # pass when its body coincidentally appears inside prose, an unrelated
    # block, or a longer command — exactly the false-positive failure mode
    # that lets stale install docs slip through unnoticed.
    contributing_block_bodies = {b.body for b in _extract_bash_blocks(contributing_text)}

    failures: list[str] = []
    for block in blocks:
        if block.body in contributing_block_bodies:
            continue
        if _has_not_mirrored_marker(installation_text, block):
            continue
        first_line = block.body.splitlines()[0] if block.body else "(empty)"
        failures.append(
            f"  {installation_path}:{block.start_line} — block not mirrored "
            f"in {contributing_path.name} and missing "
            f"'<!-- not mirrored: <reason> -->' marker.\n"
            f"    first line: {first_line!r}"
        )

    if failures:
        print(
            "BLOCK-MIRROR DRIFT in install docs:\n"
            + "\n".join(failures)
            + "\n  Fix: either copy the block verbatim into "
            + str(contributing_path)
            + ", or add a '<!-- not mirrored: <reason> -->' line directly above "
            "the opening fence in " + str(installation_path) + ".",
            file=sys.stderr,
        )
        return 1

    print(
        f"OK: all {len(blocks)} bash block(s) in {installation_path.name} "
        "are mirrored or explicitly marked"
    )
    return 0


def main(argv: list[str] | None = None) -> int:
    repo_root = Path(__file__).resolve().parent.parent
    ap = argparse.ArgumentParser(description=__doc__)
    ap.add_argument("--workflow", default=str(repo_root / ".github/workflows/test.yml"))
    ap.add_argument("--contributing", default=str(repo_root / "CONTRIBUTING.md"))
    ap.add_argument("--installation", default=str(repo_root / "docs/installation.md"))
    ap.add_argument(
        "--skip-block-mirror",
        action="store_true",
        help="Run only the original canonical-install presence check.",
    )
    args = ap.parse_args(argv)

    workflow = Path(args.workflow)
    contributing = Path(args.contributing)
    installation = Path(args.installation)

    rc = _check_canonical_install_presence(workflow, contributing)
    if rc != 0:
        return rc

    if args.skip_block_mirror:
        return 0

    return _check_block_mirror_policy(installation, contributing)


if __name__ == "__main__":
    sys.exit(main())
deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall