import { setAppVersion, type AppVersion } from './version.ts'
/**
* Persist the published Lineage app version for the About view.
* Call after package_publish_external_push with the published commit.
*
* @param input - Published commit SHA, message, and timestamps
* @returns The stored version record
*
* @example
* import recordVersion from 'kody:@kentcdodds/lineage/record-version'
*
* const version = await recordVersion({
* sha: 'abc123',
* message: 'Add About page',
* committedAt: '2026-08-29T15:00:00Z',
* })
*/
export default async function recordVersion(input: {
sha: string
message?: string
committedAt?: string
publishedAt?: string
}): Promise<AppVersion> {
if (!input.sha?.trim()) {
throw new Error('recordVersion requires sha')
}
return await setAppVersion(input)
}