Refactor MCP server structure and add AI commit tool

- Restructure src/ into package src/crazy_mcp with modular tools
- Add jj.py and sandbox.py tool modules for jujutsu and sandbox management
- Remove circular dependency on crazy-mcp from pyproject.toml
- Fix async get_state call in PMOCrazyCoder.py increment tool
- Add bin/jj-ai-commit.sh for AI-generated commit messages from diffs
- Update entrypoint to copy all bin scripts and create config directory
This commit is contained in:
2026-02-21 22:29:33 +00:00
parent 9c914b989b
commit 2d53f89172
9 changed files with 373 additions and 4 deletions

16
bin/jj-ai-commit.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
LOCAL_LLM_API=${LOCAL_LLM_API:-http://host.docker.internal:1248/v1}
DIFF=$(jj diff)
PROMPT='Analyse ce diff et réponds UNIQUEMENT avec un objet JSON valide contenant "title" (string) et "message" (string) pour le message de commit. Pas de texte avant ou après le JSON.'
CONTENT="${PROMPT}
${DIFF}"
REQUEST=$(jq -n --arg content "$CONTENT" '{"model": "qwen3-coder", "messages": [{"role": "user", "content": $content}]}')
curl -s -X POST \
-H "Content-Type: application/json" \
-d "$REQUEST" \
"$LOCAL_LLM_API/chat/completions" | jq -r '.choices[0].message.content' | jq -r '.title + "\n\n" + .message'