From 0c7d3895773c8b6a5dd5ab09b5a688a390ad7a1c Mon Sep 17 00:00:00 2001 From: Josh Mabry Date: Sat, 25 Jul 2026 02:44:29 -0700 Subject: [PATCH] =?UTF-8?q?feat:=20Link=20the=20credential=20prompt=20to?= =?UTF-8?q?=20the=20setup=20instructions=20=E2=80=94=20both=20badge=20and?= =?UTF-8?q?=20error=20string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __init__.py | 3 ++- tests/test_plugin.py | 11 +++++++++++ view.py | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/__init__.py b/__init__.py index 8088630..ed196bb 100644 --- a/__init__.py +++ b/__init__.py @@ -49,7 +49,8 @@ def _run(fn, *args, **kwargs): if not _creds().configured(): return ("Google isn't configured. Set google.client_id / client_secret / refresh_token " - "(or GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET / GOOGLE_REFRESH_TOKEN).") + "(or GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET / GOOGLE_REFRESH_TOKEN). " + "Setup guide: https://github.com/protoLabsAI/google-plugin#connect-one-click-oauth") try: return fn(*args, **kwargs) except GoogleError as exc: diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 5d695a4..c67692e 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -96,6 +96,8 @@ def test_tools_hint_when_unconfigured(monkeypatch): monkeypatch.setattr(plugin, "_CREDS", Creds("", "", "")) out = plugin.gmail_list_unread.invoke({}) assert "isn't configured" in out and "GOOGLE_CLIENT_ID" in out + # The hint points the agent at the README OAuth setup section (bare URL, not HTML). + assert "https://github.com/protoLabsAI/google-plugin#connect-one-click-oauth" in out def test_list_unread_quotes_the_label(monkeypatch): @@ -158,3 +160,12 @@ def test_page_is_four_rules_compliant(): assert "apiFetch" in page # authed fetch via the kit assert ":root{" not in page and ":root {" not in page # no hand-rolled theme map assert 'addEventListener("message"' not in page # kit owns the handshake + + +def test_setup_badge_links_to_readme_oauth_guide(): + # The "no client" badge tells the operator what to set AND links to how (README). + page = view.PAGE + href = "https://github.com/protoLabsAI/google-plugin#connect-one-click-oauth" + assert 'class="pl-badge pl-badge--error"' in page # keeps the DS badge classes + assert f'href="{href}"' in page # the badge text is wrapped in an to the guide + assert "color:inherit" in page # readable on the error badge background diff --git a/view.py b/view.py index 62debd8..1b331e8 100644 --- a/view.py +++ b/view.py @@ -53,7 +53,7 @@ ? 'connected' + (s.email ? " — " + esc(s.email) : "") + '' : (s.has_client ? '' - : 'set client_id / client_secret in Settings ▸ Plugins ▸ Google'); + : 'set client_id / client_secret in Settings ▸ Plugins ▸ Google'); let rows = '
Account' + badge + '
'; if (s.configured) rows += '
'; return rows;