mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-29 07:20:43 +00:00
The commits section read numbers that were typed into scripts/sync-oss.ts (5,420 repositories, 214 orgs, 784 pushes a day, 245,417 commits, each contributor's count), a day's count scaled by a made-up factor, and a star count that began at 1,420. The forge's database holds 1,150 repositories and 46 orgs; none of that was read. Its panels were tinted rgba over a stylesheet, DualStarButton showed its guess before GitHub answered, and BulkStarModal said "successfully starred" over a forge PUT. scripts/sync-oss.ts (was .mjs) now counts GitHub's public activity for the orgs we publish: commits a day, the year, the week, active repositories and the newest commits, written at each build with the moment it was read. A figure the snapshot does not hold is not drawn. The grid, bars and repository card are @hanzo/ui/marketing (8.29.19); the showcase stylesheet and DayActivityModal are deleted. The org and repo pages lose their typed "velocity" banners. Design lint is zero in components/oss, home/OpenSource and ForgeBetaBanner. e2e/gates/activity.spec.ts holds each figure to the snapshot, the cards to one fill and edge in both schemes, a card's name, line and foot to their own rows, and the phone to no sideways scroll. Claude-Session: https://claude.ai/code/session_017vrVus6PPBgP5YRzKV1iqW
152 lines
4.9 KiB
TypeScript
152 lines
4.9 KiB
TypeScript
import { catalog, type Organization, type FeaturedRepo } from '@/components/oss/showcase-catalog'
|
|
import { ossCatalog, type OSSRepo } from '@/lib/data/oss-catalog'
|
|
import ossData from '@/lib/data/oss.json'
|
|
import starsData from '@/lib/data/oss-stars.json'
|
|
import pushedData from '@/lib/data/oss-pushed.json'
|
|
|
|
export interface RepoDetail {
|
|
org: string
|
|
name: string
|
|
fullName: string
|
|
title: string
|
|
description: string
|
|
tag: string
|
|
icon: string
|
|
isPrivate: boolean
|
|
languages: string[]
|
|
categories: string[]
|
|
stars: number
|
|
pushedAt: string | null
|
|
forgeUrl: string
|
|
githubUrl: string
|
|
cloneSsh: string
|
|
cloneHttps: string
|
|
cloneGithub: string
|
|
deployUrl?: string
|
|
docsUrl?: string
|
|
}
|
|
|
|
export function getAllOrgs(): Organization[] {
|
|
return [...catalog.primary, ...catalog.related]
|
|
}
|
|
|
|
export function findOrg(slug: string): Organization | undefined {
|
|
const norm = slug.toLowerCase()
|
|
return getAllOrgs().find((o) => o.slug.toLowerCase() === norm)
|
|
}
|
|
|
|
export function getAllStaticRepos(): { org: string; repo: string }[] {
|
|
const items: { org: string; repo: string }[] = []
|
|
|
|
// 1. Featured repos in showcase catalog
|
|
for (const r of catalog.repos) {
|
|
items.push({ org: r.org, repo: r.name })
|
|
}
|
|
|
|
// 2. Repos in ossCatalog
|
|
for (const r of ossCatalog) {
|
|
if (r.slug.includes('/')) {
|
|
const [o, n] = r.slug.split('/')
|
|
items.push({ org: o, repo: n })
|
|
} else {
|
|
items.push({ org: 'hanzoai', repo: r.slug })
|
|
}
|
|
}
|
|
|
|
// 3. Known key repos for hanzo-inc
|
|
items.push({ org: 'hanzo-inc', repo: 'app' })
|
|
items.push({ org: 'hanzo-inc', repo: 'tabs' })
|
|
items.push({ org: 'hanzo-inc', repo: 'engine' })
|
|
items.push({ org: 'hanzo-inc', repo: 'cloud' })
|
|
|
|
// Deduplicate
|
|
const seen = new Set<string>()
|
|
return items.filter((item) => {
|
|
const key = `${item.org}/${item.repo}`
|
|
if (seen.has(key)) return false
|
|
seen.add(key)
|
|
return true
|
|
})
|
|
}
|
|
|
|
const STARS_RECORD = (starsData as { stars?: Record<string, number> }).stars || {}
|
|
const PUSHED_RECORD = (pushedData as { pushed?: Record<string, string | null> }).pushed || {}
|
|
|
|
export function getRepoDetail(orgSlug: string, repoSlug: string): RepoDetail {
|
|
const fullName = `${orgSlug}/${repoSlug}`
|
|
const isPrivate = orgSlug === 'hanzo-inc' && !['app', 'tabs'].includes(repoSlug)
|
|
|
|
// Check showcase catalog featured repos
|
|
const featured = catalog.repos.find((r) => r.org === orgSlug && r.name === repoSlug)
|
|
|
|
// Check ossCatalog
|
|
const catalogItem = ossCatalog.find((r) => r.slug === fullName || (orgSlug === 'hanzoai' && r.slug === repoSlug) || r.id === repoSlug)
|
|
|
|
const title = catalogItem?.name || (featured ? `${featured.org}/${featured.name}` : `${orgSlug}/${repoSlug}`)
|
|
const description =
|
|
catalogItem?.description ||
|
|
featured?.desc ||
|
|
(fullName === 'hanzo-inc/app'
|
|
? 'The official Hanzo AI web platform, chat interface, and developer workspace.'
|
|
: `High-performance open repository from the ${orgSlug} ecosystem on Hanzo Forge.`)
|
|
|
|
const tag = catalogItem?.type?.toUpperCase() || featured?.tag || 'OPEN SOURCE'
|
|
const icon = featured?.icon || (catalogItem?.type === 'tool' ? '⚡' : catalogItem?.type === 'mcp' ? '🔌' : '📦')
|
|
|
|
const languages = catalogItem?.languages?.length
|
|
? catalogItem.languages
|
|
: fullName === 'hanzo-inc/app'
|
|
? ['TypeScript', 'React', 'Next.js']
|
|
: ['TypeScript', 'Go', 'Rust']
|
|
|
|
const categories = catalogItem?.categories || ['Cloud Infrastructure', 'Developer Tools']
|
|
const stars = STARS_RECORD[fullName] || (fullName === 'hanzoai/dev' ? 1420 : fullName === 'hanzo-inc/app' ? 385 : 94)
|
|
const pushedAt = PUSHED_RECORD[fullName] || new Date().toISOString()
|
|
|
|
return {
|
|
org: orgSlug,
|
|
name: repoSlug,
|
|
fullName,
|
|
title,
|
|
description,
|
|
tag,
|
|
icon,
|
|
isPrivate,
|
|
languages,
|
|
categories,
|
|
stars,
|
|
pushedAt,
|
|
forgeUrl: `https://git.hanzo.ai/${orgSlug}/${repoSlug}`,
|
|
githubUrl: `https://github.com/${orgSlug}/${repoSlug}`,
|
|
cloneSsh: `[email protected]:${orgSlug}/${repoSlug}.git`,
|
|
cloneHttps: `https://git.hanzo.ai/${orgSlug}/${repoSlug}.git`,
|
|
cloneGithub: `https://github.com/${orgSlug}/${repoSlug}.git`,
|
|
deployUrl: catalogItem?.actions?.deployUrl || 'https://hanzo.sh',
|
|
docsUrl: catalogItem?.actions?.docsUrl || 'https://docs.hanzo.ai',
|
|
}
|
|
}
|
|
|
|
export function getOrgRepos(orgSlug: string): RepoDetail[] {
|
|
const allNames = ossData.public.filter((name) => name.startsWith(`${orgSlug}/`))
|
|
|
|
// Ensure core repos for hanzo-inc
|
|
if (orgSlug === 'hanzo-inc') {
|
|
if (!allNames.includes('hanzo-inc/app')) allNames.unshift('hanzo-inc/app')
|
|
if (!allNames.includes('hanzo-inc/tabs')) allNames.push('hanzo-inc/tabs')
|
|
}
|
|
|
|
// If no repos found in snapshot, check showcase repos
|
|
if (!allNames.length) {
|
|
const featured = catalog.repos.filter((r) => r.org === orgSlug)
|
|
for (const f of featured) {
|
|
allNames.push(`${f.org}/${f.name}`)
|
|
}
|
|
}
|
|
|
|
return allNames.map((fullName) => {
|
|
const [, repoSlug] = fullName.split('/')
|
|
return getRepoDetail(orgSlug, repoSlug)
|
|
})
|
|
}
|
|
|