This commit is contained in:
Trent Zock-Robbins 2025-05-13 16:48:46 -07:00 committed by GitHub
commit 95b2397322
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 34 additions and 18 deletions

View file

@ -595,9 +595,15 @@ def get_parser(default_config_files, git_root):
default=None, default=None,
) )
group.add_argument( group.add_argument(
"--install-main-branch", "--install-branch",
action="store_true", nargs="?",
help="Install the latest version from the main branch", const=True,
metavar="GIT_URL",
help=(
"Install the latest version from a git branch. If GIT_URL is provided, installs from"
" that URL (e.g., git+https://github.com/user/aider.git@my-branch). If no URL is"
" provided, installs from the Aider-AI main branch."
),
default=False, default=False,
) )
group.add_argument( group.add_argument(

View file

@ -34,7 +34,7 @@ from aider.models import ModelSettings
from aider.onboarding import offer_openrouter_oauth, select_default_model from aider.onboarding import offer_openrouter_oauth, select_default_model
from aider.repo import ANY_GIT_ERROR, GitRepo from aider.repo import ANY_GIT_ERROR, GitRepo
from aider.report import report_uncaught_exceptions from aider.report import report_uncaught_exceptions
from aider.versioncheck import check_version, install_from_main_branch, install_upgrade from aider.versioncheck import check_version, install_from_git_branch, install_upgrade
from aider.watch import FileWatcher from aider.watch import FileWatcher
from .dump import dump # noqa: F401 from .dump import dump # noqa: F401
@ -719,9 +719,13 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
analytics.event("exit", reason="Just checking update") analytics.event("exit", reason="Just checking update")
return 0 if not update_available else 1 return 0 if not update_available else 1
if args.install_main_branch: # Handle --install-branch [url]
success = install_from_main_branch(io) if args.install_branch:
analytics.event("exit", reason="Installed main branch") if isinstance(args.install_branch, str):
success = install_from_git_branch(io, remote_url=args.install_branch)
else: # True, meaning the flag was used without a URL
success = install_from_git_branch(io)
analytics.event("exit", reason="Installed git branch")
return 0 if success else 1 return 0 if success else 1
if args.upgrade: if args.upgrade:

View file

@ -12,16 +12,23 @@ from aider.dump import dump # noqa: F401
VERSION_CHECK_FNAME = Path.home() / ".aider" / "caches" / "versioncheck" VERSION_CHECK_FNAME = Path.home() / ".aider" / "caches" / "versioncheck"
def install_from_main_branch(io): def install_from_git_branch(io, remote_url=None):
""" """
Install the latest version of aider from the main branch of the GitHub repository. Install the latest version of aider from the main branch of the GitHub repository
or a specified git remote URL.
""" """
if remote_url is None:
remote_url = "git+https://github.com/Aider-AI/aider.git@main"
source_description = "the Aider-AI main branch"
else:
source_description = remote_url
return utils.check_pip_install_extra( return utils.check_pip_install_extra(
io, io,
None, None,
"Install the development version of aider from the main branch?", f"Install the development version of aider from {source_description}?",
["git+https://github.com/Aider-AI/aider.git"], [remote_url],
self_update=True, self_update=True,
) )

View file

@ -361,8 +361,8 @@ cog.outl("```")
## Show release notes on first run of new version (default: None, ask user) ## Show release notes on first run of new version (default: None, ask user)
#show-release-notes: xxx #show-release-notes: xxx
## Install the latest version from the main branch ## Install the latest version from a git branch. If GIT_URL is provided, installs from that URL (e.g., git+https://github.com/user/aider.git@my-branch). If no URL is provided, installs from the Aider-AI main branch.
#install-main-branch: false #install-branch: false
## Upgrade aider to the latest version from PyPI ## Upgrade aider to the latest version from PyPI
#upgrade: false #upgrade: false

View file

@ -66,8 +66,7 @@ usage: aider [-h] [--model] [--openai-api-key] [--anthropic-api-key]
[--analytics | --no-analytics] [--analytics-log] [--analytics | --no-analytics] [--analytics-log]
[--analytics-disable] [--just-check-update] [--analytics-disable] [--just-check-update]
[--check-update | --no-check-update] [--check-update | --no-check-update]
[--show-release-notes | --no-show-release-notes] [--show-release-notes | --no-show-release-notes] [--install-branch] [--upgrade] [--version]
[--install-main-branch] [--upgrade] [--version]
[--message] [--message-file] [--message] [--message-file]
[--gui | --no-gui | --browser | --no-browser] [--gui | --no-gui | --browser | --no-browser]
[--copy-paste | --no-copy-paste] [--apply] [--copy-paste | --no-copy-paste] [--apply]
@ -568,10 +567,10 @@ Aliases:
- `--show-release-notes` - `--show-release-notes`
- `--no-show-release-notes` - `--no-show-release-notes`
### `--install-main-branch` ### `--install-branch [GIT_URL]`
Install the latest version from the main branch Install the latest version from a git branch. If GIT_URL is provided, installs from that URL (e.g., git+https://github.com/user/aider.git@my-branch). If no URL is provided, installs from the Aider-AI main branch.
Default: False Default: False
Environment variable: `AIDER_INSTALL_MAIN_BRANCH` Environment variable: `AIDER_INSTALL_BRANCH`
### `--upgrade` ### `--upgrade`
Upgrade aider to the latest version from PyPI Upgrade aider to the latest version from PyPI