Prompt #123

Back to prompts
Author rag-stack /governance/{page} blueprint
Code Β· claude-3.7-sonnet
5/5
Variables
{'name': 'page', 'description': 'snake_case slug'}, {'name': 'feature_description', 'description': 'what the board surfaces'}
Tags
stack-aware,rag-stack,governance,blueprint,ap56
Source
research-2026-05-01-stack-aware-handcrafted
Use count
0
Created
2026-05-01T18:30:35.938632+00:00
Updated
2026-05-01T18:30:35.938632+00:00

Content

Add a new governance UI page at `/governance/{page}` in rag-stack, modeled after AP56 Knowledge Governance Board.

Files to create in `/nvmetank1/projects/rag-stack/`:
1. `src/rag_stack/web/{page}_api.py` β€” Flask blueprint `{page}_bp`:
   - `GET /api/v1/{page}` for JSON data (queries rag.db via `sqlite3.connect(GLUG_DB_PATH or RAG_STACK_DB_PATH or '/data/rag.db')`)
   - Use fresh connection per request (sqlite3 not thread-safe across workers)
   - Always return JSON, never HTML errors. 200/404/500 with `{{ok, error}}` shape.
2. `src/rag_stack/web/{page}_ui.py` β€” UI blueprint, `url_prefix="/governance/{page}"`
3. `templates/{page}/board.html` β€” match `kg-*` CSS-class style from `templates/knowledge_governance/board.html` (tabs, badges, tables)
4. `tests/{page}/test_routes.py` β€” at least: empty-DB graceful, populated case, POST mutations, edge cases. Use `tmp_path` fixture.

Wire-up:
- `src/rag_stack/web/app.py:create_app()`: `from rag_stack.web.{page}_api import {page}_bp; app.register_blueprint({page}_bp)`
- Same in `tests/conftest.py:create_rag_stack_app`
- Add nav link in `templates/self_service/base.html` between existing tabs

Feature: {feature_description}