• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dcdpr / jp / 20406598609

21 Dec 2025 07:35AM UTC coverage: 51.352% (-0.4%) from 51.778%
20406598609

push

github

web-flow
chore(tools): add git diff, stage, and github listing tools (#324)

Expand the toolset available to the AI agent:

- `git_diff`: View differences between the working directory and the
last commit.

- `git_stage`: Stage files or apply specific patches to the index.

- `github_list_files`: Recursively list files in a GitHub repository.

- `github_read_file`: Add support for reading files from a specific git
ref (branch, tag, or commit).

---------

Signed-off-by: Jean Mertz <git@jeanmertz.com>

0 of 147 new or added lines in 5 files covered. (0.0%)

1 existing line in 1 file now uncovered.

8796 of 17129 relevant lines covered (51.35%)

132.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/.config/jp/tools/src/git/diff.rs
1
use std::{path::PathBuf, process::Command};
2

3
use serde::Serialize;
4

5
use crate::{Error, to_xml, util::OneOrMany};
6

7
#[derive(Serialize)]
8
struct CommandResult {
9
    status: i32,
10
    stdout: String,
11
    stderr: String,
12
}
13

NEW
14
pub(crate) async fn git_diff(
×
NEW
15
    root: PathBuf,
×
NEW
16
    paths: OneOrMany<String>,
×
NEW
17
    cached: Option<bool>,
×
NEW
18
) -> std::result::Result<String, Error> {
×
NEW
19
    let cached = cached.unwrap_or(false);
×
NEW
20
    let output = Command::new("git")
×
NEW
21
        .arg("diff-index")
×
NEW
22
        .args(if cached { vec!["--cached"] } else { vec![] })
×
NEW
23
        .args(["-p", "HEAD"])
×
NEW
24
        .args(paths.to_vec())
×
NEW
25
        .current_dir(root)
×
NEW
26
        .output()?;
×
27

NEW
28
    to_xml(CommandResult {
×
NEW
29
        status: output.status.code().unwrap_or(-1),
×
NEW
30
        stdout: String::from_utf8(output.stdout).unwrap_or_default(),
×
NEW
31
        stderr: String::from_utf8(output.stderr).unwrap_or_default(),
×
NEW
32
    })
×
NEW
33
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc