Initialize Aidoit v0.1 monorepo
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
FROM python:3.13-slim AS runtime
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY pyproject.toml requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY app ./app
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
@@ -0,0 +1,20 @@
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
aidoit_env: str = "development"
|
||||
aidoit_admin_token: str = "replace-me"
|
||||
database_url: str = "sqlite:///./aidoit.db"
|
||||
redis_url: str = "redis://localhost:6379/0"
|
||||
web_origin: str = "http://localhost:3000"
|
||||
msp_origin: str = "http://localhost:3001"
|
||||
|
||||
model_config = SettingsConfigDict(
|
||||
env_file=".env",
|
||||
env_file_encoding="utf-8",
|
||||
case_sensitive=False,
|
||||
extra="ignore",
|
||||
)
|
||||
|
||||
|
||||
settings = Settings()
|
||||
@@ -0,0 +1,32 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from app.core.config import settings
|
||||
from app.modules.health.router import router as health_router
|
||||
from app.modules.projects.router import router as projects_router
|
||||
|
||||
app = FastAPI(
|
||||
title="Aidoit API",
|
||||
version="0.1.0",
|
||||
description="Shared REST API for the Aidoit personal AI operating system.",
|
||||
)
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=[settings.web_origin, settings.msp_origin],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
app.include_router(health_router)
|
||||
app.include_router(projects_router, prefix="/api/v1")
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def root() -> dict[str, str]:
|
||||
return {
|
||||
"name": "Aidoit API",
|
||||
"version": "0.1.0",
|
||||
"docs": "/docs",
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter(tags=["health"])
|
||||
|
||||
|
||||
@router.get("/health")
|
||||
async def health() -> dict[str, str]:
|
||||
return {
|
||||
"status": "ok",
|
||||
"service": "aidoit-api",
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
from fastapi import APIRouter, HTTPException, status
|
||||
|
||||
from app.modules.projects.schemas import ProjectCreate, ProjectRead
|
||||
from app.modules.projects.service import project_service
|
||||
|
||||
router = APIRouter(prefix="/projects", tags=["projects"])
|
||||
|
||||
|
||||
@router.get("", response_model=list[ProjectRead])
|
||||
async def list_projects() -> list[ProjectRead]:
|
||||
return project_service.list()
|
||||
|
||||
|
||||
@router.post(
|
||||
"",
|
||||
response_model=ProjectRead,
|
||||
status_code=status.HTTP_201_CREATED,
|
||||
)
|
||||
async def create_project(payload: ProjectCreate) -> ProjectRead:
|
||||
return project_service.create(payload)
|
||||
|
||||
|
||||
@router.get("/{project_id}", response_model=ProjectRead)
|
||||
async def get_project(project_id: int) -> ProjectRead:
|
||||
project = project_service.get(project_id)
|
||||
if project is None:
|
||||
raise HTTPException(status_code=404, detail="Project not found")
|
||||
return project
|
||||
@@ -0,0 +1,19 @@
|
||||
from datetime import datetime
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
ProductType = Literal["web", "desktop", "msp"]
|
||||
|
||||
|
||||
class ProjectCreate(BaseModel):
|
||||
name: str = Field(min_length=1, max_length=120)
|
||||
description: str = Field(default="", max_length=2000)
|
||||
product: ProductType = "web"
|
||||
|
||||
|
||||
class ProjectRead(ProjectCreate):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
created_at: datetime
|
||||
@@ -0,0 +1,31 @@
|
||||
from datetime import UTC, datetime
|
||||
from itertools import count
|
||||
|
||||
from app.modules.projects.schemas import ProjectCreate, ProjectRead
|
||||
|
||||
|
||||
class ProjectService:
|
||||
def __init__(self) -> None:
|
||||
self._ids = count(1)
|
||||
self._projects: list[ProjectRead] = []
|
||||
|
||||
def list(self) -> list[ProjectRead]:
|
||||
return self._projects.copy()
|
||||
|
||||
def create(self, payload: ProjectCreate) -> ProjectRead:
|
||||
project = ProjectRead(
|
||||
id=next(self._ids),
|
||||
created_at=datetime.now(UTC),
|
||||
**payload.model_dump(),
|
||||
)
|
||||
self._projects.append(project)
|
||||
return project
|
||||
|
||||
def get(self, project_id: int) -> ProjectRead | None:
|
||||
return next(
|
||||
(project for project in self._projects if project.id == project_id),
|
||||
None,
|
||||
)
|
||||
|
||||
|
||||
project_service = ProjectService()
|
||||
@@ -0,0 +1,31 @@
|
||||
[project]
|
||||
name = "aidoit-api"
|
||||
version = "0.1.0"
|
||||
description = "Shared REST API for Aidoit"
|
||||
requires-python = ">=3.13"
|
||||
dependencies = [
|
||||
"fastapi>=0.115",
|
||||
"uvicorn[standard]>=0.34",
|
||||
"pydantic-settings>=2.7",
|
||||
"sqlalchemy>=2.0",
|
||||
"psycopg[binary]>=3.2",
|
||||
"alembic>=1.14",
|
||||
"redis>=5.2",
|
||||
"httpx>=0.28"
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"pytest>=8.3",
|
||||
"pytest-asyncio>=0.25",
|
||||
"ruff>=0.9",
|
||||
"mypy>=1.14"
|
||||
]
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 100
|
||||
target-version = "py313"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
pythonpath = ["."]
|
||||
testpaths = ["tests"]
|
||||
@@ -0,0 +1 @@
|
||||
-e .[dev]
|
||||
@@ -0,0 +1 @@
|
||||
-e .
|
||||
@@ -0,0 +1,11 @@
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.main import app
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
def test_health() -> None:
|
||||
response = client.get("/health")
|
||||
assert response.status_code == 200
|
||||
assert response.json()["status"] == "ok"
|
||||
@@ -0,0 +1,16 @@
|
||||
# Aidoit Desktop
|
||||
|
||||
This directory is reserved for the native Tauri application.
|
||||
|
||||
Planned capabilities:
|
||||
|
||||
- API authentication and synchronization
|
||||
- local filesystem access
|
||||
- shell execution
|
||||
- Git operations
|
||||
- Docker operations
|
||||
- local Ollama integration
|
||||
- native builds for macOS, Windows and Linux
|
||||
|
||||
Tauri initialization is intentionally deferred until the shared contracts and
|
||||
desktop security boundaries are finalized.
|
||||
@@ -0,0 +1,16 @@
|
||||
import "@aidoit/ui/styles.css";
|
||||
|
||||
export const metadata = {
|
||||
title: "Aidoit MSP",
|
||||
description: "Infrastructure management workspace",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{ children: React.ReactNode }>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
export default function MspHomePage() {
|
||||
return (
|
||||
<main style={{ padding: "48px", maxWidth: "1000px", margin: "0 auto" }}>
|
||||
<p style={{ color: "var(--accent)", fontWeight: 800 }}>AIDOIT MSP</p>
|
||||
<h1>Infrastructure workspace</h1>
|
||||
<p style={{ color: "var(--muted)" }}>
|
||||
VPS, Proxmox, Docker, LXC, monitoring, backups and deployments will live here.
|
||||
</p>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const config: NextConfig = {
|
||||
output: "standalone",
|
||||
transpilePackages: ["@aidoit/ui", "@aidoit/contracts", "@aidoit/sdk"],
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "@aidoit/msp",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev --port 3001",
|
||||
"build": "next build",
|
||||
"start": "next start --port 3001",
|
||||
"lint": "next lint",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"test": "echo \"No MSP tests yet\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@aidoit/contracts": "workspace:*",
|
||||
"@aidoit/sdk": "workspace:*",
|
||||
"@aidoit/ui": "workspace:*",
|
||||
"next": "^15.2.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aidoit/config": "workspace:*",
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"typescript": "^5.8.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "@aidoit/config/nextjs.json",
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
.app-shell {
|
||||
min-height: 100vh;
|
||||
display: grid;
|
||||
grid-template-columns: 250px 1fr;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
padding: 26px 20px;
|
||||
border-right: 1px solid var(--border);
|
||||
background: rgba(6, 14, 22, 0.9);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.brand {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: center;
|
||||
margin-bottom: 34px;
|
||||
}
|
||||
|
||||
.brand strong,
|
||||
.brand span {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.brand span {
|
||||
margin-top: 3px;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.brand-mark {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 13px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: #041019;
|
||||
background: linear-gradient(135deg, #83dcff, #4ca3ff);
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
nav {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
nav a {
|
||||
color: var(--muted);
|
||||
padding: 11px 12px;
|
||||
border-radius: 10px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
nav a:hover,
|
||||
nav a.active {
|
||||
color: var(--text);
|
||||
background: rgba(87, 199, 255, 0.1);
|
||||
}
|
||||
|
||||
.api-status {
|
||||
margin-top: auto;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
border-top: 1px solid var(--border);
|
||||
padding-top: 18px;
|
||||
}
|
||||
|
||||
.api-status span,
|
||||
.feed-item > span {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 7px;
|
||||
border-radius: 50%;
|
||||
background: #5be18a;
|
||||
}
|
||||
|
||||
.workspace {
|
||||
padding: 38px;
|
||||
}
|
||||
|
||||
.hero {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 20px;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.hero h1 {
|
||||
font-size: clamp(30px, 4vw, 48px);
|
||||
margin: 3px 0 10px;
|
||||
letter-spacing: -0.04em;
|
||||
}
|
||||
|
||||
.hero > div > p:last-child,
|
||||
.empty-state p,
|
||||
.feed-item p {
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.hero button {
|
||||
border: 0;
|
||||
border-radius: 12px;
|
||||
padding: 13px 18px;
|
||||
background: var(--accent);
|
||||
color: #041019;
|
||||
font-weight: 800;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
margin: 0;
|
||||
color: var(--accent);
|
||||
font-weight: 800;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.14em;
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.content-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1.4fr 0.8fr;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.panel {
|
||||
min-height: 330px;
|
||||
padding: 22px;
|
||||
border: 1px solid var(--border);
|
||||
background: linear-gradient(180deg, rgba(16, 30, 44, 0.96), rgba(10, 22, 32, 0.96));
|
||||
border-radius: 18px;
|
||||
}
|
||||
|
||||
.panel h2 {
|
||||
margin: 3px 0 0;
|
||||
}
|
||||
|
||||
.panel-heading {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.panel-heading a {
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
min-height: 240px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
align-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-state > div {
|
||||
width: 54px;
|
||||
height: 54px;
|
||||
border-radius: 18px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: rgba(87, 199, 255, 0.1);
|
||||
color: var(--accent);
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.feed-item {
|
||||
margin-top: 30px;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.feed-item p {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
@media (max-width: 1000px) {
|
||||
.app-shell {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.content-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 620px) {
|
||||
.workspace {
|
||||
padding: 22px;
|
||||
}
|
||||
|
||||
.hero {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { Metadata } from "next";
|
||||
import "@aidoit/ui/styles.css";
|
||||
import "./app.css";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Aidoit",
|
||||
description: "Personal AI operating system",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{ children: React.ReactNode }>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
import { StatCard } from "@aidoit/ui";
|
||||
|
||||
const navigation = [
|
||||
"Overview",
|
||||
"Projects",
|
||||
"Runs",
|
||||
"Tasks",
|
||||
"Teams",
|
||||
"Tools",
|
||||
"Deployments",
|
||||
"Servers",
|
||||
];
|
||||
|
||||
export default function HomePage() {
|
||||
return (
|
||||
<main className="app-shell">
|
||||
<aside className="sidebar">
|
||||
<div className="brand">
|
||||
<div className="brand-mark">A</div>
|
||||
<div>
|
||||
<strong>Aidoit</strong>
|
||||
<span>Personal AI OS</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
{navigation.map((item, index) => (
|
||||
<a className={index === 0 ? "active" : ""} href="#" key={item}>
|
||||
{item}
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
<div className="api-status">
|
||||
<span />
|
||||
Development environment
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<section className="workspace">
|
||||
<header className="hero">
|
||||
<div>
|
||||
<p className="eyebrow">AIDOIT CONTROL CENTER</p>
|
||||
<h1>Good evening, Pavel.</h1>
|
||||
<p>
|
||||
Build applications, orchestrate AI teams, and manage infrastructure
|
||||
from one workspace.
|
||||
</p>
|
||||
</div>
|
||||
<button type="button">New project</button>
|
||||
</header>
|
||||
|
||||
<section className="stats-grid" aria-label="Workspace statistics">
|
||||
<StatCard label="Projects" value="0" detail="Web, desktop and MSP" />
|
||||
<StatCard label="Active runs" value="0" detail="Harness executions" />
|
||||
<StatCard label="Pending tasks" value="0" detail="Waiting for a team" />
|
||||
<StatCard label="Deployments" value="0" detail="Preview and production" />
|
||||
</section>
|
||||
|
||||
<section className="content-grid">
|
||||
<article className="panel">
|
||||
<div className="panel-heading">
|
||||
<div>
|
||||
<p className="eyebrow">WORKSPACE</p>
|
||||
<h2>Recent projects</h2>
|
||||
</div>
|
||||
<a href="#">View all</a>
|
||||
</div>
|
||||
<div className="empty-state">
|
||||
<div>+</div>
|
||||
<h3>No projects yet</h3>
|
||||
<p>Create the first project and assign it to an AI team.</p>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<article className="panel">
|
||||
<p className="eyebrow">ACTIVITY</p>
|
||||
<h2>Harness feed</h2>
|
||||
<div className="feed-item">
|
||||
<span />
|
||||
<div>
|
||||
<strong>Platform initialized</strong>
|
||||
<p>Professional monorepo foundation is ready.</p>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const config: NextConfig = {
|
||||
output: "standalone",
|
||||
transpilePackages: ["@aidoit/ui", "@aidoit/contracts", "@aidoit/sdk"],
|
||||
};
|
||||
|
||||
export default config;
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "@aidoit/web",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev --port 3000",
|
||||
"build": "next build",
|
||||
"start": "next start --port 3000",
|
||||
"lint": "next lint",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"test": "echo \"No web tests yet\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@aidoit/contracts": "workspace:*",
|
||||
"@aidoit/sdk": "workspace:*",
|
||||
"@aidoit/ui": "workspace:*",
|
||||
"next": "^15.2.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@aidoit/config": "workspace:*",
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"typescript": "^5.8.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "@aidoit/config/nextjs.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user