Skip to content

feat(shell): PATH-based command resolution and completion - #140

Merged
FlareCoding merged 1 commit into
masterfrom
pr/shell-path-resolution
Jul 30, 2026
Merged

feat(shell): PATH-based command resolution and completion#140
FlareCoding merged 1 commit into
masterfrom
pr/shell-path-resolution

Conversation

@FlareCoding

Copy link
Copy Markdown
Owner

Summary

  • The shell hardcoded /bin for command lookup and tab completion, ignoring the PATH now seeded by init.
  • resolve_cmd walks PATH probing candidates with access(X_OK), preserving the /bin fallback and failure messaging when PATH is unset or nothing matches.
  • Command completion collects from every PATH directory with duplicate names deduped after sorting. Bare names still never execute from the current directory.

Made with Cursor

@FlareCoding
FlareCoding merged commit 7f689c2 into master Jul 30, 2026
15 checks passed
@FlareCoding
FlareCoding deleted the pr/shell-path-resolution branch July 30, 2026 19:58

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 3bb54d8. Configure here.

if (dir_len > 0) {
int n = snprintf(path_buf, buf_size, "%.*s/%s", dir_len, path, name);
if (n > 0 && n < buf_size && access(path_buf, X_OK) == 0)
return path_buf;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

PATH match accepts any node

Medium Severity · Logic Bug

resolve_cmd treats a successful access(..., X_OK) as proof it found the command and stops walking PATH. On this OS, access/faccessat succeeds for any resolvable node, including directories and non-executables, so an earlier shadowing name prevents later valid binaries from being tried and surfaces as command not found.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3bb54d8. Configure here.

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.

1 participant