Add browser job capture to the job tracker
Deploy with Docker Compose / deploy (push) Successful in 1m31s

A Violentmonkey userscript, served by the site and installed from /cv/jobs,
adds the posting open in the browser (LinkedIn, an ATS, any company page) to
the tracker. Claude reads the title, company and location off the page text.

- Three token-guarded REST routes under /api/jobs/capture (status, extract,
  upsert). They take a bearer token, JOB_CAPTURE_TOKEN, because the auth
  cookies are SameSite=Lax and never sent from another origin. An unset token
  switches the routes off.
- The upsert matches on a canonical posting URL, then (company, job title),
  so a capture and the email pipeline do not make two rows for one job.
- The Claude call is a new internal Python route, /internal/jobs/extract,
  alongside the rowing reader; the client and fence stripping they share move
  to python/app/claude.py.
- New "saved" status ranked below "applied", and a description column holding
  the posting text, shown per row on the tracker.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-12 13:33:28 +01:00
co-authored by Claude Opus 5.5
parent 94eaa8e239
commit b8670246a8
28 changed files with 2003 additions and 145 deletions
+107 -7
View File
@@ -4,6 +4,10 @@
* applications and for the reusable reference snippets that feed the CV copy.
* Two independent CRUD tables over GraphQL; editing is inline via an `editingId`
* plus a scratch copy of the row.
*
* Rows also arrive from two places that are not this page: the email pipeline,
* and the browser userscript in `public/job-capture.user.js`, which the header
* links to for installing.
*/
import { ref, computed, onMounted } from "vue";
import { RouterLink } from "vue-router";
@@ -21,6 +25,8 @@ const error = ref("");
* Labels are display-only.
*/
const STATUS_OPTIONS = [
// Captured from the browser but not applied to yet. No email produces it.
{ value: "saved", label: "Saved" },
{ value: "applied", label: "Applied" },
{ value: "screening", label: "Screening" },
{ value: "assessment", label: "Assessment" },
@@ -31,6 +37,7 @@ const STATUS_OPTIONS = [
];
// Statuses still in play — used to decide whether a row is worth chasing.
// "saved" is absent on purpose: nobody owes a reply on a job not applied to.
const OPEN_STATUSES = ["applied", "screening", "assessment", "interviewing"];
const STALE_DAYS = 14;
@@ -57,8 +64,15 @@ const editRefForm = ref({});
const REF_CATEGORIES = ["profile", "experience"];
const REF_FIELDS = `id category label value sortOrder createdAt`;
// `description` is deliberately not here: it is the full text of the posting,
// tens of kilobytes a row, and is fetched per row when asked for.
const APP_FIELDS = `id jobTitle company location url status notes appliedAt createdAt updatedAt`;
// The captured posting text for the one row whose description is open.
// `undefined` in the cache means "not fetched", `""` means "fetched, none saved".
const descriptionId = ref(null);
const descriptions = ref({});
// Filter/sort state. All of it runs over the already-loaded array — the query
// has no arguments and the dataset is one person's applications.
const search = ref("");
@@ -210,6 +224,25 @@ async function setStatus(app, status) {
}
}
async function toggleDescription(app) {
if (descriptionId.value === app.id) {
descriptionId.value = null;
return;
}
descriptionId.value = app.id;
if (descriptions.value[app.id] !== undefined) return;
try {
const data = await gql(
`query JobDescription($id: ID!) { jobApplication(id: $id) { description } }`,
{ id: app.id },
);
descriptions.value[app.id] = data.jobApplication?.description ?? "";
} catch (err) {
descriptionId.value = null;
fail(err);
}
}
async function deleteApplication(app) {
// Delete sits next to Edit in a 0.4rem-gap row and the notes it takes with
// it are not recoverable through any UI path.
@@ -445,13 +478,27 @@ onMounted(() => {
<RouterLink to="/cv" class="ja-back">← CV</RouterLink>
<h2 class="ja-heading">Job Applications</h2>
</div>
<button
class="cv-btn"
@click="exportCsv"
:disabled="!applications.length"
>
Export CSV
</button>
<div class="ja-header-right">
<!-- A plain link to a static file: Violentmonkey intercepts any
navigation to a URL ending in .user.js and offers to install it.
The token it then asks for is the server's JOB_CAPTURE_TOKEN. -->
<a
class="cv-btn"
href="/job-capture.user.js"
target="_blank"
rel="noopener"
title="Violentmonkey userscript that adds the job you are viewing. After installing, set the capture token from its menu: Configure job capture."
>
Install capture script
</a>
<button
class="cv-btn"
@click="exportCsv"
:disabled="!applications.length"
>
Export CSV
</button>
</div>
</div>
<div v-if="error" class="ja-error" role="alert">
@@ -676,6 +723,13 @@ onMounted(() => {
{{ app.notes ?? "" }}
</td>
<td class="ja-actions">
<button
class="cv-btn cv-btn-sm"
title="Posting text saved when the job was captured"
@click="toggleDescription(app)"
>
{{ descriptionId === app.id ? "Hide" : "Posting" }}
</button>
<button class="cv-btn cv-btn-sm" @click="startEdit(app)">
Edit
</button>
@@ -756,6 +810,20 @@ onMounted(() => {
</button>
</td>
</tr>
<tr v-if="descriptionId === app.id" class="ja-desc-row">
<td colspan="7">
<p v-if="descriptions[app.id] === undefined" class="ja-empty">
Loading…
</p>
<pre v-else-if="descriptions[app.id]" class="ja-desc">{{
descriptions[app.id]
}}</pre>
<p v-else class="ja-empty">
No posting text saved — only jobs added with the capture script
have one.
</p>
</td>
</tr>
</template>
</tbody>
</table>
@@ -787,6 +855,14 @@ onMounted(() => {
gap: 1rem;
}
.ja-header-right {
display: flex;
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
justify-content: flex-end;
}
.ja-back {
font-size: 0.85rem;
color: var(--color-ink-muted);
@@ -978,6 +1054,25 @@ onMounted(() => {
white-space: nowrap;
}
/* The posting text is long, so it scrolls inside the row instead of pushing
the rest of the table off the screen. */
.ja-desc {
max-height: 22rem;
overflow: auto;
margin: 0;
padding: 0.6rem;
border: 1px solid var(--color-line-soft);
border-radius: 4px;
background: var(--color-paper);
font-family: inherit;
font-size: 0.8rem;
white-space: pre-wrap;
}
.ja-desc-row:hover td {
background: transparent;
}
.ja-link {
color: var(--color-ink-link);
text-decoration: none;
@@ -1005,6 +1100,11 @@ onMounted(() => {
appearance: none;
}
.ja-badge-saved {
background: var(--color-paper);
color: var(--color-ink-muted);
border-style: dashed;
}
.ja-badge-applied {
background: #eef2ff;
color: #3730a3;