Files
PMOCrazycoder/docker-entrypoint.sh
Eric Coissac 9c914b989b Enhance Docker setup with new tools and configurations
Update Dockerfile to install additional tools (orla, rust-analyzer), configure user permissions, and set up bash completion.

Update docker-entrypoint.sh to export new environment variables and configure MCP language servers for multiple languages (Go, Python, Rust, TypeScript) with proper workspace and LSP settings.

Add new documentation file AGENTS.md with development guidelines and security rules.

Add pyproject.toml for Python project configuration with dependencies and dev tools.

Add src/PMOCrazyCoder.py as a new MCP server implementation with example tools.
2026-02-21 23:04:23 +01:00

135 lines
4.0 KiB
Bash
Executable File

#!/bin/bash
# docker-entrypoint.sh
export USERNAME=${USERNAME:-devuser}
export WORKSPACE=${WORKSPACE:-/workspace}
export LOCAL_LLM_API=${LOCAL_LLM_API:-http://host.docker.internal:1248/v1}
export LLM_MODEL=${LLM_MODEL:-'ollama:qwen/qwen3-coder-next@4bit'}
export ORLA_OLLAMA_HOST=$(sed -E 's@(https?://[^/]+).*$@\1@' <<< $LOCAL_LLM_API)
export MAXTOKEN=${MAXTOKEN:-4096}
export NUM_CTX=${NUM_CTX:-32768}
export REPEAT_PENALTY=${REPEAT_PENALTY:-1.3}
export TEMPERATURE=${TEMPERATURE:-0.5}
export TOP_P=${TOP_P:-0.95}
export TOP_K=${TOP_K:-40}
export STOP=${STOP:-"[\"</s>\", \"\\n\\n\", \"def \", \"class \"]"}
# --- Initialise .ai_index si nécessaire ---
if [ ! -d "/workspace/.ai_index" ]; then
mkdir -p /workspace/.ai_index/ast
mkdir -p /workspace/.ai_index/embeddings
touch /workspace/.ai_index/graph.db
fi
# --- Configure LOCAL_LLM_API pour Bash ---
if [ -n "$LOCAL_LLM_API" ]; then
if ! grep -q "LOCAL_LLM_API" /home/${USERNAME}/.bashrc; then
echo "export LOCAL_LLM_API=$LOCAL_LLM_API" >> /home/${USERNAME}/.bashrc
echo "export ORLA_OLLAMA_HOST=$ORLA_OLLAMA_HOST" >> /home/${USERNAME}/.bashrc
echo "export ORLA_MODEL='${LLM_MODEL}'" >> /home/${USERNAME}/.bashrc
fi
mkdir -p /home/${USERNAME}/.config/opencode
CONFIG_FILE=/home/${USERNAME}/.config/opencode/opencode.json
cat > $CONFIG_FILE <<EOF
{
"\$schema": "https://opencode.ai/config.json",
"mcp": {
"go-lsp-tools": {
"type": "local",
"command": ["mcp-language-server",
"--workspace", "$WORKSPACE",
"--lsp", "gopls"
],
"enabled": true,
"environment": {
"GOPATH": "$GOPATH"
}
},
"python-lsp-tools": {
"type": "local",
"command": ["mcp-language-server",
"--workspace", "$WORKSPACE",
"--lsp", "pyright-langserver",
"--", "--stdio"
],
"enabled": true
},
"rust-lsp-tools": {
"type": "local",
"command": ["mcp-language-server",
"--workspace", "$WORKSPACE",
"--lsp", "$(find /usr/local/rustup/toolchains -type f -name rust-analyzer)"
],
"enabled": true
},
"typescript-lsp-tools": {
"type": "local",
"command": ["mcp-language-server",
"--workspace", "$WORKSPACE",
"--lsp", "typescript-language-server",
"--", "--stdio"
],
"enabled": true
},
},
"provider": {
"lmstudio": {
"npm": "@ai-sdk/openai-compatible",
"name": "LM Studio (local)",
"options": {
"baseURL": "$LOCAL_LLM_API",
"apiKey": ""
},
"models": {
"qwen/qwen3-coder-next@4bit": {
"name": "Qwen 3 Coder Next 80B — (LLMStudio ; 4-bit)",
"limit": {
"context": 200000,
"output": 65536
},
"settings": {
"temperature": $TEMPERATURE,
"top_p": $TOP_P,
"top_k": $TOP_K,
"max_tokens": ${MAXTOKEN},
"num_ctx": ${NUM_CTX},
"repeat_penalty": ${REPEAT_PENALTY},
"stop": ${STOP}
}
},
"qwen/qwen3-coder-next@6bit": {
"name": "Qwen 3 Coder Next 80B — (LLMStudio ; 6-bit)",
"limit": {
"context": 200000,
"output": 65536
},
"settings": {
"temperature": $TEMPERATURE,
"top_p": $TOP_P,
"top_k": $TOP_K,
"max_tokens": ${MAXTOKEN},
"num_ctx": ${NUM_CTX},
"repeat_penalty": ${REPEAT_PENALTY},
"stop": ${STOP}
}
}
}
}
},
"model": "${LLM_MODEL}"
}
EOF
chown ${USERNAME}:${USERNAME} ${CONFIG_FILE}
fi
# --- Force Bash comme shell par défaut ---
if [ -z "$1" ]; then
exec /bin/bash
else
exec "$@"
fi