/**
 * GitInstalledDiagnostic
 *
 * Confirms `git` is on PATH and reports its version. Shep clones, branches,
 * commits, and pushes through the local git binary — without it nothing
 * past `shep doctor` itself works.
 */
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import { injectable } from 'tsyringe';
import { DiagnosticStatus } from '../../../../domain/generated/output.js';
import { runCommand } from './run-command.js';
let GitInstalledDiagnostic = class GitInstalledDiagnostic {
    run_;
    name = 'git-installed';
    constructor(run_ = runCommand) {
        this.run_ = run_;
    }
    async run() {
        const result = await this.run_('git', ['--version']);
        if (result.notFound) {
            return {
                name: this.name,
                status: DiagnosticStatus.Fail,
                detail: 'git is not installed (not on PATH)',
                fixHint: 'Install git: macOS `xcode-select --install`, Linux `apt install git`, Windows `winget install --id Git.Git`',
            };
        }
        if (result.exitCode !== 0) {
            return {
                name: this.name,
                status: DiagnosticStatus.Fail,
                detail: `git exited with code ${result.exitCode}: ${result.stderr || 'no output'}`,
                fixHint: 'Re-install git or run `git --version` manually to investigate',
            };
        }
        return {
            name: this.name,
            status: DiagnosticStatus.Ok,
            detail: result.stdout || 'git installed (version unknown)',
        };
    }
};
GitInstalledDiagnostic = __decorate([
    injectable(),
    __metadata("design:paramtypes", [Function])
], GitInstalledDiagnostic);
export { GitInstalledDiagnostic };
