Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions strix/interface/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import argparse
import asyncio
import os
import shutil
import sys
from datetime import UTC, datetime
Expand Down Expand Up @@ -32,6 +33,13 @@
from strix.core.paths import run_dir_for, runtime_state_dir
from strix.interface.cli import run_cli
from strix.interface.tui import run_tui
from strix.interface.update_check import (
is_binary_install,
notify_update,
prompt_update_if_available,
self_update,
start_background_check,
)
from strix.interface.utils import (
assign_workspace_subdirs,
build_final_stats_text,
Expand Down Expand Up @@ -447,6 +455,14 @@ def parse_arguments() -> argparse.Namespace:
version=f"strix {get_version()}",
)

parser.add_argument(
"--update",
action="store_true",
help="Update strix to the latest version and exit. Self-updates the "
"standalone binary install; for pip/pipx/uv installs, prints the "
"matching upgrade command instead.",
)

parser.add_argument(
"-t",
"--target",
Expand Down Expand Up @@ -565,6 +581,9 @@ def parse_arguments() -> argparse.Namespace:

args = parser.parse_args()

if args.update:
sys.exit(0 if self_update() else 1)

if args.instruction and args.instruction_file:
parser.error(
"Cannot specify both --instruction and --instruction-file. Use one or the other."
Expand Down Expand Up @@ -788,6 +807,8 @@ def display_completion_message(args: argparse.Namespace, results_path: Path) ->
"[#60a5fa]discord.gg/strix-ai[/]"
)
console.print()
if not args.non_interactive:
notify_update(console)


def pull_docker_image() -> None:
Expand Down Expand Up @@ -851,6 +872,12 @@ def main() -> None:
if args.config:
apply_config_override(validate_config_file(args.config))

start_background_check()
if not args.non_interactive and prompt_update_if_available(Console()):
if is_binary_install() and sys.platform != "win32":
os.execv(sys.executable, sys.argv) # noqa: S606 # nosec B606
sys.exit(0)

check_docker_installed()
pull_docker_image()

Expand Down
Loading