fix(installation): detect install method from invoked CLI path#26468
fix(installation): detect install method from invoked CLI path#26468vsiegel wants to merge 3 commits intoanomalyco:devfrom
Conversation
Use the invoked opencode command path for install-method heuristics instead of the runtime executable so auto-upgrade picks the correct package manager and avoids local command disappearance after exit.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
I installed opencode with "npm i -g opencode-ai@latest". Admittedly, there is educational value in seeing an agent commit suicide. |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Issue for this PR
Closes #26479
Type of change
What does this PR do?
This fixes installation-method detection used by auto-upgrade. Previously the code used
process.execPath(runtime executable like node/bun) as the primary signal, which can differ from the actual invokedopencodecommand path. In some local setups that can choose the wrong installer path during upgrade and leave the command unavailable after exiting.The change switches method heuristics to inspect the invoked CLI path (
process.argv[1]fallback chain) and keeps the existing curl path checks and package-manager prioritization behavior.How did you verify your code works?
packages/opencode; environment is missingtsgo, so full typecheck could not run here.Screenshots / recordings
N/A (non-UI change)
Checklist