Initial commit

Co-Authored-By: Quentin Torroba <quentin.torroba@mistral.ai>
Co-Authored-By: Laure Hugo <laure.hugo@mistral.ai>
Co-Authored-By: Benjamin Trom <benjamin.trom@mistral.ai>
Co-Authored-By: Mathias Gesbert <mathias.gesbert@ext.mistral.ai>
Co-Authored-By: Michel Thomazo <michel.thomazo@mistral.ai>
Co-Authored-By: Clément Drouin <clement.drouin@mistral.ai>
Co-Authored-By: Vincent Guilloux <vincent.guilloux@mistral.ai>
Co-Authored-By: Valentin Berard <val@mistral.ai>
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Quentin Torroba 2025-12-09 13:13:22 +01:00 committed by Quentin Torroba
commit fa15fc977b
200 changed files with 30484 additions and 0 deletions

20
scripts/README.md Normal file
View file

@ -0,0 +1,20 @@
# Project Management Scripts
This directory contains scripts that support project versioning and deployment workflows.
## Versioning
### Usage
```bash
# Bump major version (1.0.0 -> 2.0.0)
uv run scripts/bump_version.py major
# Bump minor version (1.0.0 -> 1.1.0)
uv run scripts/bump_version.py minor
# Bump patch/micro version (1.0.0 -> 1.0.1)
uv run scripts/bump_version.py micro
# or
uv run scripts/bump_version.py patch
```

138
scripts/bump_version.py Executable file
View file

