export async function autoSync(scopes, cwd, home, logger, dependencies, options) {
    if (scopes.length === 0) {
        return { synced: false, scopes: [], error: null };
    }
    try {
        for (const scope of scopes) {
            await dependencies.runSync({
                scope,
                cwd,
                home,
                installedCanonicalPaths: options?.installedCanonicalPaths,
            });
        }
        logger.info('Auto-sync completed.');
        return { synced: true, scopes, error: null };
    }
    catch (err) {
        const message = err instanceof Error ? err.message : String(err);
        logger.warn(`Auto-sync failed: ${message}`);
        return { synced: false, scopes, error: message };
    }
}
