Skip to content

Conversation

@michaelneale
Copy link
Collaborator

This picks up from: #5847

but adds @goose alias (as gt is used by graphite) and also doesn't require session changes

baxen and others added 12 commits November 22, 2025 12:18
Term command is a new way to use goose without the builtin REPL
- instead the session is tied right into your terminal
- Fix bash/zsh: properly quote goose binary path to handle spaces
- Extract session creation logic to ensure_terminal_session helper
- Reduces code duplication between handle_term_log and handle_term_run
@michaelneale michaelneale requested a review from a team as a code owner November 25, 2025 04:56
Copilot AI review requested due to automatic review settings November 25, 2025 04:56
@michaelneale michaelneale changed the title feat: Goose in terminal ignore (test): Goose in terminal Nov 25, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces terminal integration for Goose, enabling users to interact with Goose directly from their shell prompt without switching to a separate REPL session. It adds the @goose and @g aliases (alongside the existing gt alias) to address conflicts with Graphite's gt command, and implements per-directory session management without requiring explicit session switching.

Key Changes

  • Terminal-aware session management that automatically creates or resumes sessions based on the current working directory
  • Shell integration scripts for bash, zsh, fish, and PowerShell with command history tracking
  • New goose term subcommands for initialization, logging, and running prompts

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
documentation/docs/guides/terminal-integration.md Added comprehensive documentation covering setup, usage, performance characteristics, and session management for terminal integration
crates/goose-cli/src/commands/term.rs Implements core terminal integration functionality including session management, shell script generation, and command history tracking
crates/goose-cli/src/commands/mod.rs Exposes the new term module
crates/goose-cli/src/cli.rs Adds CLI commands and argument parsing for goose term subcommands (init, log, run, info)
crates/goose-cli/Cargo.toml Adds dirs dependency (appears unused)
Cargo.lock Updates dependency tree with dirs 6.0.0 and related transitive dependencies

anstream = "0.6.18"
url = "2.5.7"
open = "5.3.2"
dirs = "6.0.0"
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dirs dependency is added to Cargo.toml but is not used anywhere in the codebase. Consider removing it if it's not needed.

Suggested change
dirs = "6.0.0"

Copilot uses AI. Check for mistakes.
Comment on lines +183 to +200
fn read_and_clear_shell_history(session_id: &str) -> Result<Vec<String>> {
let path = shell_history_path(session_id)?;

if !path.exists() {
return Ok(Vec::new());
}

let content = fs::read_to_string(&path)?;
let commands: Vec<String> = content
.lines()
.filter(|line| !line.trim().is_empty())
.map(|s| s.to_string())
.collect();

fs::write(&path, "")?;

Ok(commands)
}
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Race condition: read_and_clear_shell_history reads then clears the file (lines 190-197), but append_shell_command could write between the read and clear operations. If a command is logged during this window, it will be lost. Consider using file locking (e.g., fs2 crate's FileExt::try_lock_exclusive()) or atomic operations to prevent this.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants