UNPKG

scai

Version:

> **AI-powered CLI for local code analysis, commit message suggestions, and natural-language queries.** 100% local, private, GDPR-friendly, made in Denmark/EU with ❤️.

27 lines (26 loc) 1.03 kB
import { execSync } from "child_process"; export function checkGit() { try { execSync("git rev-parse --is-inside-work-tree", { stdio: "ignore" }); const status = execSync("git status --porcelain").toString(); const isClean = status.trim().length === 0; if (isClean) { console.log("✅ Git working directory is clean"); } else { console.log("⚠️ Git working directory has uncommitted changes"); } const branch = execSync("git rev-parse --abbrev-ref HEAD").toString().trim(); const mainHash = execSync("git rev-parse origin/main").toString().trim(); const localHash = execSync("git rev-parse HEAD").toString().trim(); if (localHash === mainHash) { console.log("✅ Up to date with origin/main"); } else { console.log(`🔄 Branch ${branch} is not up to date with origin/main`); } } catch { console.error("❌ Not inside a Git repository"); } }