Ship a Logbuch skill and record token use

- docs/skill.md teaches a Claude what Logbuch is for, how an entry sounds
  and in which order the calls go, served at GET /api/v1/skill and as a
  download next to the spec and the guide
- a test keeps the skill from drifting: frontmatter, only endpoints that
  exist, house rules
- resolveClient stamps last_used_at, the access list said never used even
  after eleven entries
This commit is contained in:
Matthias G
2026-08-03 10:40:48 +02:00
parent 06d0184965
commit 5072ff7249
12 changed files with 315 additions and 7 deletions
+8 -2
View File
@@ -1,5 +1,5 @@
import { createHash } from 'node:crypto'
import { findActiveClientByTokenHash } from '~/data/repositories/clients'
import { findActiveClientByTokenHash, markClientUsed } from '~/data/repositories/clients'
import type { ApiClient } from '~/data/schema'
export function hashToken(token: string): string {
@@ -19,5 +19,11 @@ export async function resolveClient(request: Request): Promise<ApiClient | undef
return undefined
}
return findActiveClientByTokenHash(hashToken(token))
const client = await findActiveClientByTokenHash(hashToken(token))
if (client) {
await markClientUsed(client.id)
}
return client
}