Pmad.Git.CliEmulator
0.2.8
dotnet add package Pmad.Git.CliEmulator --version 0.2.8
NuGet\Install-Package Pmad.Git.CliEmulator -Version 0.2.8
<PackageReference Include="Pmad.Git.CliEmulator" Version="0.2.8" />
<PackageVersion Include="Pmad.Git.CliEmulator" Version="0.2.8" />
<PackageReference Include="Pmad.Git.CliEmulator" />
paket add Pmad.Git.CliEmulator --version 0.2.8
#r "nuget: Pmad.Git.CliEmulator, 0.2.8"
#:package Pmad.Git.CliEmulator@0.2.8
#addin nuget:?package=Pmad.Git.CliEmulator&version=0.2.8
#tool nuget:?package=Pmad.Git.CliEmulator&version=0.2.8
Pmad.Git.CliEmulator
Managed Git CLI emulator for AI agents on top of Pmad.Git.LocalRepositories and Pmad.Git.RemoteClient.
Overview
Pmad.Git.CliEmulator gives embedded AI agents a familiar, standard Git CLI command surface (status, log, diff, add, commit, branch, merge, reset, etc.) without requiring a native git binary, while giving the host application deep control via an asynchronous IUserApproval callback.
Features
- No native Git dependency: Pure managed C# implementation.
- Native AOT compatible: Fully compatible with
<PublishAot>true</PublishAot>. - Approval gates: Every destructive or network operation calls
IUserApprovalwith rich context objects (affected branch, commit history to lose, overwritten files, remote URL, etc.). - Exit codes and stream separation: Returns
GitCliResponsewithExitCode,StdOut, andStdErr. - Exit code 130 on denial / cancellation: Denying an approval returns exit code 130 with a descriptive error message.
- No line-ending normalization:
core.autocrlfand line-ending conversions are out of scope; staged files are written bit-for-bit, assuming Unix line separators (\n).
Usage
Streamlined One-Liner (Full Managed Stack)
using Pmad.Git.CliEmulator;
using Pmad.Git.RemoteClient;
// Automatically opens local workspace and sets up managed Smart HTTP remote client:
using var emulator = GitCliEmulator.Open(repositoryPath, new GitRemoteClientOptions
{
Credentials = new GitHttpCredentials("pat", "my-token")
});
var response = await emulator.InvokeAsync(["status"], userApproval);
Console.WriteLine(response.StdOut);
Fluent Extension Methods
using Pmad.Git.CliEmulator;
using Pmad.Git.LocalRepositories;
using var repo = GitRepositoryWithIndexAndWorkspace.Open(repositoryPath);
var emulator = repo.CreateCliEmulator();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Pmad.Git.LocalRepositories (>= 0.2.8)
- Pmad.Git.RemoteClient (>= 0.2.8)
- System.CommandLine (>= 2.0.12)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Pmad.Git.CliEmulator:
| Package | Downloads |
|---|---|
|
Pmad.Git.CliEmulator.AI
Microsoft.Extensions.AI integration for Pmad.Git.CliEmulator. Exposes the Git CLI emulator as an AIFunction for use with any IChatClient-based agent pipeline. |
GitHub repositories
This package is not used by any popular GitHub repositories.