push-oynptmmzrplt #2
7
.devcontainer/devcontainer.json
Normal file
7
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "PMOCrazyCoder",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "pmocrazy-coder",
|
||||
"workspaceFolder": "/workspace",
|
||||
"remoteUser": "devuser"
|
||||
}
|
||||
15
.devcontainer/docker-compose.yml
Normal file
15
.devcontainer/docker-compose.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
pmocrazy-coder:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- ..:/workspace
|
||||
working_dir: /workspace
|
||||
ports:
|
||||
- "1248:1248"
|
||||
user: devuser
|
||||
entrypoint: ["/usr/local/bin/entrypoint.sh"]
|
||||
command: ["bash", "-c", "tail -f /dev/null"]
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -208,3 +208,6 @@ cython_debug/
|
||||
|
||||
# PyPI configuration file
|
||||
.pypirc
|
||||
|
||||
# AI Index
|
||||
.ai_index/
|
||||
|
||||
29
.opencode/instructions.md
Normal file
29
.opencode/instructions.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# OpenCode Global Instructions
|
||||
|
||||
## Path handling rules
|
||||
|
||||
- Always use relative paths.
|
||||
- Never generate absolute paths (e.g. /Users/..., /home/..., C:\...).
|
||||
- Never assume a specific username, OS, or local filesystem layout.
|
||||
- All paths must be relative to the project root unless explicitly specified.
|
||||
- Do not guess the current working directory.
|
||||
- If the working directory is ambiguous, ask for clarification instead of inventing one.
|
||||
|
||||
## Workspace assumptions
|
||||
|
||||
- Assume the workspace root is the repository root.
|
||||
- Do not hardcode environment-specific values.
|
||||
- Do not infer the machine, OS, or home directory.
|
||||
|
||||
## File generation rules
|
||||
|
||||
- Generate only the requested file.
|
||||
- Do not modify unrelated files.
|
||||
- Do not add additional configuration unless explicitly requested.
|
||||
- Output valid JSON with no comments when JSON is requested.
|
||||
|
||||
## Determinism
|
||||
|
||||
- Avoid creative alternatives.
|
||||
- Do not propose multiple solutions unless asked.
|
||||
- Produce a single, minimal, correct implementation.
|
||||
40
Dockerfile
Normal file
40
Dockerfile
Normal file
@@ -0,0 +1,40 @@
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3 python3-pip \
|
||||
golang-go rustc cargo \
|
||||
r-base \
|
||||
sqlite3 build-essential git curl wget \
|
||||
bash zsh \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Installer jj
|
||||
RUN curl -LO https://github.com/martinvonz/jj/releases/latest/download/jj-x86_64-unknown-linux-gnu \
|
||||
&& chmod +x jj-x86_64-unknown-linux-gnu \
|
||||
&& mv jj-x86_64-unknown-linux-gnu /opt/bin/jj
|
||||
|
||||
# Installer jj_lsp (si binaire séparé)
|
||||
RUN curl -LO https://github.com/martinvonz/jj/releases/latest/download/jj_lsp-x86_64-unknown-linux-gnu \
|
||||
&& chmod +x jj_lsp-x86_64-unknown-linux-gnu \
|
||||
&& mv jj_lsp-x86_64-unknown-linux-gnu /opt/bin/jj_lsp
|
||||
|
||||
COPY opt/bin/ /opt/bin/
|
||||
COPY opt/dev-tools/ /opt/dev-tools/
|
||||
COPY opt/lm-client/ /opt/lm-client/
|
||||
|
||||
ENV PATH="/opt/bin:/opt/dev-tools:/opt/lm-client:${PATH}"
|
||||
|
||||
ARG USERNAME=devuser
|
||||
ARG USER_UID=1000
|
||||
ARG USER_GID=1000
|
||||
RUN groupadd --gid $USER_GID $USERNAME \
|
||||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
|
||||
|
||||
COPY docker-entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
USER $USERNAME
|
||||
WORKDIR /workspace
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
CMD ["/bin/bash"]
|
||||
66
Makefile
Normal file
66
Makefile
Normal file
@@ -0,0 +1,66 @@
|
||||
# Makefile pour dev container AI + MCP bootstrap
|
||||
|
||||
# Variables
|
||||
PROJECT_DIR := $(shell pwd)
|
||||
CONTAINER_NAME := ai-dev-container
|
||||
WORKSPACE := /workspace
|
||||
MCP_LOG := $(WORKSPACE)/.ai_index/mcp.log
|
||||
|
||||
# --- Dev Container Management ---
|
||||
|
||||
# Build the container
|
||||
build:
|
||||
docker build -t $(CONTAINER_NAME) .
|
||||
|
||||
# Run interactive container with mounted project
|
||||
run:
|
||||
docker run -v $(PROJECT_DIR):$(WORKSPACE) -it --rm $(CONTAINER_NAME)
|
||||
|
||||
# Run container with MCP server in background
|
||||
run-mcp:
|
||||
docker run -v $(PROJECT_DIR):$(WORKSPACE) -it --rm $(CONTAINER_NAME) bash
|
||||
|
||||
# --- MCP / Index Management ---
|
||||
|
||||
# Initialize .ai_index
|
||||
init-index:
|
||||
@echo "[MAKE] Initializing .ai_index..."
|
||||
mkdir -p $(PROJECT_DIR)/.ai_index/ast
|
||||
mkdir -p $(PROJECT_DIR)/.ai_index/embeddings
|
||||
@if [ ! -f $(PROJECT_DIR)/.ai_index/graph.db ]; then \
|
||||
sqlite3 $(PROJECT_DIR)/.ai_index/graph.db "VACUUM;"; \
|
||||
fi
|
||||
|
||||
# Run MCP tool (list imports)
|
||||
mcp-list:
|
||||
@echo "[MAKE] Running MCP list_imports.py..."
|
||||
python3 $(PROJECT_DIR)/opt/dev-tools/list_imports.py --project $(WORKSPACE)
|
||||
|
||||
# Update embeddings (example)
|
||||
embeddings:
|
||||
@echo "[MAKE] Generating embeddings..."
|
||||
python3 $(PROJECT_DIR)/opt/dev-tools/generate_embeddings.py --project $(WORKSPACE)
|
||||
|
||||
# Update graph (example)
|
||||
update-graph:
|
||||
@echo "[MAKE] Updating dependency graph..."
|
||||
python3 $(PROJECT_DIR)/opt/dev-tools/update_graph.py --project $(WORKSPACE)
|
||||
|
||||
# Clean logs and temporary files
|
||||
clean:
|
||||
@echo "[MAKE] Cleaning .ai_index..."
|
||||
rm -f $(PROJECT_DIR)/.ai_index/*.log
|
||||
rm -rf $(PROJECT_DIR)/.ai_index/ast/*
|
||||
rm -rf $(PROJECT_DIR)/.ai_index/embeddings/*
|
||||
|
||||
# Restart MCP server inside container
|
||||
restart-mcp:
|
||||
docker exec -it $(CONTAINER_NAME) bash -c "\
|
||||
pkill -f mcp-server; \
|
||||
/opt/bin/mcp-server --project $(WORKSPACE) > $(MCP_LOG) 2>&1 & \
|
||||
"
|
||||
|
||||
# --- Bootstrap for new project ---
|
||||
# Build container, init index
|
||||
bootstrap: build init-index
|
||||
@echo "[MAKE] Bootstrap complete. Run 'make run' to start the container."
|
||||
19
README.md
Normal file
19
README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# 🧠 PMOCrazyCoder
|
||||
|
||||
Un assistant IA **local**, pour coder en Go, Rust et R —
|
||||
sans cloud, sans API key, tout sur votre M3 Max.
|
||||
|
||||
## 🎯 Vision
|
||||
|
||||
> *Un indexeur de code, des graphes de dépendances, et un assistant intelligent —
|
||||
> intégré à Zed, 100 % local.*
|
||||
|
||||
### 🛠️ Ce qu’on construit
|
||||
|
||||
- ✅ MCP tools pour Zed (ex : `get_similar_functions`, `explain_imports`)
|
||||
- ✅ Indexeur de code (Go / Rust / R) via Tree-sitter
|
||||
- ✅ Graphe de dépendances & similarité (stocké localement)
|
||||
- ✅ Tout tourne en local : **LM Studio** (`localhost:1248`) + LanceDB + Rust/Python
|
||||
*(hors conteneur — le conteneur y accède via `host.docker.internal:1248`)*
|
||||
|
||||
### 📦 Structure future (à venir)
|
||||
10
docker-compose.yml
Normal file
10
docker-compose.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
pmocrazy-coder:
|
||||
build: .
|
||||
volumes:
|
||||
- .:/workspace
|
||||
working_dir: /workspace
|
||||
ports:
|
||||
- "1248:1248"
|
||||
14
docker-entrypoint.sh
Executable file
14
docker-entrypoint.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
# docker-entrypoint.sh
|
||||
|
||||
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
|
||||
|
||||
/opt/bin/mcp-server > /workspace/.ai_index/mcp.log 2>&1 &
|
||||
MCP_PID=$!
|
||||
echo $MCP_PID > /workspace/.ai_index/mcp.pid
|
||||
|
||||
exec "$@"
|
||||
5
opt/bin/mcp-server
Executable file
5
opt/bin/mcp-server
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
echo "[MCP] Starting..." >> /workspace/.ai_index/mcp.log
|
||||
python3 /opt/dev-tools/list_imports.py "$@" >> /workspace/.ai_index/mcp.log 2>&1 &
|
||||
echo $! > /workspace/.ai_index/mcp.pid
|
||||
wait
|
||||
27
opt/dev-tools/list_imports.py
Normal file
27
opt/dev-tools/list_imports.py
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys, json
|
||||
|
||||
def get_imports_go(filepath: str) -> list[str]:
|
||||
try:
|
||||
with open(filepath) as f:
|
||||
lines = f.readlines()
|
||||
imports = []
|
||||
in_import_block = False
|
||||
for line in lines:
|
||||
stripped = line.strip()
|
||||
if stripped == "import (":
|
||||
in_import_block = True
|
||||
continue
|
||||
if stripped == ")" and in_import_block:
|
||||
break
|
||||
if in_import_block and stripped.startswith('"'):
|
||||
imports.append(stripped.strip('"'))
|
||||
return imports
|
||||
except Exception as e:
|
||||
return [f"error: {e}"]
|
||||
|
||||
if __name__ == "__main__":
|
||||
args = json.loads(sys.argv[1])
|
||||
filepath = args.get("file", "")
|
||||
result = get_imports_go(filepath)
|
||||
print(json.dumps({"result": result}, indent=2))
|
||||
3
opt/lm-client/readme.md
Normal file
3
opt/lm-client/readme.md
Normal file
@@ -0,0 +1,3 @@
|
||||
LM Studio client for Qwen3-Coder-Next
|
||||
Download from: https://lmstudio.ai/
|
||||
Configure to run on localhost:1248
|
||||
9
zed-integration/mcp.json
Normal file
9
zed-integration/mcp.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"pmocrazy-coder": {
|
||||
"command": "python3",
|
||||
"args": ["opt/dev-tools/list_imports.py"],
|
||||
"cwd": "."
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user