Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stdio command path resolve #1386

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mpaquettePax8
Copy link

Fix command path resolution in StdioTransport

Problem

When using command-line extensions in Goose, the command path was being used as-is, which could cause failures when starting a Goose session from different directories since the paths were relative to the working directory.

Changes

  • Modified StdioTransport::resolve_command_path() to properly handle relative paths
  • When a command path is provided:
    • If it's absolute, use it as-is
    • If it's relative, resolve it against the current working directory to get an absolute path

Testing

Test cases to verify:

  1. Absolute paths work as before
  2. Relative paths (e.g. index.js) are correctly resolved against the working directory
  3. Starting a Goose session from any directory works with the same extension configuration

@salman1993
Copy link
Collaborator

curious when you were running into this error - is it when using --with-extension option in the CLI?


match std::env::current_dir() {
Ok(cwd) => {
let abs_path = cwd.join(path);
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we wanna check if this is a valid path?

Copy link
Author

Choose a reason for hiding this comment

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

yeah could be slightly better to exit earlier here if the file doesnt actually exist rather than letting if fail later in spawn_process

will add a check and then also will fix the lint errors from cargo fmt

@mpaquettePax8
Copy link
Author

curious when you were running into this error - is it when using --with-extension option in the CLI?

I havent tried the cli argument, I run goose configure and add a stdio command line extension, enable it when i start a session!

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.

2 participants