-
Notifications
You must be signed in to change notification settings - Fork 134
fix: resolve the install from the running binary; make upgrade failures diagnosable (#1305) #1306
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
Open
saravmajestic
wants to merge
9
commits into
main
Choose a base branch
from
fix/install-detection-and-upgrade-diagnostics
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e98ba6d
fix: resolve the install from the running binary; make upgrade failur…
saravmajestic b9a769c
fix: correct .local/bin regression and revert collateral reformat (#1…
saravmajestic d0cac98
fix: address review findings — non-global layouts, yarn on Windows, b…
saravmajestic 1ef5916
fix: establish ownership before acting; stop leaking diagnostics; cor…
saravmajestic f228cb2
fix: mark the uninstall choco-branch removal (#1305)
saravmajestic 6ee55b6
fix: detect the unscoped npm wrapper; redact the success path too (#1…
saravmajestic 2708fc8
fix: resolve install ownership from the manager; refuse destructive a…
saravmajestic 40779c5
fix: mark the two remaining altimate_change additions (#1305)
saravmajestic 5d99234
fix: one resolved identity; report the upgrade that actually happened…
saravmajestic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,7 +23,11 @@ export const UpgradeCommand = { | |||||||
| alias: "m", | ||||||||
| describe: "installation method to use", | ||||||||
| type: "string", | ||||||||
| choices: ["curl", "npm", "pnpm", "bun", "brew", "choco", "scoop"], | ||||||||
| // altimate_change start — #1305: keep in step with UNSUPPORTED_UPGRADE_METHODS. | ||||||||
| // choco/scoop were offered here but Installation.upgrade() always refuses them, so | ||||||||
| // selecting either could only fail. | ||||||||
| choices: ["curl", "npm", "pnpm", "bun", "brew"], | ||||||||
| // altimate_change end | ||||||||
| }) | ||||||||
| }, | ||||||||
| handler: async (args: { target?: string; method?: string }) => { | ||||||||
|
|
@@ -46,23 +50,33 @@ export const UpgradeCommand = { | |||||||
| // altimate_change end | ||||||||
| const detectedMethod = await Installation.method() | ||||||||
| const method = (args.method as Installation.Method) ?? detectedMethod | ||||||||
| if (method === "unknown") { | ||||||||
| // altimate_change start — branding | ||||||||
| prompts.log.error(`altimate is installed to ${process.execPath} and may be managed by a package manager`) | ||||||||
| // altimate_change end | ||||||||
| const install = await prompts.select({ | ||||||||
| message: "Install anyways?", | ||||||||
| options: [ | ||||||||
| { label: "Yes", value: true }, | ||||||||
| { label: "No", value: false }, | ||||||||
| ], | ||||||||
| initialValue: false, | ||||||||
| }) | ||||||||
| if (!install) { | ||||||||
| prompts.outro("Done") | ||||||||
| return | ||||||||
| } | ||||||||
| // altimate_change start — #1305: stop instead of offering a choice that cannot work. | ||||||||
| // `Installation.upgrade()` refuses every method in UNSUPPORTED_UPGRADE_METHODS, so the | ||||||||
| // old "Install anyways?" prompt ended in `UpgradeFailedError: Unknown installation | ||||||||
| // method` whichever way the user answered — and detection now returns `unknown` for | ||||||||
| // anything it cannot verify, which made that dead end much more common. | ||||||||
| if (Installation.UNSUPPORTED_UPGRADE_METHODS.includes(method)) { | ||||||||
| prompts.log.error( | ||||||||
| method === "unknown" | ||||||||
| ? `Cannot determine how altimate was installed (running from ${process.execPath}).` | ||||||||
| : `Upgrading a ${method} installation is not supported.`, | ||||||||
| ) | ||||||||
| prompts.log.info("Upgrade with whichever tool installed it:") | ||||||||
| prompts.log.info(" npm: npm install -g altimate-code@latest") | ||||||||
| prompts.log.info(" pnpm: pnpm install -g altimate-code@latest") | ||||||||
| prompts.log.info(" bun: bun install -g altimate-code@latest") | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: When Prompt for AI agents
Suggested change
|
||||||||
| prompts.log.info(" Homebrew: brew upgrade altimate-code") | ||||||||
| prompts.log.info( | ||||||||
| process.platform === "win32" | ||||||||
| ? " installer: irm https://www.altimate.sh/install.ps1 | iex" | ||||||||
| : " installer: curl -fsSL https://www.altimate.sh/install | bash", | ||||||||
| ) | ||||||||
| prompts.log.info("If you installed the scoped package, use @altimateai/altimate-code as the name instead.") | ||||||||
| prompts.log.info("Or force a specific manager with --method <npm|pnpm|bun|brew|curl>.") | ||||||||
| prompts.outro("Done") | ||||||||
| return | ||||||||
| } | ||||||||
| // altimate_change end | ||||||||
| prompts.log.info("Using method: " + method) | ||||||||
| const target = args.target ? args.target.replace(/^v/, "") : await Installation.latest() | ||||||||
|
|
||||||||
|
|
||||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: If the second ownership lookup fails or changes after
method()succeeds, this fallback silently targets the scoped package instead of the verified package. Fail closed whenpackageName()is missing, or reuse the owner from the initial verification, before deleting data and running the package manager.Prompt for AI agents