Add initial web editor app, CLI scripts, and test scaffolding.

This introduces the FastAPI editor implementation and related project setup so the app can be run and validated locally.

Made-with: Cursor
This commit is contained in:
2026-04-11 02:14:26 +12:00
parent fb5f55cda7
commit f9bf119af6
33 changed files with 4846 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import importlib
import os
import sys
from pathlib import Path
from fastapi.testclient import TestClient
def test_python_completion_returns_basic_suggestions(tmp_path):
editor_dir = Path(__file__).resolve().parents[1]
src_dir = editor_dir / "src"
if str(src_dir) not in sys.path:
sys.path.insert(0, str(src_dir))
os.environ["WORKSPACE_ROOT"] = str(tmp_path)
import app as editor_app
editor_app = importlib.reload(editor_app)
editor_app.WORKSPACE_ROOT = tmp_path
client = TestClient(editor_app.app)
response = client.post(
"/api/python/completions",
json={
"file_path": "example.py",
"content": "import os\nos.pa",
"line": 2,
"column": 5,
"max_results": 20,
},
)
assert response.status_code == 200
body = response.json()
names = [item["name"] for item in body["completions"]]
assert "path" in names