MCPcopy
hub / github.com/learnhouse/learnhouse / resolveTag

Function resolveTag

apps/cli/src/commands/update.ts:23–47  ·  view source on GitHub ↗
(version: string)

Source from the content-addressed store, hash-verified

21const GHCR_BASE = 'ghcr.io/learnhouse/app'
22
23async function resolveTag(version: string): Promise<boolean> {
24 try {
25 const tokenResp = await fetch(
26 'https://ghcr.io/token?scope=repository:learnhouse/app:pull',
27 { signal: AbortSignal.timeout(5000) },
28 )
29 if (!tokenResp.ok) return false
30 const { token } = (await tokenResp.json()) as { token: string }
31
32 const manifestResp = await fetch(
33 `https://ghcr.io/v2/learnhouse/app/manifests/${version}`,
34 {
35 signal: AbortSignal.timeout(5000),
36 headers: {
37 Accept:
38 'application/vnd.oci.image.index.v1+json, application/vnd.docker.distribution.manifest.list.v2+json',
39 Authorization: `Bearer ${token}`,
40 },
41 },
42 )
43 return manifestResp.ok
44 } catch {
45 return false
46 }
47}
48
49export async function updateCommand(options: { version?: string; migrate?: boolean; backup?: boolean }) {
50 const dir = findInstallDir()

Callers 1

updateCommandFunction · 0.85

Calls 2

fetchFunction · 0.85
jsonMethod · 0.45

Tested by

no test coverage detected