From ecb6c35ad502bb28342cd1654a194ff4bcd9b291 Mon Sep 17 00:00:00 2001 From: ZdenekSrotyr Date: Sat, 2 May 2026 21:47:05 +0200 Subject: [PATCH] feat(admin): rename /admin/welcome to /admin/agent-prompt (Agent Setup Prompt) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename the welcome prompt editor from /admin/welcome to /admin/agent-prompt and update all UI labels to "Agent Setup Prompt". API endpoint URLs are unchanged (PUT/GET/DELETE /api/admin/welcome-template, GET /api/welcome). - Nav menu: "Welcome prompt" → "Agent Setup Prompt", href updated - Page title and h2 updated in admin_welcome.html - Error message hint in app/api/welcome.py updated to /admin/agent-prompt - Dashboard: replace inline
preview of _claude_setup_instructions with a simple link to /setup (Task C) - docs/welcome-template.md renamed to docs/agent-setup-prompt.md; internal references to /admin/welcome updated - OpenAPI snapshot path updated - Tests updated to reflect new route and removed inline preview --- app/api/welcome.py | 2 +- app/web/templates/_app_header.html | 5 ++--- app/web/templates/admin_welcome.html | 6 +++--- app/web/templates/dashboard.html | 15 +-------------- ...{welcome-template.md => agent-setup-prompt.md} | 8 ++++---- tests/snapshots/openapi.json | 4 ++-- tests/test_web_ui.py | 10 ++++++---- tests/test_welcome_template_api.py | 4 ++-- 8 files changed, 21 insertions(+), 33 deletions(-) rename docs/{welcome-template.md => agent-setup-prompt.md} (94%) diff --git a/app/api/welcome.py b/app/api/welcome.py index 159074f..7533a9a 100644 --- a/app/api/welcome.py +++ b/app/api/welcome.py @@ -81,7 +81,7 @@ async def get_welcome( logger.warning("Welcome render failed: %s", e, exc_info=True) raise HTTPException( status_code=500, - detail="Welcome template render failed. An admin can fix it at /admin/welcome.", + detail="Welcome template render failed. An admin can fix it at /admin/agent-prompt.", ) return WelcomeResponse(content=rendered) diff --git a/app/web/templates/_app_header.html b/app/web/templates/_app_header.html index 168ecbe..49a4790 100644 --- a/app/web/templates/_app_header.html +++ b/app/web/templates/_app_header.html @@ -14,7 +14,7 @@ Setup local agent {% if session.user.is_admin %} Marketplaces - {% set _admin_active = _path.startswith('/admin/tables') or _path.startswith('/admin/tokens') or _path.startswith('/admin/users') or _path.startswith('/admin/groups') or _path.startswith('/admin/access') or _path.startswith('/admin/server-config') or _path.startswith('/admin/welcome') or _path.startswith('/admin/setup-banner') %} + {% set _admin_active = _path.startswith('/admin/tables') or _path.startswith('/admin/tokens') or _path.startswith('/admin/users') or _path.startswith('/admin/groups') or _path.startswith('/admin/access') or _path.startswith('/admin/server-config') or _path.startswith('/admin/agent-prompt') %} {% endif %} diff --git a/app/web/templates/admin_welcome.html b/app/web/templates/admin_welcome.html index 6571b62..c8e3d12 100644 --- a/app/web/templates/admin_welcome.html +++ b/app/web/templates/admin_welcome.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% block title %}Welcome Prompt — {{ config.INSTANCE_NAME }}{% endblock %} +{% block title %}Agent Setup Prompt — {{ config.INSTANCE_NAME }}{% endblock %} {% block content %}
-

Analyst Welcome Prompt

-

Customise the CLAUDE.md generated for analysts on da analyst setup.

+

Agent Setup Prompt

+

Customise the CLAUDE.md generated for analysts on da analyst setup.

{% if is_override %} diff --git a/app/web/templates/dashboard.html b/app/web/templates/dashboard.html index 629968a..afa13cd 100644 --- a/app/web/templates/dashboard.html +++ b/app/web/templates/dashboard.html @@ -2046,20 +2046,7 @@ Or open the full setup page →
-
- - - What Claude Code will receive - -

- Read-only preview. The real token is generated the moment - you click the button above and is placed directly in your - clipboard — never shown on this page. -

