import { promisify } from 'util';
import { exec } from 'child_process';

const execPromise = promisify(exec);

/** @type {import('./$types').PageServerLoad} */
export async function load({ params }) {
  return {
    hash: (await execPromise('git rev-parse HEAD')).stdout,
    branch: (await execPromise('git rev-parse --abbrev-ref HEAD')).stdout,
    remote: (await execPromise('git config --get remote.origin.url')).stdout
  };
}