Ajout et configuration d’un environnement de développement conteneurisé (devcontainer) avec support multi-langages (Go, Rust, Python), intégration d’outils LLM locaux/cloud (LM Studio, Claude Pro), et refonte des outils MCP : suppression du module sandbox, correction de la gestion des chemins projet dans jj.py, ajout d’une fonction jj_new_tool, et structuration du Makefile pour le build multiplateforme. Mise à jour des scripts (docker-entrypoint.sh, setup-devcontainer.sh), du README.md et de bin/jj-ai-commit.sh pour automatiser la génération de messages de commit à partir des résumés des fichiers modifiés.
100 lines
3.6 KiB
Bash
Executable File
100 lines
3.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# setup-devcontainer.sh
|
|
#
|
|
# Adds the PMOCrazyCoder devcontainer environment to any project.
|
|
# Usage: bash setup-devcontainer.sh [project-dir]
|
|
#
|
|
# Example (run from the project root):
|
|
# bash setup-devcontainer.sh
|
|
#
|
|
# Or download and run directly:
|
|
# curl -fsSL https://gargoton.petite-maison-orange.fr/eric/PMOCrazycoder/raw/branch/main/setup-devcontainer.sh | bash
|
|
|
|
set -euo pipefail
|
|
|
|
PROJECT_DIR="${1:-$(pwd)}"
|
|
DEVCONTAINER_DIR="$PROJECT_DIR/.devcontainer"
|
|
LOCAL_LLM_API="${LOCAL_LLM_API:-http://host.docker.internal:1248/v1}"
|
|
|
|
GIT_RAW="https://gargoton.petite-maison-orange.fr/eric/PMOCrazycoder/raw/branch/main"
|
|
|
|
# --- Colors ---
|
|
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RESET='\033[0m'
|
|
info() { echo -e "${GREEN}[setup]${RESET} $*"; }
|
|
warning() { echo -e "${YELLOW}[setup]${RESET} $*"; }
|
|
error() { echo -e "${RED}[setup]${RESET} $*" >&2; exit 1; }
|
|
|
|
fetch() {
|
|
local src="$1" dst="$2"
|
|
curl -fsSL "$GIT_RAW/$src" -o "$dst" \
|
|
|| error "Failed to fetch $src from $GIT_RAW"
|
|
}
|
|
|
|
# --- Checks ---
|
|
[[ -d "$PROJECT_DIR" ]] || error "Directory not found: $PROJECT_DIR"
|
|
command -v curl >/dev/null || error "curl is required"
|
|
|
|
# --- .devcontainer/ ---
|
|
info "Creating .devcontainer structure in $PROJECT_DIR"
|
|
mkdir -p "$DEVCONTAINER_DIR/config/claude"
|
|
mkdir -p "$DEVCONTAINER_DIR/config/opencode"
|
|
mkdir -p "$DEVCONTAINER_DIR/config/aichat"
|
|
mkdir -p "$DEVCONTAINER_DIR/config/ai_index"
|
|
mkdir -p "$DEVCONTAINER_DIR/config/cargo-registry"
|
|
mkdir -p "$DEVCONTAINER_DIR/config/cargo-git"
|
|
mkdir -p "$DEVCONTAINER_DIR/config/cargo-bin"
|
|
mkdir -p "$DEVCONTAINER_DIR/config/go-cache"
|
|
mkdir -p "$DEVCONTAINER_DIR/config/go-bin"
|
|
mkdir -p "$DEVCONTAINER_DIR/config/python-local"
|
|
mkdir -p "$DEVCONTAINER_DIR/config/npm-cache"
|
|
mkdir -p "$DEVCONTAINER_DIR/config/r-libs"
|
|
|
|
# --- devcontainer.json ---
|
|
DEVCONTAINER_JSON="$DEVCONTAINER_DIR/devcontainer.json"
|
|
if [[ -f "$DEVCONTAINER_JSON" ]]; then
|
|
warning "devcontainer.json already exists, skipping"
|
|
else
|
|
fetch ".devcontainer/devcontainer.json" "$DEVCONTAINER_JSON"
|
|
# Rename the service name to match the project
|
|
sed -i.bak "s/\"name\": \"PMOCrazyCoder\"/\"name\": \"$(basename "$PROJECT_DIR")\"/" "$DEVCONTAINER_JSON"
|
|
rm -f "$DEVCONTAINER_JSON.bak"
|
|
info "Created devcontainer.json"
|
|
fi
|
|
|
|
# --- docker-compose.yml ---
|
|
COMPOSE_FILE="$DEVCONTAINER_DIR/docker-compose.yml"
|
|
if [[ -f "$COMPOSE_FILE" ]]; then
|
|
warning "docker-compose.yml already exists, skipping"
|
|
else
|
|
fetch ".devcontainer/docker-compose.yml" "$COMPOSE_FILE"
|
|
# Patch LOCAL_LLM_API if overridden
|
|
if [[ "$LOCAL_LLM_API" != "http://host.docker.internal:1248/v1" ]]; then
|
|
sed -i.bak "s|http://host.docker.internal:1248/v1|${LOCAL_LLM_API}|g" "$COMPOSE_FILE"
|
|
rm -f "$COMPOSE_FILE.bak"
|
|
fi
|
|
info "Created docker-compose.yml"
|
|
fi
|
|
|
|
# --- .gitignore ---
|
|
GITIGNORE="$PROJECT_DIR/.gitignore"
|
|
if [[ -f "$GITIGNORE" ]]; then
|
|
if grep -q "\.devcontainer/config/" "$GITIGNORE"; then
|
|
warning ".gitignore already contains .devcontainer/config/, skipping"
|
|
else
|
|
printf '\n# PMOCrazyCoder devcontainer runtime config\n.devcontainer/config/\n' >> "$GITIGNORE"
|
|
info "Updated .gitignore"
|
|
fi
|
|
else
|
|
printf '# PMOCrazyCoder devcontainer runtime config\n.devcontainer/config/\n' > "$GITIGNORE"
|
|
info "Created .gitignore"
|
|
fi
|
|
|
|
echo
|
|
info "Done. Next steps:"
|
|
echo " 1. Open the project in VS Code / Zed / Cursor"
|
|
echo " 2. Reopen in container (the image will be pulled from the registry)"
|
|
echo " 3. Run /login in the Claude Agent panel to authenticate"
|
|
echo
|
|
info "To use a different local LLM API endpoint:"
|
|
echo " LOCAL_LLM_API=http://myserver:1248/v1 bash setup-devcontainer.sh"
|