@ -0,0 +1,138 @@
#!/usr/bin/env python3
"""Version bumping script for semver versioning.
This script increments the version in pyproject.toml based on the specified bump type:
- major: 1.0.0 -> 2.0.0
- minor: 1.0.0 -> 1.1.0
- micro/patch: 1.0.0 -> 1.0.1
"""
from __future__ import annotations
import argparse
from pathlib import Path
import re
import subprocess
import sys
from typing import Literal, get_args
BumpType = Literal["major", "minor", "micro", "patch"]
BUMP_TYPES = get_args(BumpType)
def parse_version(version_str: str) -> tuple[int, int, int]:
match = re.match(r"^(\d+)\.(\d+)\.(\d+)$", version_str.strip())
if not match:
raise ValueError(f"Invalid version format: {version_str}")
return int(match.group(1)), int(match.group(2)), int(match.group(3))
def format_version(major: int, minor: int, patch: int) -> str:
return f"{major}.{minor}.{patch}"
def bump_version(version: str, bump_type: BumpType) -> str:
major, minor, patch = parse_version(version)
match bump_type:
case "major":
return format_version(major + 1, 0, 0)
case "minor":
return format_version(major, minor + 1, 0)
case "micro" | "patch":
return format_version(major, minor, patch + 1)
def update_hard_values_files(filepath: str, patterns: list[tuple[str, str]]) -> None:
path = Path(filepath)
if not path.exists():
raise FileNotFoundError(f"{filepath} not found in current directory")
# Replace patterns
for pattern, replacement in patterns:
content = path.read_text()
updated_content = re.sub(pattern, replacement, content, flags=re.MULTILINE)
if updated_content == content:
raise ValueError(f"pattern {pattern} not found in {filepath}")
path.write_text(updated_content)
print(f"Updated version in {filepath}")
def get_current_version() -> str:
pyproject_path = Path("pyproject.toml")
if not pyproject_path.exists():
raise FileNotFoundError("pyproject.toml not found in current directory")
content = pyproject_path.read_text()
# Find version line
version_match = re.search(r'^version = "([^"]+)"$', content, re.MULTILINE)
if not version_match:
raise ValueError("Version not found in pyproject.toml")
return version_match.group(1)
def main() -> None:
parser = argparse.ArgumentParser(
description="Bump semver version in pyproject.toml",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
uv run scripts/bump_version.py major # 1.0.0 -> 2.0.0
uv run scripts/bump_version.py minor # 1.0.0 -> 1.1.0
uv run scripts/bump_version.py micro # 1.0.0 -> 1.0.1
uv run scripts/bump_version.py patch # 1.0.0 -> 1.0.1
""",
)
parser.add_argument(
"bump_type", choices=BUMP_TYPES, help="Type of version bump to perform"
)
args = parser.parse_args()
try:
# Get current version
current_version = get_current_version()
print(f"Current version: {current_version}")
# Calculate new version
new_version = bump_version(current_version, args.bump_type)
print(f"New version: {new_version}")
# Update pyproject.toml
update_hard_values_files(
"pyproject.toml",
[(f'version = "{current_version}"', f'version = "{new_version}"')],
)
# Update extension.toml
update_hard_values_files(
"distribution/zed/extension.toml",
[
(f'version = "{current_version}"', f'version = "{new_version}"'),
(
f"releases/download/v{current_version}",
f"releases/download/v{new_version}",
),
(f"-{current_version}.zip", f"-{new_version}.zip"),
],
)
subprocess.run(["uv", "lock"], check=True)
print(f"Successfully bumped version from {current_version} to {new_version}")
except Exception as e:
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)
if __name__ == "__main__":
main()

128
scripts/install.sh Executable file
View file

@ -0,0 +1,128 @@
#!/usr/bin/env bash
# Mistral Vibe Installation Script
# This script installs uv if not present and then installs mistral-vibe using uv
set -euo pipefail
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
function error() {
echo -e "${RED}[ERROR]${NC} $1" >&2
}
function info() {
echo -e "${BLUE}[INFO]${NC} $1"
}
function success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
function warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
function check_platform() {
local platform=$(uname -s)
if [[ "$platform" == "Linux" ]]; then
info "Detected Linux platform"
PLATFORM="linux"
elif [[ "$platform" == "Darwin" ]]; then
info "Detected macOS platform"
PLATFORM="macos"
else
error "Unsupported platform: $platform"
error "This installation script currently only supports Linux and macOS"
exit 1
fi
}
function check_uv_installed() {
if command -v uv &> /dev/null; then
info "uv is already installed: $(uv --version)"
UV_INSTALLED=true
else
info "uv is not installed"
UV_INSTALLED=false
fi
}
function install_uv() {
info "Installing uv using the official Astral installer..."
if ! command -v curl &> /dev/null; then
error "curl is required to install uv. Please install curl first."
exit 1
fi
if curl -LsSf https://astral.sh/uv/install.sh | sh; then
success "uv installed successfully"
export PATH="$HOME/.local/bin:$PATH"
if ! command -v uv &> /dev/null; then
warning "uv was installed but not found in PATH for this session"
warning "You may need to restart your terminal or run:"
warning " export PATH=\"\$HOME/.cargo/bin:\$HOME/.local/bin:\$PATH\""
fi
else
error "Failed to install uv"
exit 1
fi
}
function install_vibe() {
info "Installing mistral-vibe from GitHub repository using uv..."
uv tool install mistral-vibe
success "Mistral Vibe installed successfully! (commands: vibe, vibe-acp)"
}
function main() {
echo
echo "██████████████████░░"
echo "██████████████████░░"
echo "████ ██████ ████░░"
echo "████ ██ ████░░"
echo "████ ████░░"
echo "████ ██ ██ ████░░"
echo "██ ██ ██░░"
echo "██████████████████░░"
echo "██████████████████░░"
echo
echo "Starting Mistral Vibe installation..."
echo
check_platform
check_uv_installed
if [[ "$UV_INSTALLED" == "false" ]]; then
install_uv
fi
install_vibe
if command -v vibe &> /dev/null; then
success "Installation completed successfully!"
echo
echo "You can now run vibe with:"
echo " vibe"
echo
echo "Or for ACP mode:"
echo " vibe-acp"
else
error "Installation completed but 'vibe' command not found"
error "Please check your installation and PATH settings"
exit 1
fi
}
main