import { skippedSection } from '../format.ts'
import type { BriefingInput, BriefingSection } from '../types.ts'
export async function homeSection(input: BriefingInput): Promise<BriefingSection> {
const items = Array.isArray(input.home?.items) ? input.home.items : []
const usable = items
.filter((item) => item && typeof item.title === 'string' && item.title.trim())
.map((item) => ({
title: item.title.trim(),
detail: item.detail,
severity: item.severity,
href: item.href,
label: item.label || 'home',
}))
if (!usable.length) {
return skippedSection(
'home',
'Pass home.items from your own home package. This official briefing does not call a personal home MCP.',
)
}
return {
id: 'home',
title: 'Home',
status: 'ok',
summary: `${usable.length} home signal${usable.length === 1 ? '' : 's'}`,
items: usable,
}
}