|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Conanproxy is a Node.js (Express) proxy server that sits in front of a Conan package manager server. It serves the Compiler Explorer (godbolt.org) ecosystem by providing library binary packages, build logging, failure tracking, and a web dashboard. It proxies Conan API requests (`/v1/*`, `/v2/*`) to a local Conan server at port 9300 while adding authentication, analytics, and a web UI on port 1080. |
| 8 | + |
| 9 | +## Commands |
| 10 | + |
| 11 | +- **Start server**: `npm start` (runs `node index.js`) |
| 12 | +- **Lint**: `npm run lint` (ESLint with auto-fix on `index.js`, `build-logging.js`, `build-annotations.js`, `cpp-build-results.js`, `compiler-restrictions.js`) |
| 13 | +- **Dev test**: `npm run devtest` (starts server with test env vars `CESECRET=123456789 CEPASSWORD=1234`) |
| 14 | +- **CI**: GitHub Actions runs `npm run lint` on Node 16.x and 22.x. There are no automated tests. |
| 15 | + |
| 16 | +## Architecture |
| 17 | + |
| 18 | +**Entry point**: `index.js` (~740 lines) — contains all Express routes, server initialization, and data refresh logic. On startup it: |
| 19 | +1. Connects to SQLite database and runs migrations |
| 20 | +2. Fetches compiler/library metadata from the Compiler Explorer API (`godbolt.org`) |
| 21 | +3. Scans the local Conan server filesystem for available packages |
| 22 | +4. Starts Express on port 1080 |
| 23 | + |
| 24 | +**Key modules**: |
| 25 | +- `build-logging.js` — SQLite operations for build status tracking (failures, logs, compiler stats) |
| 26 | +- `build-annotations.js` — Reads/writes JSON annotation files on disk for build metadata (commit hash, ABI, architecture) |
| 27 | +- `cpp-build-results.js` — Generates HTML build result views using Pug templates; queries AWS DynamoDB for build history |
| 28 | +- `compiler-restrictions.js` — Blocks downloads of proprietary compiler packages (Intel ICC, MSVC, QNX, EDG) |
| 29 | + |
| 30 | +**Data sources**: |
| 31 | +- Compiler Explorer API (`godbolt.org`) — compiler list, library metadata |
| 32 | +- Local Conan server filesystem (`/home/ce/.conan_server/data/`) — package files and annotations |
| 33 | +- SQLite (`buildslogs.db`) — build logs and failure records |
| 34 | +- AWS DynamoDB (`library-build-history` table) — historical build tracking |
| 35 | + |
| 36 | +**Authentication**: JWT-based (12-hour tokens) via `express-jwt`. Public routes serve data/pages; authenticated routes handle build status updates and annotation writes. |
| 37 | + |
| 38 | +**Frontend**: Static HTML pages in `/html/` using Bootstrap 4.5 with dark mode support. Pug templates in `/views/` for dynamic pages like build results. |
| 39 | + |
| 40 | +## Code Style |
| 41 | + |
| 42 | +- Plain JavaScript (no TypeScript) — intentional choice due to tight coupling with production data |
| 43 | +- ESLint config: 4-space indentation, 160-char line length, semicolons required, smart equality (`===`) |
| 44 | +- Database migrations live in `/migrations/` (sequential SQL files) |
0 commit comments