diff --git a/.codex/environments/environment.toml b/.codex/environments/environment.toml new file mode 100644 index 0000000..1df7465 --- /dev/null +++ b/.codex/environments/environment.toml @@ -0,0 +1,6 @@ +# THIS IS AUTOGENERATED. DO NOT EDIT MANUALLY +version = 1 +name = "atlantis" + +[setup] +script = "npm install" diff --git a/.dockerignore b/.dockerignore index 6d40632..803ead9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -25,6 +25,7 @@ yarn-error.log* .env.test.local .env.production.local !.env.example +.env.bkp # IDE and editor .idea @@ -66,11 +67,24 @@ vitest.config.* # Development tools .eslintrc* .prettierrc* +.prettierignore .editorconfig tsconfig.tsbuildinfo +next-env.d.ts # Prisma migrations history (schema.template.prisma is needed) prisma/migrations # Data directory (mounted at runtime) data/ + + +# Other +.github/ +.codex/ +screenshots/ +data_new/ +plan/ +examples/ +TODO.md +AGENTS.md diff --git a/.env.example b/.env.example index 36a94ab..9e30e33 100644 --- a/.env.example +++ b/.env.example @@ -13,6 +13,14 @@ PRISMA_SKIP_AUTOPUSH= # Falls back to in-memory cache if not set # REDIS_URL=redis://localhost:6379 +# Live sync transport +# Use socket (SSE) for static instances, polling for serverless deployments +# Accepted values: socket | polling +NEXT_PUBLIC_LIVE_SYNC_METHOD=socket +# Polling interval in milliseconds (used only when method=polling) +# Accepted values: 3000 | 5000 | 10000 | 30000 +NEXT_PUBLIC_LIVE_SYNC_POLL_INTERVAL_MS=5000 + # API Access # Set to true to enable the /api/access endpoints and API docs integration ENABLE_API_ACCESS=false diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 750946a..9cbafe6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -9,6 +9,7 @@ labels: bug Clear summary of the issue. **Steps to Reproduce** + 1. 2. 3. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7a48baa..9664806 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,9 +1,11 @@ ## Summary + Describe the changes and motivation. Fixes # (issue) ## Checklist + - [ ] Tested changes locally - [ ] Updated documentation (if applicable) -- [ ] Follows project style \ No newline at end of file +- [ ] Follows project style diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..687448f --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,30 @@ +name: Lint and Formatting +permissions: + contents: read +on: + push: + branches: ['main', 'master'] + pull_request: + branches: ['main', 'master'] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install Dependencies + run: npm ci + + - name: Run ESLint + run: npm run lint + + - name: Run Prettier formatting check + run: npx prettier --check . diff --git a/AGENTS.md b/AGENTS.md index 0281cbc..600cfd7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,8 +10,17 @@ Purpose: concise, high-signal defaults for this Next.js 16 + TypeScript + Tailwi - Diagrams: Mermaid editor; persisted to Prisma SQLite or JSON backup. - Notes: see `src/app/notes`, server layouts fetch data and render client shells. - Icons/Fonts/Themes: lucide-react, `next/font`, `next-themes` (light/dark toggle). +- Code map: `plan/code-map.md` is the required map-first index for file ownership and task routing. - Editors: no Cursor rules (`.cursor/` missing); no Copilot instructions (`.github/copilot-instructions.md` missing). This file is authoritative. +## Mandatory Code Map Workflow + +- Always read `plan/code-map.md` before searching or editing code. +- Use map-first navigation: start with the intent map and open those files before broad searching. +- Avoid blind repo-wide searches unless the code map does not cover the task. +- If you add/move/rename files, routes, folders, or exported functions, update `plan/code-map.md` in the same change. +- Treat stale code-map entries as bugs; fix them as part of the task. + ## Commands (npm) - Install deps: `npm install` (first step before any command). @@ -32,13 +41,14 @@ Purpose: concise, high-signal defaults for this Next.js 16 + TypeScript + Tailwi ## Project Map - `src/app/`: routes/layout. `src/app/page.tsx` uses ISR 30s. -- `src/app/[id]/`: diagram editor (client-heavy); gate browser libs with mounted checks. +- `src/app/diagram/[id]/`: diagram editor (client-heavy); gate browser libs with mounted checks. - `src/app/notes/`: notes layout + list; dynamic fetch with `getNotePage`; entry page shows empty-state; `[id]/page` loads note with `getNoteById` and renders `NoteWorkspace`; `dynamic = 'force-dynamic'` on layout and page to avoid caching. - `src/app/api/`: API routes; keep server-only. - `src/components/`: feature/layout components. Avoid touching `src/components/ui` unless fixing a shared UI bug. - `src/lib/`: utilities, data access (`notes-data`), types, Zustand store. - `data/`: SQLite db/backups; `public/`: static assets; `scripts/`: bootstrap + Prisma helpers (bootstrap must run before dev/build). - `docs/`: repo docs; update this file and `docs/AI.md` if conventions change. +- `plan/`: planning docs; `plan/code-map.md` must stay current with structure and ownership. ## Styling @@ -149,6 +159,7 @@ Purpose: concise, high-signal defaults for this Next.js 16 + TypeScript + Tailwi - Docs live in `docs/`; see `docs/AI.md` for AI/agent usage guidance. - Update this file when commands, tooling, or conventions change. +- Update `plan/code-map.md` whenever code structure, directory ownership, routes, or exported responsibilities change. ## Extension Checklist diff --git a/docker-compose.simple.yml b/docker-compose.simple.yml index 2d9671d..3f7945f 100644 --- a/docker-compose.simple.yml +++ b/docker-compose.simple.yml @@ -8,7 +8,7 @@ services: container_name: atlantis restart: unless-stopped ports: - - "${PORT:-3000}:3000" + - '${PORT:-3000}:3000' volumes: # Persist diagram data - map to your preferred location # Default: uses Docker named volume @@ -23,7 +23,7 @@ services: - DATABASE_URL=${DATABASE_URL:-} # No REDIS_URL - uses in-memory caching healthcheck: - test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/" ] + test: ['CMD', 'wget', '--no-verbose', '--tries=1', '--spider', 'http://localhost:3000/'] interval: 30s timeout: 10s retries: 3 diff --git a/docker-compose.yml b/docker-compose.yml index 6bdd1af..755b200 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,9 +2,10 @@ services: atlantis: image: strikead/atlantis:latest container_name: atlantis + user: '1001:1001' restart: unless-stopped ports: - - "${PORT:-3000}:3000" + - '${PORT:-3000}:3000' volumes: # Persist diagram data - map to your preferred location # Default: uses Docker named volume @@ -19,11 +20,24 @@ services: - REDIS_URL=${REDIS_URL:-redis://redis:6379} # Database connection (optional - uses SQLite if not set) - DATABASE_URL=${DATABASE_URL:-} + # AI Configuration (OpenAI or Google AI Studio keys) + - AI_API_KEY=${AI_API_KEY:-} + # Live sync transport (socket or polling) + - NEXT_PUBLIC_LIVE_SYNC_METHOD=${NEXT_PUBLIC_LIVE_SYNC_METHOD:-socket} + - NEXT_PUBLIC_LIVE_SYNC_POLL_INTERVAL_MS=${NEXT_PUBLIC_LIVE_SYNC_POLL_INTERVAL_MS:-5000} + networks: + - atlantis-network depends_on: redis: condition: service_healthy healthcheck: - test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/" ] + test: + [ + 'CMD', + 'node', + '-e', + "fetch('http://127.0.0.1:3000/').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))", + ] interval: 30s timeout: 10s retries: 3 @@ -34,16 +48,24 @@ services: container_name: atlantis-redis restart: unless-stopped ports: - - "6379:6379" + - '6379:6379' volumes: - - ${ATLANTIS_DATA_DIR:-atlantis_data}:/data + - atlantis_redis_data:/data command: redis-server --appendonly yes + networks: + - atlantis-network healthcheck: - test: [ "CMD", "redis-cli", "ping" ] + test: ['CMD', 'redis-cli', 'ping'] interval: 10s timeout: 5s retries: 3 +networks: + atlantis-network: + driver: bridge + volumes: atlantis_data: driver: local + atlantis_redis_data: + driver: local diff --git a/docs/AI.md b/docs/AI.md index 3753b27..c0dea7a 100644 --- a/docs/AI.md +++ b/docs/AI.md @@ -12,7 +12,7 @@ Server endpoint: `POST /api/ai/assist` (requires valid CSRF token). UI handles C 2. **Providers**: - **OpenAI**: Default. Model: `gpt-4o-mini`. - - **Gemini**: Model: `gemini-2.5-flash` (override with `GEMINI_MODEL`). + - **Gemini**: Model: `gemini-3.1-flash-lite-preview` (override with `GEMINI_MODEL`). - **Auto-detect**: Chooses provider from key prefix (`sk-...` vs `AIza...`/`gsk_...`). ## Usage diff --git a/docs/CONTAINER_STARTUP.md b/docs/CONTAINER_STARTUP.md index 14b2c90..a67a310 100644 --- a/docs/CONTAINER_STARTUP.md +++ b/docs/CONTAINER_STARTUP.md @@ -136,7 +136,8 @@ PORT=8080 ATLANTIS_DATA_DIR=./my-data docker compose up -d | `PRISMA_AUTO_APPLY` | `true` (non-prod), `false` (prod) | Auto-runs `prisma db push` on server start to ensure schema exists. | | `PRISMA_SKIP_AUTOPUSH` | `false` | Set to `true` to skip all db push/seed operations. | | `ENABLE_API_ACCESS` | `false` | Set to `true` to enable the REST API and /docs. | -| `GEMINI_MODEL` | `gemini-2.5-flash` | Override default Gemini model when using Gemini provider. | +| `GEMINI_MODEL` | `gemini-3.1-flash-lite-preview` | Override default Gemini model when using Gemini provider. | +| `GEMINI_API_VERSION` | `v1` or `v1beta` | Gemini API version; auto-detects `v1beta` for preview models. | | `ATLANTIS_DATA_DIR` | `./data` | Host bind mount for data when using provided compose files. | ## Versioning diff --git a/docs/index.html b/docs/index.html index 701d78e..7c8e82c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,298 +1,356 @@ - + - -
- - - - - + + + + + +