Luxe installs with curl -fsSL https://luxe.dev/install.sh | sh, edits keep a file's permissions, and the tools page charts every agent by name
- luxe.dev/install.sh redirects to the latest release's installer, and luxe.dev/install.ps1 runs the release's PowerShell installer under Windows' default policy, so the commands are `curl -fsSL https://luxe.dev/install.sh | sh` and `powershell -c "irm https://luxe.dev/install.ps1 | iex"`. The install tabs run shell, brew, cargo, then windows. - The edit and write tools and format-on-save keep a file's mode, so editing a script no longer leaves it unrunnable. - The tools page gives Claude Code and Codex their own columns and bars, draws Luxe's own bar in each group, and its terminal's window controls take macOS's colors. - scripts/aur-pkgbuild.sh writes a luxe-bin PKGBUILD from a release, for the AUR once it reopens.
This commit is contained in:
@@ -428,7 +428,9 @@ impl Tool for EditTool {
|
||||
let diff = crate::diff_preview::ranges_diff(&content, &preview);
|
||||
let result = apply(&content, &planned);
|
||||
|
||||
if let Err(problem) = luxe_core::fs_atomic::replace(&full_path, result.as_bytes()) {
|
||||
if let Err(problem) =
|
||||
luxe_core::fs_atomic::replace_keeping_mode(&full_path, result.as_bytes())
|
||||
{
|
||||
warn!(path = %full_path.display(), error = %problem, "failed to write edited file");
|
||||
return ToolResultData::error(format!(
|
||||
"Error writing file '{}': {problem}",
|
||||
|
||||
@@ -78,6 +78,23 @@ async fn a_reformatted_edit_shows_the_file_as_it_is_now() {
|
||||
assert!(text.contains("+1 fn b() {}"), "{text}");
|
||||
}
|
||||
|
||||
/// An edited script stays executable. Saving by rename replaced the file with a new one at the
|
||||
/// default mode, so every edit of a script left it unrunnable.
|
||||
#[cfg(unix)]
|
||||
#[tokio::test]
|
||||
async fn an_edited_script_stays_executable() {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let script = dir.path().join("run.sh");
|
||||
std::fs::write(&script, "#!/bin/sh\necho one\n").unwrap();
|
||||
std::fs::set_permissions(&script, std::fs::Permissions::from_mode(0o755)).unwrap();
|
||||
let args = json!({"path": "run.sh", "edits": [{"oldText": "one", "newText": "two"}]});
|
||||
let result = EditTool::new().run(args, &test_context(dir.path())).await;
|
||||
assert!(!result.is_error, "{:?}", result.content);
|
||||
let mode = std::fs::metadata(&script).unwrap().permissions().mode() & 0o777;
|
||||
assert_eq!(mode, 0o755, "still executable after the edit");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn edit_tool_basic() {
|
||||
let tmp_dir_guard = tempfile::tempdir().expect("temp dir");
|
||||
|
||||
@@ -182,7 +182,7 @@ impl Tool for WriteTool {
|
||||
Err(_) => std::borrow::Cow::Borrowed(content),
|
||||
};
|
||||
|
||||
match luxe_core::fs_atomic::replace(&full_path, content.as_bytes()) {
|
||||
match luxe_core::fs_atomic::replace_keeping_mode(&full_path, content.as_bytes()) {
|
||||
Ok(()) => {
|
||||
debug!(path = %full_path.display(), "file written successfully");
|
||||
self.after_write(cx, &full_path, &content, existed).await
|
||||
|
||||
@@ -30,6 +30,22 @@ async fn a_reformatted_write_shows_the_file_as_it_is_now() {
|
||||
assert!(text.contains("+1 fn sub(a: i32) {}") && !text.contains("a:i32"), "{text}");
|
||||
}
|
||||
|
||||
/// Overwriting a script keeps it executable, as an editor's save does.
|
||||
#[cfg(unix)]
|
||||
#[tokio::test]
|
||||
async fn an_overwritten_script_stays_executable() {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let script = dir.path().join("run.sh");
|
||||
std::fs::write(&script, "#!/bin/sh\n").unwrap();
|
||||
std::fs::set_permissions(&script, std::fs::Permissions::from_mode(0o755)).unwrap();
|
||||
let args = serde_json::json!({"path": "run.sh", "content": "#!/bin/sh\necho hi\n"});
|
||||
let result = WriteTool::new().run(args, &test_context(dir.path())).await;
|
||||
assert!(!result.is_error, "{:?}", result.content);
|
||||
let mode = std::fs::metadata(&script).unwrap().permissions().mode() & 0o777;
|
||||
assert_eq!(mode, 0o755, "still executable after the write");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn write_tool_basic() {
|
||||
let tmp_dir_guard = tempfile::tempdir().expect("temp dir");
|
||||
|
||||
Reference in New Issue
Block a user