Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f652e607f6 | ||
|
|
8c4361acee | ||
|
|
db7ef65e4a | ||
|
|
d977e01d5d |
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"version": "0.1.3",
|
"version": "0.1.5",
|
||||||
"sha256": {
|
"sha256": {
|
||||||
"aarch64-apple-darwin": "b2cbabcd87ae7bda6c14638c24f5b80e37553954409a46828fd0bddb0aa1e7bc",
|
"aarch64-apple-darwin": "388fedc4ffac34756cfb234953c4b7355017bd68b23a953f6f6ce908b33fbdab",
|
||||||
"x86_64-unknown-linux-musl": "0f003750f85b40499036e3bf1591fa488b7bd34ad19787471c0bc968ab545427"
|
"x86_64-unknown-linux-musl": "f5911d985f2d392783c12e7e130f4ced098a8f4b2dea1a9ebb83fb7c73ef54aa"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -63,17 +63,17 @@ impl Acp {
|
|||||||
pub fn spawn(p: &Profile, worktree: &Path, id: &str) -> Result<Self> {
|
pub fn spawn(p: &Profile, worktree: &Path, id: &str) -> Result<Self> {
|
||||||
let mut parts = p.hx.split_whitespace();
|
let mut parts = p.hx.split_whitespace();
|
||||||
let mut cmd = Command::new(parts.next().context("empty hx command")?);
|
let mut cmd = Command::new(parts.next().context("empty hx command")?);
|
||||||
cmd.args(parts)
|
// sandbox and permission flags are options of the root command, so they go before `serve`
|
||||||
.args(["serve", "--acp", "--cwd"])
|
|
||||||
.arg(worktree)
|
|
||||||
.args(["--session", id]);
|
|
||||||
// the TUI answers permission requests itself, so yolo only when the profile asks for it explicitly
|
// the TUI answers permission requests itself, so yolo only when the profile asks for it explicitly
|
||||||
let flags = p.hx_flags();
|
let flags = p.hx_flags();
|
||||||
cmd.args(
|
cmd.args(parts).args(
|
||||||
flags
|
flags
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|f| **f != "--yolo" || p.yolo == Some(true)),
|
.filter(|f| **f != "--yolo" || p.yolo == Some(true)),
|
||||||
);
|
);
|
||||||
|
cmd.args(["serve", "--acp", "--cwd"])
|
||||||
|
.arg(worktree)
|
||||||
|
.args(["--session", id]);
|
||||||
// same cleared environment as the batch runner: orch's secrets never reach the agent
|
// same cleared environment as the batch runner: orch's secrets never reach the agent
|
||||||
cmd.env_clear().envs(hx_env(std::env::vars(), p));
|
cmd.env_clear().envs(hx_env(std::env::vars(), p));
|
||||||
if let Some(h) = &p.home {
|
if let Some(h) = &p.home {
|
||||||
|
|||||||
+23
-1
@@ -757,7 +757,7 @@ fn test_output(app: &App, id: &str) -> Pager {
|
|||||||
fn diff_of(worktree: &str) -> Pager {
|
fn diff_of(worktree: &str) -> Pager {
|
||||||
let git = |a: &[&str]| crate::run::git(Path::new(worktree), a);
|
let git = |a: &[&str]| crate::run::git(Path::new(worktree), a);
|
||||||
let mut text = String::new();
|
let mut text = String::new();
|
||||||
match git(&["status", "--short"]) {
|
match git(&["status", "--short", "--untracked-files=all"]) {
|
||||||
Ok(s) if !s.trim().is_empty() => text.push_str(&format!("{s}\n")),
|
Ok(s) if !s.trim().is_empty() => text.push_str(&format!("{s}\n")),
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(e) => text.push_str(&format!("{e:#}\n")),
|
Err(e) => text.push_str(&format!("{e:#}\n")),
|
||||||
@@ -767,6 +767,20 @@ fn diff_of(worktree: &str) -> Pager {
|
|||||||
Ok(s) => text.push_str(&s),
|
Ok(s) => text.push_str(&s),
|
||||||
Err(e) => text.push_str(&format!("{e:#}")),
|
Err(e) => text.push_str(&format!("{e:#}")),
|
||||||
}
|
}
|
||||||
|
// `git diff HEAD` skips untracked files: show them as additions too.
|
||||||
|
// `--no-index` exits 1 when the files differ, so read stdout and ignore the status.
|
||||||
|
for f in git(&["ls-files", "--others", "--exclude-standard"])
|
||||||
|
.unwrap_or_default()
|
||||||
|
.lines()
|
||||||
|
{
|
||||||
|
if let Ok(o) = std::process::Command::new("git")
|
||||||
|
.args(["diff", "--no-index", "--", "/dev/null", f])
|
||||||
|
.current_dir(worktree)
|
||||||
|
.output()
|
||||||
|
{
|
||||||
|
text.push_str(&String::from_utf8_lossy(&o.stdout));
|
||||||
|
}
|
||||||
|
}
|
||||||
Pager {
|
Pager {
|
||||||
title: "diff".into(),
|
title: "diff".into(),
|
||||||
lines: lines_of(&text),
|
lines: lines_of(&text),
|
||||||
@@ -1435,6 +1449,14 @@ end = "escalated"
|
|||||||
assert!(tr.lines.last().unwrap().contains("ended: escalated"));
|
assert!(tr.lines.last().unwrap().contains("ended: escalated"));
|
||||||
// the agent's (here: the shell's) untracked file shows up in the diff view
|
// the agent's (here: the shell's) untracked file shows up in the diff view
|
||||||
assert!(diff_of(&d.worktree).lines.iter().any(|l| l == "?? n"));
|
assert!(diff_of(&d.worktree).lines.iter().any(|l| l == "?? n"));
|
||||||
|
// files inside a new folder are listed one by one, not collapsed to "sub/"
|
||||||
|
std::fs::create_dir_all(Path::new(&d.worktree).join("sub")).unwrap();
|
||||||
|
std::fs::write(Path::new(&d.worktree).join("sub/f"), "x").unwrap();
|
||||||
|
let lines = diff_of(&d.worktree).lines;
|
||||||
|
assert!(lines.iter().any(|l| l == "?? sub/f"));
|
||||||
|
// and its content appears as an added file
|
||||||
|
assert!(lines.iter().any(|l| l == "+++ b/sub/f"), "{lines:?}");
|
||||||
|
assert!(lines.iter().any(|l| l == "+x"), "{lines:?}");
|
||||||
let _ = std::fs::remove_dir_all(&dir);
|
let _ = std::fs::remove_dir_all(&dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user