Build and Push Containers / build-and-push (push) Successful in 1m50s
One env var (BOR_APP_NAME, default "Brain of Reese") now drives the app's
display name everywhere (TODO.md L12 — owner ask: "a way to customize the
name for 'Brain of'. Should be an env var."). The existing app_name setting
is the source of truth (phase locked decision — no new variable, no rename);
with the variable unset the app is byte-identical to before.
Endpoint (A10 public/stateless, no secrets):
GET /api/config → exactly {app_name, version} (app/api/config.py, the
health.py pattern; registered before the static mount). Integration tests:
anonymous 200, default values, a Settings override follows, key set is
exactly two keys — no other setting may leak in later.
Frontend brand layer (A11 — runtime fetch, static templates stay static):
assets/brand.js — a CLASSIC script, first on all six pages, so its top
level runs at parse time: window.BOR_BRAND = "Brain of Reese"
synchronously (the default renders immediately, no blank flash), then a
no-store fetch of /api/config applies the name — document.title (global
replace), every .brand-text (a name starting "Brain of " keeps the bold
split Brain of <strong>rest</strong>, any other name renders plain; the
operator-controlled name is HTML-escaped before innerHTML), a TreeWalker
over text nodes (script/style rejected — page source never rewritten),
and the aria-label/placeholder/meta-content attributes. Fetch failure
keeps the default + console.warn (the loadHealth house style).
app.js (status labels, typing label, elapsed-hint aria, tool labels) and
document.js (viewer titles) read window.BOR_BRAND at CALL time via
brand() — a label set after the fetch lands carries the configured name.
Containerfile: esbuild minify line for brand.js (classic, like markdown.js);
the phase-33 ?v= cache-busting picks the new asset ref up automatically.
E2E (A16 — one story, one file, isolated): test_configurable_brand.py boots
a SECOND app instance (same DB/mock-LLM/admin-auth env block, port APP_PORT+1,
BOR_APP_NAME="Brain of Testy") — the shared conftest server keeps the
default name so every other suite's title/label assertions stay untouched —
and asserts /api/config on both instances, the index title/brand/greeting/
#messages aria-label, the sources + login page titles, and one pre-token
chat turn (think out loud marker) whose #send-status reads "Brain of Testy
is thinking"; the no-op regression pins the shared server's default bytes.
Docs: .env.example App section + README configuration reference — what it
affects (titles, header brand, status labels, aria text), the default, the
bold-split rendering rule.
Gates: 695 unit+integration passed, app/ coverage 99% (>90%), story E2E
green in isolation (two consecutive runs), brand-string suites (smoke,
shared header, header consistency, chat persistence) green, ruff + pyright
clean.
260 lines
15 KiB
HTML
260 lines
15 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
|
<meta name="description" content="Add and remove the git repositories Brain of Reese syncs and indexes (admin-only).">
|
|
<title>Git sources · Brain of Reese</title>
|
|
<link rel="icon" href="data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2064%2064%22%3E%3Cpath%20d=%22M32%204%2055%2018v28L32%2060%209%2046V18Z%22%20fill=%22%23121a2e%22%20stroke=%22%236d78f2%22%20stroke-width=%224%22%20stroke-linejoin=%22round%22/%3E%3Ccircle%20cx=%2232%22%20cy=%2232%22%20r=%226.5%22%20fill=%22%236d78f2%22/%3E%3Cpath%20d=%22M32%2025.5V16M32%2048v-9.5M25.5%2032H16M48%2032h-9.5%22%20stroke=%22%2322d3ee%22%20stroke-width=%223%22%20stroke-linecap=%22round%22/%3E%3C/svg%3E">
|
|
<link rel="stylesheet" href="/assets/styles.css">
|
|
</head>
|
|
<body>
|
|
<a class="skip-link" href="#main">Skip to content</a>
|
|
|
|
<!-- Phase 35: the SAME full header block every other page ships
|
|
(phase 34, owner confirmation 2026-08-26) — one shared owner of
|
|
the controls (assets/header.js via git-sources.js's relative
|
|
import). The admin-only "Git sources" nav link (#nav-git-sources)
|
|
joins this nav in phase 35 task 05, so it is NOT in this file
|
|
yet — the page lands without it, exactly like the other pages
|
|
land without the links task 05 adds to them. -->
|
|
<header class="app-header">
|
|
<div class="container header-inner">
|
|
<span class="brand">
|
|
<svg class="brand-mark" aria-hidden="true" viewBox="0 0 64 64"><path d="M32 4 55 18v28L32 60 9 46V18Z" fill="#121a2e" stroke="#6d78f2" stroke-width="4" stroke-linejoin="round"/><circle cx="32" cy="32" r="6.5" fill="#6d78f2"/><path d="M32 25.5V16M32 48v-9.5M25.5 32H16M48 32h-9.5" stroke="#22d3ee" stroke-width="3" stroke-linecap="round"/></svg>
|
|
<span class="brand-text">Brain of <strong>Reese</strong></span>
|
|
</span>
|
|
<nav class="app-nav" aria-label="Primary">
|
|
<a href="/" class="nav-link">Chat</a>
|
|
<!-- Phase 19 (now every page — phase 34, owner confirmation
|
|
2026-08-26): the Sources link is admin-only (owner
|
|
permission 2026-08-23) — hidden by default, header.js
|
|
reveals it once whoami says admin. -->
|
|
<a href="/sources.html" class="nav-link" id="nav-sources" hidden>Sources</a>
|
|
<!-- Phase 35 (owner permission 2026-08-26): the Git sources
|
|
link is admin-only — hidden by default, header.js
|
|
reveals it once whoami says admin, exactly like the
|
|
Sources link above; this page IS the current one, so the
|
|
link carries is-active + aria-current like Tuning on
|
|
tuning.html. -->
|
|
<a href="/git-sources.html" class="nav-link is-active" aria-current="page" id="nav-git-sources" hidden>Git sources</a>
|
|
<!-- Phase 29 (now every page — phase 34, owner confirmation
|
|
2026-08-26): the Global Tuning link is admin-only (owner
|
|
permission 2026-08-25) — hidden by default, header.js
|
|
reveals it once whoami says admin. -->
|
|
<a href="/tuning.html" class="nav-link" id="nav-tuning" hidden>Tuning</a>
|
|
</nav>
|
|
<!-- Phase 15 (now every page — phase 34, owner confirmation
|
|
2026-08-26): open the tuning-notes panel (stored in
|
|
Postgres, read into every system prompt). The behavior is
|
|
owned by the shared header module (assets/header.js); the
|
|
#steering-panel section ships in every page's <main>. -->
|
|
<button type="button" class="steering-toggle" id="steering-toggle"
|
|
aria-expanded="false" aria-controls="steering-panel">
|
|
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"><path d="M4 7h10M18 7h2M4 17h4M12 17h8"/><circle cx="15.5" cy="7" r="2.2"/><circle cx="9.5" cy="17" r="2.2"/></svg>
|
|
<span class="steering-label">Tuning</span>
|
|
<span class="steering-count" id="steering-count">0</span>
|
|
</button>
|
|
<!-- Phase 32 (now every page — phase 34, owner confirmation
|
|
2026-08-26): the admin-only "Sync sources" button — SHIPS
|
|
hidden (anonymous-safe), header.js reveals it for the admin
|
|
on the SAME cached whoami. The §7.4 "never stale" lifecycle
|
|
is module-owned (assets/header.js). This page's hint box
|
|
points at it: it is the action that clones the listed repos
|
|
and prunes the removed ones. -->
|
|
<button type="button" class="sync-btn" id="sync-btn" hidden aria-label="Sync sources">
|
|
<svg class="sync-icon" aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/></svg>
|
|
<span class="sync-label" id="sync-label">Sync sources</span>
|
|
</button>
|
|
<!-- Phase 14 (now every page — phase 34, owner confirmation
|
|
2026-08-26; module-owned since phase 34 task 02): on a
|
|
non-chat page "New chat" means "go to the chat, fresh" (the
|
|
module clears the key + navigates). -->
|
|
<button type="button" class="new-chat-btn" id="new-chat-btn" aria-label="New chat">
|
|
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"><path d="M12 5v14M5 12h14"/></svg>
|
|
<span class="new-chat-label">New chat</span>
|
|
</button>
|
|
<!-- Phase 16: single-admin auth — exactly one of Sign in / Sign
|
|
out is visible; /api/whoami decides at load (the shared
|
|
header module). Icon-only below 640px (aria-labels keep the
|
|
accessible names). -->
|
|
<a href="/login.html?next=/git-sources.html" class="auth-link" id="sign-in-link" hidden>
|
|
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M10 4h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-8"/><path d="M4 12h11"/><path d="m12 9 3 3-3 3"/></svg>
|
|
<span class="auth-label">Sign in</span>
|
|
</a>
|
|
<button type="button" class="auth-link" id="sign-out-btn" aria-label="Sign out" hidden>
|
|
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M14 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8"/><path d="M9 12h11"/><path d="m17 9 3 3-3 3"/></svg>
|
|
<span class="auth-label">Sign out</span>
|
|
</button>
|
|
</div>
|
|
</header>
|
|
|
|
<main id="main" class="app-main" tabindex="-1">
|
|
<!-- Phase 15 (now every page — phase 34, owner confirmation
|
|
2026-08-26): the tuning-notes panel — first child of <main>
|
|
on the non-chat pages, rendered + driven by assets/header.js
|
|
(shared), not the page script. -->
|
|
<section class="steering-panel" id="steering-panel" role="region"
|
|
aria-label="Tuning notes" hidden>
|
|
<div class="steering-panel-head">
|
|
<h2 class="steering-panel-title">Tuning notes</h2>
|
|
<p class="steering-panel-sub">Every note below steers all future answers.</p>
|
|
</div>
|
|
<ul class="steering-list" id="steering-list"></ul>
|
|
<p class="steering-empty" id="steering-empty">No tuning notes yet — press “Tune” under any answer to add one.</p>
|
|
</section>
|
|
<p class="visually-hidden" id="steering-announcer" role="status" aria-live="polite" aria-atomic="true"></p>
|
|
<div class="container git-sources-shell">
|
|
<!-- Phase 35: anonymous sign-in gate — the EXACT #sources-gate
|
|
pattern (phase 16) and the same .sources-gate visual
|
|
language: the page is the same shape as Sources. Visible
|
|
for anonymous, hidden for the admin (git-sources.js). The
|
|
catalog of git sources is what the login locks — chat stays
|
|
open to everyone (the soft rule). -->
|
|
<section class="sources-gate" id="git-sources-gate" aria-labelledby="git-sources-gate-title" hidden>
|
|
<div class="sources-gate-glyph" aria-hidden="true">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="10" width="16" height="10" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3"/><circle cx="12" cy="14.5" r="1.4" fill="currentColor" stroke="none"/><path d="M12 16v2"/></svg>
|
|
</div>
|
|
<h2 id="git-sources-gate-title">Sign in to manage the git sources</h2>
|
|
<p class="sources-gate-sub">
|
|
The list of repositories the <strong>Sync sources</strong> button
|
|
clones and indexes is admin-only. Chat — and any document an
|
|
answer cites — stays open to everyone.
|
|
</p>
|
|
<a class="sources-gate-link" href="/login.html?next=/git-sources.html">Sign in</a>
|
|
</section>
|
|
|
|
<!-- Phase 35: the manager — SHIPS hidden (anonymous-safe; the
|
|
gate is what anonymous visitors see). git-sources.js
|
|
reveals it once the cached whoami says admin, then loads
|
|
the list. Full-width table on the 72rem frame — the
|
|
Sources-page pattern, no skinny single-column list. -->
|
|
<div id="git-sources-content" hidden>
|
|
<div class="page-head">
|
|
<h1>Git sources</h1>
|
|
<p class="page-sub">
|
|
The git repositories and local directories the Sync button
|
|
imports. Add or remove them here — no <code>.env</code>, no
|
|
restart.
|
|
</p>
|
|
</div>
|
|
|
|
<!-- Load failure (role=alert) with a retry — a GET /api/git-sources
|
|
non-2xx or network failure must never leave a stuck page.
|
|
git-sources.js fills #git-sources-load-error-text. -->
|
|
<div class="git-source-load-error" id="git-sources-load-error" role="alert" hidden>
|
|
<span id="git-sources-load-error-text"></span>
|
|
<button type="button" id="git-sources-retry">Try again</button>
|
|
</div>
|
|
|
|
<!-- Env-fallback note (phase locked decision): while the
|
|
git_sources table is EMPTY the list above comes from
|
|
BOR_GIT_SOURCES in .env (from_env: true) — the note says
|
|
so, and that adding or removing here switches management
|
|
to the database. Hidden by default; git-sources.js shows
|
|
it off the API's from_env flag. -->
|
|
<p class="git-source-env-note" id="git-sources-env-note" role="note" hidden>
|
|
These sources currently come from <code>BOR_GIT_SOURCES</code> in
|
|
<code>.env</code> — adding or removing one here switches management
|
|
to the database.
|
|
</p>
|
|
|
|
<!-- Add form: visible label + mono URL input + brand button
|
|
(dark ink on brand 5.2:1). §7.4 never-stale: the button
|
|
disables + relabels "Adding…" while the POST is in flight
|
|
and re-enables on success AND failure (the input is kept
|
|
on failure, same as the tuning forms). -->
|
|
<form id="git-source-form">
|
|
<label for="git-source-url">Add a git source</label>
|
|
<input
|
|
id="git-source-url"
|
|
name="url"
|
|
type="text"
|
|
maxlength="500"
|
|
autocomplete="off"
|
|
placeholder="https://github.com/you/homelab.git"
|
|
required
|
|
>
|
|
<button type="submit" id="git-source-add">Add source</button>
|
|
<p class="git-source-error" id="git-source-error" role="alert" hidden></p>
|
|
</form>
|
|
|
|
<!-- Phase 38: the second add form — "Local directory": an
|
|
existing directory on the server (NOT a git repo), walked
|
|
directly by Sync / import_docs. The SAME never-stale-button
|
|
+ inline-error pattern as the git form (PLAN §7.4): the
|
|
button disables + relabels "Adding…" while the POST is out
|
|
and recovers on success AND failure; on success the input
|
|
clears and the list re-fetches (the new row lands with the
|
|
Local badge). A missing/relative path 422s with the path
|
|
named inline (paths are not secrets, unlike git URLs). -->
|
|
<form id="local-source-form">
|
|
<label for="local-source-path">Add a local directory</label>
|
|
<input
|
|
id="local-source-path"
|
|
name="path"
|
|
type="text"
|
|
maxlength="2000"
|
|
autocomplete="off"
|
|
placeholder="~/Notes"
|
|
required
|
|
>
|
|
<button type="submit" id="local-source-add">Add directory</button>
|
|
<p class="git-source-error" id="local-source-error" role="alert" hidden></p>
|
|
</form>
|
|
|
|
<div class="table-wrap" id="git-sources-table-wrap" role="region" aria-label="Sources" tabindex="0">
|
|
<table class="git-sources-table" id="git-sources-table">
|
|
<caption class="visually-hidden">Sources the Sync button imports — git repositories it clones and local directories it walks</caption>
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Source</th>
|
|
<th scope="col">Added</th>
|
|
<th scope="col">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="git-sources-tbody"></tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- Empty state — no stored rows AND no env fallback. With
|
|
from_env, the env note above already explains where the
|
|
active list comes from. -->
|
|
<p class="git-sources-empty" id="git-sources-empty" hidden>No sources stored yet.</p>
|
|
|
|
<!-- Scope boundary (phase locked decision): adding/removing a
|
|
source does NOT clone or prune — the Sync button performs
|
|
that. The hint says so (phase 38: git + local together,
|
|
files removed from a source pruned). -->
|
|
<p class="git-source-hint" id="git-sources-hint" role="note">
|
|
Sync clones/pulls the git repos and imports the local
|
|
directories together (files removed from a source are
|
|
pruned). Use the <strong>Sync sources</strong> button in the
|
|
header (or on the Sources page) to run it — removing a source
|
|
prunes its documents from the index on the next sync.
|
|
</p>
|
|
</div>
|
|
<!-- Polite live region: the screen-reader confirmation for list
|
|
loads, adds, and removals (git-sources.js owns the text). -->
|
|
<p class="visually-hidden" id="git-sources-announcer" role="status" aria-live="polite"></p>
|
|
</div>
|
|
</main>
|
|
|
|
<footer class="app-footer">
|
|
<div class="container footer-inner">
|
|
<span>Powered by Reese's self-hosted models</span>
|
|
</div>
|
|
</footer>
|
|
|
|
<!-- Phase 35: the page module loads the shared header through its
|
|
own `import "./header.js"` — a hoisted import evaluated before
|
|
this body runs (the single-evaluation design: no direct
|
|
header.js <script> tag; esbuild inlines it into the page
|
|
bundle in the image build). -->
|
|
<!-- Phase 39: the brand layer — classic script, first on the page:
|
|
window.BOR_BRAND at parse time, refreshed from /api/config. -->
|
|
<script src="assets/brand.js"></script>
|
|
<script type="module" src="/assets/git-sources.js"></script>
|
|
</body>
|
|
</html>
|