export const SOURCE_CHECKOUT_MANUAL_COMMAND = 'git pull && yarn build && systemctl --user restart reviewflow-app';
export async function triggerSelfUpdate(dependencies) {
    const { selfUpdateCommand, installTypeDetector } = dependencies;
    if (installTypeDetector.detect() === 'source-checkout') {
        return { status: 'source-checkout', manualCommand: SOURCE_CHECKOUT_MANUAL_COMMAND };
    }
    const updateResult = await selfUpdateCommand.runGlobalUpdate();
    if (updateResult.success) {
        return { status: 'started' };
    }
    if (updateResult.permissionDenied) {
        return { status: 'permission-denied', command: 'sudo npm update -g reviewflow' };
    }
    return { status: 'failed', error: updateResult.error ?? 'Unknown error' };
}
//# sourceMappingURL=triggerSelfUpdate.usecase.js.map