189 lines
5.9 KiB
Bash
Executable File
189 lines
5.9 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Set proper locale for emoji and UTF-8 support
|
|
export LANG=en_US.UTF-8
|
|
export LC_ALL=en_US.UTF-8
|
|
|
|
echo "🎯 Setting up Cursor IDE support..."
|
|
|
|
# Create Cursor configuration directories
|
|
mkdir -p /home/coder/.cursor-server/data/User
|
|
mkdir -p /home/coder/.cursor-server/extensions
|
|
|
|
# Create optimized Cursor settings
|
|
cat > /home/coder/.cursor-server/data/User/settings.json << 'CURSOR_SETTINGS_END'
|
|
{
|
|
"workbench.colorTheme": "Dark+ (default dark)",
|
|
"editor.fontSize": 14,
|
|
"editor.tabSize": 2,
|
|
"editor.insertSpaces": true,
|
|
"editor.formatOnSave": true,
|
|
"editor.codeActionsOnSave": {
|
|
"source.fixAll": true,
|
|
"source.organizeImports": true
|
|
},
|
|
"files.autoSave": "afterDelay",
|
|
"files.autoSaveDelay": 1000,
|
|
"terminal.integrated.fontSize": 13,
|
|
"git.enableSmartCommit": true,
|
|
"git.confirmSync": false,
|
|
"python.defaultInterpreterPath": "/home/coder/.venv/bin/python",
|
|
"python.linting.enabled": true,
|
|
"python.linting.pylintEnabled": false,
|
|
"python.linting.flake8Enabled": true,
|
|
"typescript.preferences.includePackageJsonAutoImports": "auto",
|
|
"javascript.preferences.includePackageJsonAutoImports": "auto",
|
|
"cursor.chat.showInEditorContextMenu": true,
|
|
"cursor.chat.alwaysShowInEditorContextMenu": true,
|
|
"cursor.general.enableWindowAIFeatures": true
|
|
}
|
|
CURSOR_SETTINGS_END
|
|
|
|
# Create development tasks configuration
|
|
mkdir -p /home/coder/.cursor-server/data/User
|
|
cat > /home/coder/.cursor-server/data/User/tasks.json << 'CURSOR_TASKS_END'
|
|
{
|
|
"version": "2.0.0",
|
|
"tasks": [
|
|
{
|
|
"label": "Dev Server",
|
|
"type": "shell",
|
|
"command": "npm run dev",
|
|
"group": "build",
|
|
"presentation": {
|
|
"echo": true,
|
|
"reveal": "always",
|
|
"focus": false,
|
|
"panel": "new"
|
|
},
|
|
"problemMatcher": []
|
|
},
|
|
{
|
|
"label": "Python Dev Server",
|
|
"type": "shell",
|
|
"command": "uvicorn main:app --reload --host 0.0.0.0 --port 8000",
|
|
"group": "build",
|
|
"presentation": {
|
|
"echo": true,
|
|
"reveal": "always",
|
|
"focus": false,
|
|
"panel": "new"
|
|
},
|
|
"problemMatcher": []
|
|
},
|
|
{
|
|
"label": "Install Dependencies",
|
|
"type": "shell",
|
|
"command": "npm install",
|
|
"group": "build",
|
|
"presentation": {
|
|
"echo": true,
|
|
"reveal": "always",
|
|
"focus": false,
|
|
"panel": "new"
|
|
}
|
|
},
|
|
{
|
|
"label": "Python Install",
|
|
"type": "shell",
|
|
"command": "uv pip install -r requirements.txt",
|
|
"group": "build",
|
|
"presentation": {
|
|
"echo": true,
|
|
"reveal": "always",
|
|
"focus": false,
|
|
"panel": "new"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
CURSOR_TASKS_END
|
|
|
|
# Create useful code snippets
|
|
mkdir -p /home/coder/.cursor-server/data/User/snippets
|
|
cat > /home/coder/.cursor-server/data/User/snippets/global.code-snippets << 'CURSOR_SNIPPETS_END'
|
|
{
|
|
"FastAPI Basic App": {
|
|
"prefix": "fastapi-app",
|
|
"body": [
|
|
"from fastapi import FastAPI",
|
|
"from fastapi.middleware.cors import CORSMiddleware",
|
|
"",
|
|
"app = FastAPI(title=\"${1:My API}\", version=\"0.1.0\")",
|
|
"",
|
|
"app.add_middleware(",
|
|
" CORSMiddleware,",
|
|
" allow_origins=[\"*\"],",
|
|
" allow_credentials=True,",
|
|
" allow_methods=[\"*\"],",
|
|
" allow_headers=[\"*\"],",
|
|
")",
|
|
"",
|
|
"@app.get(\"/\")",
|
|
"async def root():",
|
|
" return {\"message\": \"${2:Hello World}\"}",
|
|
"",
|
|
"@app.get(\"/health\")",
|
|
"async def health():",
|
|
" return {\"status\": \"healthy\"}",
|
|
"",
|
|
"if __name__ == \"__main__\":",
|
|
" import uvicorn",
|
|
" uvicorn.run(app, host=\"0.0.0.0\", port=8000)"
|
|
],
|
|
"description": "FastAPI basic application template"
|
|
},
|
|
"Next.js API Route": {
|
|
"prefix": "nextapi",
|
|
"body": [
|
|
"import { NextRequest, NextResponse } from 'next/server';",
|
|
"",
|
|
"export async function ${1:GET}(request: NextRequest) {",
|
|
" try {",
|
|
" // Your API logic here",
|
|
" return NextResponse.json({ message: '${2:Success}' });",
|
|
" } catch (error) {",
|
|
" return NextResponse.json(",
|
|
" { error: 'Internal Server Error' },",
|
|
" { status: 500 }",
|
|
" );",
|
|
" }",
|
|
"}"
|
|
],
|
|
"description": "Next.js API route template"
|
|
},
|
|
"Database Connection": {
|
|
"prefix": "db-connect",
|
|
"body": [
|
|
"import os",
|
|
"from sqlalchemy import create_engine",
|
|
"from sqlalchemy.orm import sessionmaker",
|
|
"",
|
|
"DATABASE_URL = os.getenv(",
|
|
" \"POSTGRES_URL\",",
|
|
" \"postgresql://postgres:password@localhost:5432/postgres\"",
|
|
")",
|
|
"",
|
|
"engine = create_engine(DATABASE_URL)",
|
|
"SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)",
|
|
"",
|
|
"def get_db():",
|
|
" db = SessionLocal()",
|
|
" try:",
|
|
" yield db",
|
|
" finally:",
|
|
" db.close()"
|
|
],
|
|
"description": "Database connection setup"
|
|
}
|
|
}
|
|
CURSOR_SNIPPETS_END
|
|
|
|
# Set proper ownership
|
|
if id -u coder >/dev/null 2>&1; then
|
|
chown -R coder:coder /home/coder/.cursor-server
|
|
fi
|
|
|
|
echo "✅ Cursor IDE support configured"
|
|
echo "🎯 Cursor will use optimized settings for this development environment" |