import { ChevronDown, Info } from 'lucide-react' import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { OPENCODE_CONFIG_SOURCE_NAMES } from '@opencode-manager/shared' import { getOpenCodeConfigSources, getPreferredOpenCodeConfigSource, } from '@/api/types/settings' import type { OpenCodeConfigFile, OpenCodeConfigSourceName } from '@/api/types/settings' interface OpenCodeConfigSourcesNoticeProps { config: OpenCodeConfigFile targetName?: OpenCodeConfigSourceName } export function OpenCodeConfigSourcesNotice({ config, targetName }: OpenCodeConfigSourcesNoticeProps) { const sources = getOpenCodeConfigSources(config) if (sources.length <= 1) return null const orderedNames = OPENCODE_CONFIG_SOURCE_NAMES.filter((name) => sources.some((source) => source.name === name), ) const writeTargetName = targetName ?? getPreferredOpenCodeConfigSource(config)?.name if (!writeTargetName) return null return (
Multiple configuration files are merged

OpenCode loads these files in order, with each later file overriding matching settings from the files before it:{' '} {orderedNames.map((name, index) => ( {index > 0 ? ', ' : ''} {name} ))}

Saves apply only to {writeTargetName}. A value saved to a lower-priority file can be overridden by a higher-priority file.

For simpler configuration, consolidate the settings you need into one file, then remove redundant files after verifying the result.

) }