UNPKG

aura-ai

Version:

AI-powered marketing strategist CLI tool for developers

42 lines (35 loc) 1.04 kB
import { exec } from 'child_process' import { promisify } from 'util' const execAsync = promisify(exec) class GitService { async getTodayCommits() { try { // Get commits from today with full format const { stdout } = await execAsync('git log --since="00:00" --format="%H|%s|%an|%ai"') if (!stdout.trim()) { return [] } const commits = stdout.trim().split('\n').map(line => { const [hash, message, author, date] = line.split('|') return { hash: hash.substring(0, 7), message, author, date: new Date(date).toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' }) } }) return commits } catch (error) { console.error('Error fetching commits:', error) return [] } } formatCommitsForAI(commits) { // Format commits for AI analysis return commits.map(c => `[${c.date}] ${c.message}`).join('\n') } } export default new GitService()