Wire the app like the boilerplate: door, queue, schedules, eight tabs

app/main.py assembles it in the boilerplate's order, auth.connect first,
then the queue with the scheduler and the pages. TABS is Roles,
Applications, Agents, Companies, Jobs, Schedules, Messages and Account:
the alpha page's three views become templates on the boilerplate's
base.html, driven by static/roles.js (the old app.js) through api() and
toasts.js, over the unchanged JSON routes. Companies lists every board with
its open roles and the affinity control. A 422 is one sentence, so a toast
never reads [object Object].

Config takes the boilerplate's shape: APP_CONFIG or config.yaml, a missing
file is the defaults, an unknown key is an error. roles.yaml is gone;
config.yaml is the committed default and carries the starter agents.

pull is now a job that asks for the pull cascade, because a schedule
enqueues a job kind; its default schedule, every 6h, is declared beside it
in app/jobs/cascade.py. pull_batch's targets are keyword-only so the Jobs
tab offers no batch button. `app worker` is the boilerplate's; `app job`
still drains a queue of its own and fires no schedules.

test_coupling holds pipeline, auth and desk apart (desk may import
pipeline) and plugins to desk; test_architecture keeps app's layers, now
with main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-23 12:48:12 +02:00
1 parent 24508dd6fc
commit 59a301c351
42 files changed
+2407 -998

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
{% extends "base.html" %}
{% block title %}Account — roledesk{% endblock %}
{% block content %}
<h1>Account</h1>
<p class="lede">One password, the sessions it has opened, and the passkeys registered beside it. There is no user to create and none to delete, because there is one. <code>docs/password-protection.md</code> is the reasoning behind every choice on this page; <code>auth/README.md</code> is how to take the folder into another project.</p>
<section class="card">
{# As on the Jobs and Schedules tabs: the element and its script belong to
the module, so this page is two lines and `auth/` owns what they draw.
It says its own failures in place, beside the button that caused them,
and raises `auth-account:error` with the server's `detail` as well. No
toast is wired to that here on purpose: one failure said twice is worse
than one failure said once, and next to the form is where it belongs. #}
<script type="module" src="/_auth/account.js"></script>
<auth-account></auth-account>
</section>
{% endblock %}
+37
View File
@@ -0,0 +1,37 @@
{% extends "base.html" %}
{% block title %}Agents — roledesk{% endblock %}
{% block content %}
<h1>Search agents</h1>
<p class="lede">A search agent is a named search: an intent that <code>fit</code> is measured against, gates that require or prefer a column value, and the weights of each term. Saving one rescores it; the Roles tab orders by it when it is picked there.</p>
<p id="agents-count" class="count" role="status"></p>
<ul id="agents-list" class="agents"></ul>
<form id="agent-form" class="agent-form" autocomplete="off">
<h2 id="agent-form-title">New agent</h2>
<input type="hidden" id="a-id">
<label>Name <input type="text" id="a-name" required></label>
<label>Intent <span class="hint">a CV paragraph, or what this search is for</span>
<textarea id="a-intent" rows="5"></textarea></label>
<label>Gates <span class="hint">JSON: [{"field": "place", "values": ["Berlin"], "mode": "require"}, {"field": "remote", "values": ["remote"], "mode": "prefer", "weight": 0.2}]</span>
<textarea id="a-gates" rows="5" spellcheck="false">[]</textarea></label>
<fieldset class="weights">
<legend>Weights</legend>
<label>Fit <input type="number" id="a-fit" min="0" step="0.05" value="0.6"></label>
<label>Recency <input type="number" id="a-recency" min="0" step="0.05" value="0.2"></label>
<label>Affinity <input type="number" id="a-affinity" min="0" step="0.05" value="0.2"></label>
</fieldset>
<label class="inline"><input type="checkbox" id="a-enabled" checked> Enabled</label>
<div class="agent-actions">
<button type="submit">Save and score</button>
<button type="button" id="a-new" class="secondary">New</button>
<button type="button" id="a-delete" class="secondary" hidden>Delete</button>
</div>
<p id="agent-status" class="count" role="status"></p>
</form>
{% endblock %}
{% block scripts %}
<script src="{{ asset('roles.js') }}"></script>
{% endblock %}
+24
View File
@@ -0,0 +1,24 @@
{% extends "base.html" %}
{% block title %}Applications — roledesk{% endblock %}
{% block content %}
<h1>Applications</h1>
<p class="lede">Every role saved from the Roles tab, and where it stands. A status change is recorded as an event, which is what days to first screen and conversion are computed from.</p>
<p id="applications-count" class="count" role="status"></p>
<table class="list">
<thead>
<tr><th>Role</th><th>Company</th><th>Status</th><th>Next</th></tr>
</thead>
<tbody id="applications-list"></tbody>
</table>
{% endblock %}
{% block scripts %}
<script>
// The tracker's status vocabulary, from the same `STATUSES` tuple the
// store validates a status change against; see app/web/pages.py.
window.ROLEDESK_STATUSES = {{ status_options | map(attribute=0) | list | tojson }};
</script>
<script src="{{ asset('roles.js') }}"></script>
{% endblock %}
+35
View File
@@ -0,0 +1,35 @@
{# The frame every page is in. The nav is `TABS` from app/web/pages.py and
nothing else: adding a tab is one entry in that list, never a link here. #}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>{% block title %}roledesk{% endblock %}</title>
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='2' y='2' width='12' height='12' rx='3' fill='none' stroke='%2314655b' stroke-width='1.8'/%3E%3C/svg%3E">
<link rel="stylesheet" href="{{ asset('app.css') }}">
</head>
<body>
<header class="top">
<a class="brand" href="/">role<span>desk</span></a>
<nav>
{% for tab in TABS %}
<a href="{{ tab.path }}"
{% if request.url.path == tab.path %}class="active" aria-current="page"{% endif %}>{{ tab.label }}</a>
{% endfor %}
</nav>
</header>
<main>
{% block content %}{% endblock %}
</main>
{# toasts first, and the order is load-bearing: it owns `window.toast`, which
app.js calls on a failed fetch and live.js feeds server notices into, and
`window.esc`, which every page script below builds its HTML with. #}
<script src="{{ asset('toasts.js') }}"></script>
<script src="{{ asset('app.js') }}"></script>
<script src="{{ asset('live.js') }}"></script>
{% block scripts %}{% endblock %}
</body>
</html>
+30
View File
@@ -0,0 +1,30 @@
{% extends "base.html" %}
{% block title %}Companies — roledesk{% endblock %}
{% block content %}
<h1>Companies</h1>
<p class="lede">Every company whose board is read, with how many of its roles are open. Affinity: <strong>M</strong>ute hides its roles and leaves them unscored, <strong>N</strong>eutral is the default, <strong>L</strong>ike raises the affinity term, <strong>F</strong>avourite skips the gates and floors the score at 0.9.</p>
<form class="filters" autocomplete="off" onsubmit="return false">
<input type="search" id="c-q" placeholder="Filter by name or board" aria-label="Filter companies">
<select id="c-affinity" aria-label="Affinity">
<option value="">Any affinity</option>
<option value="2">Favourite</option>
<option value="1">Like</option>
<option value="0">Neutral</option>
<option value="-1">Mute</option>
</select>
</form>
<p id="companies-count" class="count" role="status"></p>
<table class="list">
<thead>
<tr><th>Company</th><th>Board</th><th class="num">Open roles</th><th>Affinity</th></tr>
</thead>
<tbody id="companies-list"></tbody>
</table>
{% endblock %}
{% block scripts %}
<script src="{{ asset('roles.js') }}"></script>
{% endblock %}
+13
View File
@@ -0,0 +1,13 @@
{% extends "base.html" %}
{% block title %}{{ status }} — roledesk{% endblock %}
{% block content %}
<h1>{{ status }}</h1>
{# The server's own sentence, the same one `/api` callers get as `detail`.
Two wordings for one failure is how a page ends up telling you something
the API does not. #}
<p class="lede">{{ detail }}</p>
<p><a href="/">Back to the roles</a>, or <a href="/messages">see what the server has been saying</a>.</p>
{% endblock %}
+33
View File
@@ -0,0 +1,33 @@
{% extends "base.html" %}
{% block title %}Jobs — roledesk{% endblock %}
{% block content %}
<h1>Jobs</h1>
<p class="lede"><strong>pull</strong> runs the whole chain: every board, then extract, embed and score. <strong>extract</strong>, <strong>embed</strong> and <strong>score</strong> run one stage on their own. The buttons come from <code>/api/jobs/kinds</code>, so a new <code>@job</code> under <code>app/jobs/</code> appears here without an edit.</p>
<section class="card">
<h2>Start something</h2>
<div id="kinds" class="buttons">
<span class="muted">loading the job kinds…</span>
</div>
</section>
<section class="card">
{# The queue's own element, served by its own router. Two lines, and the
module owns what they draw — see pipeline/web/static/jobs.js.
The heading is the app's, because the element takes up no space while
nothing is running — that is its `idle="hide"` default, and a strip that
is always there is furniture — and a card with nothing in it and nothing
above it reads as something that failed to load. #}
<h2>What is running</h2>
<p class="muted small" id="idle">Nothing at the moment. Press one of the buttons above.</p>
<script type="module" src="/_jobs/jobs.js"></script>
<desk-jobs></desk-jobs>
</section>
{% endblock %}
{% block scripts %}
<script src="{{ asset('jobs.js') }}"></script>
{% endblock %}
+20
View File
@@ -0,0 +1,20 @@
{% extends "base.html" %}
{% block title %}Messages — roledesk{% endblock %}
{% block content %}
<h1>Messages</h1>
<p class="lede">Everything the server has said that nobody has cleared, newest first. A toast fades and is raised as often as not while no tab is open; this is where it is found again, with its fix, its raw error, and how many times it has been said. A row goes when you clear it, or a fortnight after it was last said.</p>
<section class="card">
<div class="row-between">
<h2>The log</h2>
<button type="button" id="clear-all" class="secondary">Clear all</button>
</div>
<div id="notices"><span class="muted">loading…</span></div>
</section>
{% endblock %}
{% block scripts %}
<script src="{{ asset('messages.js') }}"></script>
{% endblock %}
+67
View File
@@ -0,0 +1,67 @@
{% extends "base.html" %}
{% block title %}Roles — roledesk{% endblock %}
{# An empty shell: `static/roles.js` fills it and drives every action. The
server renders only the select options, from `app.models` and
`plugins.ats.FUNCTIONS`, so they cannot drift from what the store accepts. #}
{% block content %}
<form id="filters" class="filters" autocomplete="off">
<select id="f-agent" aria-label="Order">
<option value="">Newest</option>
</select>
<input type="search" id="f-q" placeholder="Search titles" aria-label="Search titles">
<input type="text" id="f-company" placeholder="Company" aria-label="Company">
<input type="text" id="f-place" placeholder="Place" aria-label="Place">
<select id="f-function" aria-label="Function">
<option value="">Any function</option>
{% for value, label in functions %}
<option value="{{ value }}">{{ label }}</option>
{% endfor %}
</select>
<select id="f-remote" aria-label="Remote">
<option value="">Any remote</option>
{% for value, label in remote_options %}
<option value="{{ value }}">{{ label }}</option>
{% endfor %}
</select>
<select id="f-days" aria-label="New in">
<option value="">Any time</option>
<option value="1">New in 1 day</option>
<option value="3">New in 3 days</option>
<option value="7">New in 7 days</option>
<option value="30">New in 30 days</option>
</select>
<label class="check">
<input type="checkbox" id="f-show-muted"> Show muted
</label>
<label class="check" id="show-gated" hidden>
<input type="checkbox" id="f-gated"> Show gated
</label>
</form>
<p id="roles-count" class="count" role="status"></p>
<ul id="roles-list" class="roles"></ul>
<template id="role-row">
<li class="role">
<div class="role-main">
<a class="role-title" target="_blank" rel="noopener"></a>
<span class="role-company"></span>
<span class="affinity" role="group"></span>
</div>
<div class="role-meta">
<span class="role-place"></span>
<span class="role-remote badge"></span>
<span class="role-function badge"></span>
<span class="role-score badge"></span>
<span class="role-gated"></span>
<span class="role-age"></span>
</div>
<button type="button" class="save"></button>
</li>
</template>
{% endblock %}
{% block scripts %}
<script src="{{ asset('roles.js') }}"></script>
{% endblock %}
+15
View File
@@ -0,0 +1,15 @@
{% extends "base.html" %}
{% block title %}Schedules — roledesk{% endblock %}
{% block content %}
<h1>Schedules</h1>
<p class="lede">A schedule enqueues a job kind on a cadence: <code>every 15m</code>, <code>every 6h</code>, <code>every 2d</code>, <code>daily at 06:00</code> or <code>weekly mon 07:00</code>, the clock ones read in <code>timezone</code> from <code>config.yaml</code>. The default, <code>pull</code> every 6h, is declared next to the <code>pull</code> job in <code>app/jobs/cascade.py</code>. It is a starting point: a cadence edited here, or a schedule switched off, survives restarts and deploys.</p>
<section class="card">
{# The element and its script are the scheduler's own, served by its own
router — see pipeline/web/static/schedules.js. Two lines, as with jobs. #}
<script type="module" src="/_jobs/schedules.js"></script>
<desk-schedules></desk-schedules>
</section>
{% endblock %}