UNPKG

gaunt-sloth-assistant

Version:

[![Tests and Lint](https://github.com/Galvanized-Pukeko/gaunt-sloth-assistant/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/Galvanized-Pukeko/gaunt-sloth-assistant/actions/workflows/unit-tests.yml) [![Integration Tests](https://github.co

33 lines 1.18 kB
import { displayWarning } from '#src/consoleUtils.js'; import { execAsync, ProgressIndicator } from '#src/utils.js'; /** * Gets PR diff using GitHub CLI * @param _ config (unused in this provider) * @param prId GitHub PR number * @returns GitHub PR diff content or null if not found */ export async function get(_, prId) { if (!prId) { displayWarning('No GitHub PR number provided'); return null; } try { // Use the GitHub CLI to fetch PR diff const progress = new ProgressIndicator(`Fetching GitHub PR #${prId} diff`); const prDiffContent = await execAsync(`gh pr diff ${prId}`); progress.stop(); if (!prDiffContent) { displayWarning(`No diff content found for GitHub PR #${prId}`); return null; } return `GitHub PR Diff: #${prId}\n\n${prDiffContent}`; } catch (error) { displayWarning(` Failed to get GitHub PR diff #${prId}: ${error instanceof Error ? error.message : String(error)} Consider checking if gh cli (https://cli.github.com/) is installed and authenticated. `); return null; } } //# sourceMappingURL=ghPrDiffProvider.js.map