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_action_pinning.py

View on GitHub
"""Assert third-party actions in privileged workflows are SHA-pinned.

Pinning third-party GitHub Actions to a 40-character commit SHA (instead
of a floating tag like ``@v1`` or ``@release/v1``) is a defence against
upstream tag-hijacking and silent supply-chain compromise: a malicious
push to a tag we trust would otherwise execute under our secrets on the
next workflow run. This check is the static gate that keeps the
SHA-pinning invariant from regressing.

Scope:

* **Privileged workflows** — the hardcoded list below — run jobs that
  carry deploy keys, OIDC tokens, repo write scopes, or maintainer
  credentials. Every ``uses:`` referencing a third-party repo in those
  workflows must be SHA-pinned.
* **First-party ``actions/*`` actions** (e.g. ``actions/checkout``,
  ``actions/setup-python``) are owned by GitHub and may stay on floating
  tags. Dependabot still bumps them on a weekly cadence (see
  ``.github/dependabot.yml``).
* Non-privileged workflows are out of scope; they don't see secrets and
  can churn at floating-tag speed.

Comment convention: when a SHA is pinned, the line should be followed by
a human-readable tag comment so reviewers can read the intent without
visiting GitHub. Example::

    uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b  # @ v1.14.0

The comment is advisory — this script does not enforce its presence
(Dependabot rewrites only the SHA, and a missing comment is a polish
finding, not a security gap). We enforce only the SHA itself.

Usage::

    python scripts/check_action_pinning.py
    python scripts/check_action_pinning.py --workflow-dir custom/path

Exit codes:
    0  Every third-party action in every privileged workflow is SHA-pinned.
    1  One or more violations found (printed to stderr with file:line).
    2  Argument error / privileged workflow file missing.
"""

from __future__ import annotations

import argparse
import re
import sys
from collections.abc import Iterator
from pathlib import Path

# Privileged workflows. Each one carries secrets, OIDC, or maintainer-only
# triggers; a hijacked third-party action in any of these can exfiltrate
# credentials or push malicious artifacts under our identity. Keep this
# list synced with the workflows that declare an ``environment:`` gate or
# reference ``${{ secrets.* }}`` — see ``check_workflow_secret_gates.py``
# for the runtime companion to this static check.
PRIVILEGED_WORKFLOWS: tuple[str, ...] = (
    "publish.yml",
    "publish-docker.yml",
    "publish-mcpb.yml",
    "testpypi-publish.yml",
    "claude.yml",
    "rpc-health.yml",
    "nightly.yml",
    "verify-package.yml",
)

# ``uses:`` lines we'll inspect. The ref (everything after ``@``) is the
# focus of the check; we only need owner/repo to decide whether the
# action is first-party. Composite-action paths (``./.github/...``) and
# Docker image refs (``docker://...``) are intentionally NOT matched —
# they're a different trust model and aren't used in this repo today.
_USES_RE = re.compile(
    r"""
    ^\s*-?\s*               # optional list dash + leading indent
    uses:\s+                # the ``uses:`` key
    (?P<owner>[A-Za-z0-9._-]+)
    /
    (?P<repo>[A-Za-z0-9._/-]+?)   # repo may include path-into-monorepo
    @
    (?P<ref>\S+)            # whatever is after ``@`` up to next whitespace
    """,
    re.VERBOSE,
)

# A SHA is a 40-character lowercase hex string. Anything else — including
# short SHAs (``@cef221``), tags (``@v1``, ``@release/v1``), branches
# (``@main``) — is treated as a floating ref.
_SHA_RE = re.compile(r"^[0-9a-f]{40}$")

# Owners we treat as first-party (GitHub-owned, no SHA pin required).
# Mirrors the ``_ALLOWED_READ_SCOPES`` frozenset convention used by
# ``check_workflow_permissions.py`` for similar small lookup tables.
# ``github/*`` (e.g. ``github/codeql-action``) is GitHub-owned too but
# lives in a separate org; expand this set deliberately if a ``github/*``
# action ever lands in a privileged workflow.
_FIRST_PARTY_OWNERS = frozenset({"actions"})


def main() -> int:
    ap = argparse.ArgumentParser(description=__doc__)
    ap.add_argument(
        "--workflow-dir",
        default=".github/workflows",
        help="Directory containing workflow YAML files (default: .github/workflows)",
    )
    args = ap.parse_args()

    workflow_dir = Path(args.workflow_dir)
    if not workflow_dir.is_dir():
        print(f"Not a directory: {workflow_dir}", file=sys.stderr)
        return 2

    missing: list[str] = []
    for name in PRIVILEGED_WORKFLOWS:
        if not (workflow_dir / name).is_file():
            missing.append(name)
    if missing:
        # A privileged workflow disappearing is itself worth a hard fail:
        # either the list is stale or someone deleted security infra.
        # Surface so a maintainer either restores the file or updates
        # PRIVILEGED_WORKFLOWS deliberately.
        for name in missing:
            print(
                f"{workflow_dir / name}: privileged workflow file missing",
                file=sys.stderr,
            )
        return 2

    violations: list[str] = []
    for name in PRIVILEGED_WORKFLOWS:
        path = workflow_dir / name
        for lineno, owner, repo, ref in _iter_uses(path):
            if owner in _FIRST_PARTY_OWNERS:
                # actions/* is GitHub-owned; floating tag is acceptable.
                continue
            if _SHA_RE.match(ref):
                # Third-party + 40-char SHA = pinned. OK.
                continue
            violations.append(
                f"{path}:{lineno}: third-party action not SHA-pinned: "
                f"{owner}/{repo}@{ref} (expected 40-char commit SHA)"
            )

    if violations:
        for v in violations:
            print(v, file=sys.stderr)
        print(
            f"\n{len(violations)} violation(s). "
            "Replace floating tag with the resolved commit SHA, e.g.:\n"
            "  gh api repos/<owner>/<repo>/commits/<tag> --jq .sha\n"
            "Then add a comment with the human-readable tag for review "
            "readability, e.g. ``# @ v1.2.3``.",
            file=sys.stderr,
        )
        return 1

    print(
        f"OK: all third-party actions in {len(PRIVILEGED_WORKFLOWS)} privileged "
        f"workflows are SHA-pinned"
    )
    return 0


def _iter_uses(path: Path) -> Iterator[tuple[int, str, str, str]]:
    """Yield ``(lineno, owner, repo, ref)`` for each ``uses:`` line in ``path``.

    ``lineno`` is 1-based to match editor / grep / GitHub line numbering.
    """
    for lineno, line in enumerate(path.read_text().splitlines(), start=1):
        m = _USES_RE.match(line)
        if not m:
            continue
        yield lineno, m.group("owner"), m.group("repo"), m.group("ref")


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