Skip to content

fix: keep cursor shim working in AppImage terminals#21

Draft
ZanzyTHEbar wants to merge 4 commits intowatzon:mainfrom
ZanzyTHEbar:fix/appimage-shim-path-handling
Draft

fix: keep cursor shim working in AppImage terminals#21
ZanzyTHEbar wants to merge 4 commits intowatzon:mainfrom
ZanzyTHEbar:fix/appimage-shim-path-handling

Conversation

@ZanzyTHEbar
Copy link
Contributor

Summary

  • keep cursor resolving to ~/.local/bin/cursor in supported shells even when AppImage runtime paths are injected ahead of it
  • tighten shim detection and path normalization so reruns stay idempotent and do not overwrite unrelated wrappers
  • document and uninstall the managed shell PATH hook alongside the existing shim assets

Test plan

  • shell syntax checks for installer, shim, helper, and uninstall scripts
  • temp-home regression test for managed shell PATH hook idempotence and removal
  • temp-home regression test for shim self-recursion, legacy upgrade, and wrapper-preservation behavior
  • temp-home regression test for AppImage runtime path dispatch and cursor agent behavior

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4e669bc8a1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

return 0
fi

mv "$tmp" "$file"

Choose a reason for hiding this comment

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

P2 Badge Preserve symlinked shell rc files when writing PATH hook

Using mv "$tmp" "$file" here replaces the rc file path itself, which breaks users who keep ~/.bashrc/~/.zshrc as symlinks to dotfile-managed files. In that common setup, install/update (and similarly remove_block) will silently convert the symlink into a standalone file, so future dotfile updates no longer apply. This is a functional regression for symlink-based shell configs and should be handled with an in-place write strategy that preserves links.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Handled in 8945586. scripts/ensure-shell-path.sh now writes through existing rc file paths instead of replacing them, so symlinked ~/.bashrc/~/.zshrc targets stay intact during both install/update and removal. I also rebuilt the PR branch on top of upstream/main and force-pushed the cleaned history.

Cursor-launched shells can put AppImage runtime mounts ahead of ~/.local/bin, which bypasses the shim and breaks agent and installer flows. Manage shell PATH setup and tighten shim detection so installs remain idempotent regardless of install order.
Update the PATH hook helper in place when an rc file already exists so dotfile-managed symlinks keep pointing at their original targets during install and removal.
@ZanzyTHEbar ZanzyTHEbar force-pushed the fix/appimage-shim-path-handling branch from 4e669bc to 8945586 Compare March 21, 2026 16:21
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89455866f2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

log_info "To add it, run this or add it to your shell profile:"
log_info "export PATH=\"\$HOME/.local/bin:\$PATH\""
fi
warn_if_cursor_shadowed_by_appimage_runtime

Choose a reason for hiding this comment

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

P1 Badge Bundle or refresh lib before invoking shell-path helpers

This new call is unconditional, but install.sh still prefers an existing ~/.local/share/cursor-installer/lib.sh when run standalone (the common curl ... | bash path). On systems upgrading from pre-change installs, that older lib does not define the new shell-path functions, so the installer exits with command not found here after already replacing ~/.local/bin/cursor-installer, leaving users in a partially upgraded/broken state. Ensure the script refreshes/copies the latest lib.sh before using new helper APIs, or defensively gate the call when the function is missing.

Useful? React with 👍 / 👎.

# Remove shared lib (installed by installer)
# Remove managed shell PATH setup before deleting helper assets
log_step "Removing managed shell PATH setup..."
run_remove_shell_path

Choose a reason for hiding this comment

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

P2 Badge Guard uninstall path cleanup when helper API is absent

Uninstall now assumes run_remove_shell_path exists in the sourced lib, but uninstall.sh can source an already-installed older lib.sh that predates this API. In that upgrade scenario, uninstall aborts with command not found at this line and stops cleanup early. Please add a compatibility guard (or refresh lib.sh first) so uninstall remains usable across mixed script/lib versions.

Useful? React with 👍 / 👎.

The shim should route `cursor agent ...` into the agent binary without forwarding the `agent` dispatcher token itself. Shift the subcommand before exec so the agent CLI receives only its own arguments.
Repeated installs should not rewrite shell rc files with extra blank lines or lose track of the intended destination variables. Trim trailing separator whitespace before re-appending the managed block and avoid leaking helper-local variable names across functions.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4fc8394997

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

function update_cursor() {
log_step "Updating Cursor..."
refresh_shim_assets
refresh_shell_path_assets

Choose a reason for hiding this comment

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

P1 Badge Gate shell-path refresh calls on lib API availability

update_cursor now calls refresh_shell_path_assets unconditionally, but installed environments can still source an older ~/.local/share/cursor-installer/lib.sh that predates this API. In that mixed-version state, cursor-installer --update exits with command not found before any update logic runs, so users are left with a broken updater until lib assets are manually repaired. Add a compatibility guard (or force-refresh lib.sh) before invoking new helper functions.

Useful? React with 👍 / 👎.

Comment on lines +37 to +40
shell_name=$(basename "${SHELL:-}")
case "$shell_name" in
bash)
printf '%s\n' "$HOME/.bashrc"

Choose a reason for hiding this comment

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

P2 Badge Remove PATH hook from all managed shell rc files

print_target_files derives exactly one target rc file from the current $SHELL, and uninstall reuses this default selection. If the PATH hook was added from a different shell earlier (for example, install from bash but uninstall from zsh), cleanup skips the original file and leaves the managed block behind, so uninstall does not fully remove the feature it installed.

Useful? React with 👍 / 👎.

@ZanzyTHEbar
Copy link
Contributor Author

This is a WIP - be ready soon.

@ZanzyTHEbar ZanzyTHEbar marked this pull request as draft March 23, 2026 20:00
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