import { appendFileSync, existsSync, readFileSync, writeFileSync, } from "node:fs"; import { join } from "node:path"; import { getLogger } from "../../util/logger.js"; import type { WorkspaceMigration } from "./types.js"; const log = getLogger( "workspace-migration-078-release-notes-tavily-web-search", ); const MIGRATION_ID = "078-release-notes-tavily-web-search"; const MARKER = ``; const RELEASE_NOTE = `${MARKER} ## Tavily web search Tavily is now available as a web search provider. Add your Tavily API key in Settings → Models & Services, or run \`assistant keys set tavily \`, then select Tavily for Web Search. `; export const releaseNotesTavilyWebSearchMigration: WorkspaceMigration = { id: MIGRATION_ID, description: "Append release notes for Tavily web search to UPDATES.md", run(workspaceDir: string): void { const updatesPath = join(workspaceDir, "UPDATES.md"); try { if (existsSync(updatesPath)) { const existing = readFileSync(updatesPath, "utf-8"); if (existing.includes(MARKER)) { return; } const needsLeadingNewline = !existing.endsWith("\n\n"); const prefix = existing.endsWith("\n") ? "\n" : "\n\n"; appendFileSync( updatesPath, needsLeadingNewline ? `${prefix}${RELEASE_NOTE}` : RELEASE_NOTE, "utf-8", ); } else { writeFileSync(updatesPath, RELEASE_NOTE, "utf-8"); } log.info( { path: updatesPath }, "Appended Tavily web search release note", ); } catch (err) { log.warn( { err, path: updatesPath }, "Failed to append Tavily web search release note to UPDATES.md", ); } }, down(_workspaceDir: string): void { // Forward-only: UPDATES.md is a user-facing bulletin the assistant // processes and deletes on its own. }, };