Synced from monorepo
Synced from monorepo Changes: - Workspace server: report `/ready` as failed with dwell on hub connect failure - Refresh OIDC token for the Grok agent in the shell - ACP terminal output recorder - Cross-platform provider auth commands in the shell - Default `/resume` to Grok sessions with a hint for hidden external sessions - Resume sessions by title with `--resume` - Limit app-builder archive size - Data-driven tag labels for slash commands - Doctor fixes for tmux - Custom provider gateways and subprocess environment policy in the shell - `/tutorial` — opt-in onboarding tour of Grok Build - Soft and required CLI version checks in the shell - Privacy banner env overrides survive live settings updates - Add remote flag to override the image-edit model - Return profile fields from auth info even when the access token is expired - Add edit control on queued prompt rows - Keep fail-closed policy when clearing orphans with no team - Setting to disable the Ctrl+Space/F8 voice shortcut - Pass `--raw` to pw-record so Linux dictation works on older PipeWire - Validate git URLs when adding marketplace entries - Stop shipping stale tool-doc parameter and tool names - Re-point dashboard attach after `/fork` only when the parent was attached - Surface Grok Computer media-generation results as file-path chunks - Clear web background-task tray on kill and keep the task description - Show privacy upsell banner in agent view until acted on - Add tools-server client callback surface - Protect persistent global hook sources Source-Revision: 95d84f443eddcbed6cbfd6eed22e2eafe6b3939d
This commit is contained in:
parent
a5727c5960
commit
69f0ba880a
286 changed files with 22939 additions and 9624 deletions
|
|
@ -52,6 +52,62 @@ impl Drop for AbortOnDrop {
|
|||
}
|
||||
}
|
||||
|
||||
/// Expand a leading `~` to the home directory; other paths pass through.
|
||||
pub(crate) fn expand_home(s: &str) -> std::path::PathBuf {
|
||||
if let Some(stripped) = s.strip_prefix("~/") {
|
||||
if let Some(home) = dirs::home_dir() {
|
||||
return home.join(stripped);
|
||||
}
|
||||
} else if s == "~"
|
||||
&& let Some(home) = dirs::home_dir()
|
||||
{
|
||||
return home;
|
||||
}
|
||||
std::path::PathBuf::from(s)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod expand_home_tests {
|
||||
use super::expand_home;
|
||||
|
||||
#[test]
|
||||
fn passthrough_for_absolute_path() {
|
||||
assert_eq!(
|
||||
expand_home("/abs/path"),
|
||||
std::path::PathBuf::from("/abs/path")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn passthrough_for_relative_path() {
|
||||
assert_eq!(
|
||||
expand_home("rel/path"),
|
||||
std::path::PathBuf::from("rel/path")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bare_tilde() {
|
||||
let home = dirs::home_dir().expect("home_dir required for this test");
|
||||
assert_eq!(expand_home("~"), home);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tilde_slash() {
|
||||
let home = dirs::home_dir().expect("home_dir required for this test");
|
||||
assert_eq!(expand_home("~/foo/bar"), home.join("foo/bar"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn does_not_handle_user_tilde() {
|
||||
// `~bob/path` is treated as a literal relative path.
|
||||
assert_eq!(
|
||||
expand_home("~bob/path"),
|
||||
std::path::PathBuf::from("~bob/path")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod is_user_instruction_path_tests {
|
||||
use super::is_user_instruction_path;
|
||||
|
|
|
|||
Loading…
Reference in a new issue