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:
+8
-2
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user