- {% with preview_mode=True %} - {% include "_claude_setup_instructions.jinja" %} - {% endwith %} -
+ View what Claude Code will receive on /setup →
{% endif %} diff --git a/docs/welcome-template.md b/docs/agent-setup-prompt.md similarity index 94% rename from docs/welcome-template.md rename to docs/agent-setup-prompt.md index 7bd31fb..72c1575 100644 --- a/docs/welcome-template.md +++ b/docs/agent-setup-prompt.md @@ -1,6 +1,6 @@ -# Welcome prompt customization +# Agent Setup Prompt -The welcome prompt is the `CLAUDE.md` file generated in an analyst's local +The agent setup prompt is the `CLAUDE.md` file generated in an analyst's local workspace by `da analyst setup`. It instructs Claude Code on how to behave in that workspace — which commands to use, where to read schema metadata, what metrics exist, what plugins are available. @@ -15,7 +15,7 @@ no admin action is required. Admins can override the template via: -- **Admin UI:** `/admin/welcome` — textarea editor with placeholder cheatsheet +- **Admin UI:** `/admin/agent-prompt` — textarea editor with placeholder cheatsheet and live preview button. Save sends a `PUT` to `/api/admin/welcome-template`. - **REST API:** - `GET /api/admin/welcome-template` — returns `{content, default, updated_at, updated_by}`. `content` is `null` when no override is set. @@ -32,7 +32,7 @@ audit trail (`updated_at`, `updated_by`) is preserved. [Jinja2](https://jinja.palletsprojects.com/) with `StrictUndefined`. Any typo in a placeholder name raises an error at render time rather than silently emitting an empty string. Server returns HTTP 500 with a hint -pointing at `/admin/welcome`; the admin UI rejects syntax errors AND +pointing at `/admin/agent-prompt`; the admin UI rejects syntax errors AND undefined-placeholder errors with HTTP 400 on save (validated by rendering the template against a stub context before persisting). diff --git a/tests/snapshots/openapi.json b/tests/snapshots/openapi.json index 76e7c8b..f163fb0 100644 --- a/tests/snapshots/openapi.json +++ b/tests/snapshots/openapi.json @@ -3358,9 +3358,9 @@ ] } }, - "/admin/welcome": { + "/admin/agent-prompt": { "get": { - "operationId": "admin_welcome_page_admin_welcome_get", + "operationId": "admin_agent_prompt_page_admin_agent_prompt_get", "parameters": [ { "in": "header", diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py index e054a24..73408d6 100644 --- a/tests/test_web_ui.py +++ b/tests/test_web_ui.py @@ -233,14 +233,16 @@ class TestClaudeSetupPreview: assert "da diagnose" in body assert "da auth whoami" in body - def test_dashboard_preview_visible(self, web_client, admin_cookie): + def test_dashboard_setup_cta_links_to_setup(self, web_client, admin_cookie): + """Dashboard setup CTA shows env-setup-cta and a link to /setup instead + of an inline collapsed preview.""" resp = web_client.get("/dashboard", cookies=admin_cookie) assert resp.status_code == 200 body = resp.text assert "env-setup-cta" in body - assert "setup-preview-pre" in body - assert "What Claude Code will receive" in body - assert "<will be generated on click>" in body + assert "View what Claude Code will receive on /setup" in body + # inline
preview block must no longer appear + assert 'aria-label="Preview of the clipboard payload"' not in body def test_install_mcp_card_removed(self, web_client): """The stale 'Use with Claude Code / MCP' card on /setup has been diff --git a/tests/test_welcome_template_api.py b/tests/test_welcome_template_api.py index 4b525e8..5440865 100644 --- a/tests/test_welcome_template_api.py +++ b/tests/test_welcome_template_api.py @@ -102,7 +102,7 @@ def test_put_rejects_undefined_placeholder(seeded_app): def test_get_welcome_500_includes_reset_hint_on_render_failure(seeded_app, monkeypatch): """If an override slips through validation and fails at render time, the - user-visible 500 must point at /admin/welcome rather than leaking a + user-visible 500 must point at /admin/agent-prompt rather than leaking a Jinja stack trace.""" # Stub render_welcome to raise a TemplateError so we exercise the # exception path without needing a malformed override (PUT validation @@ -123,7 +123,7 @@ def test_get_welcome_500_includes_reset_hint_on_render_failure(seeded_app, monke headers=admin, ) assert r.status_code == 500 - assert "/admin/welcome" in r.json()["detail"] + assert "/admin/agent-prompt" in r.json()["detail"] def test_admin_preview_renders_arbitrary_content(seeded_app):