diff --git a/README.md b/README.md index 775cfe0..1056e03 100644 --- a/README.md +++ b/README.md @@ -153,28 +153,40 @@ zenvra/ ### Setup -```bash -# Clone -git clone https://github.com/Cameroon-Developer-Network/zenvra.git -cd zenvra - -# Start infrastructure -docker compose up -d - -# Configure environment -cp .env.example .env -# Add your ANTHROPIC_API_KEY and DATABASE_URL - -# Build Rust workspace -cargo build +1. **Clone the repository:** + ```bash + git clone https://github.com/Cameroon-Developer-Network/zenvra.git + cd zenvra + ``` + +2. **Start infrastructure (Postgres & Redis):** + ```bash + # Starts only the necessary databases + docker compose up -d postgres redis + ``` + +3. **Configure environment:** + ```bash + cp .env.example .env + # Open .env and add your AI provider keys (Anthropic, OpenAI, or Google) + # The default DATABASE_URL in .env.example works with the docker setup + ``` + +4. **Start the Backend API:** + ```bash + cargo run -p zenvra-server + ``` + +5. **Start the Dashboard (Frontend):** + ```bash + cd apps/web + npm install # or pnpm install + npm run dev + ``` + +### Quick Scan via CLI -# Run all tests -cargo test --all - -# Frontend -cd apps/web && pnpm install && pnpm dev - -# Try the CLI +```bash cargo run -p zenvra-cli -- scan ./path/to/code ``` diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts index 76f559e..fba5e5e 100644 --- a/apps/web/src/lib/api.ts +++ b/apps/web/src/lib/api.ts @@ -16,6 +16,7 @@ export interface ScanRequest { language?: string; engines?: string[]; ai_config?: AiConfig; + min_severity?: 'critical' | 'high' | 'medium' | 'low' | 'info'; } export interface Finding { diff --git a/apps/web/src/lib/stores/usage.ts b/apps/web/src/lib/stores/usage.ts new file mode 100644 index 0000000..3869b07 --- /dev/null +++ b/apps/web/src/lib/stores/usage.ts @@ -0,0 +1,13 @@ +import { writable } from 'svelte/store'; +import { getHistory } from '$lib/api'; + +export const scanCount = writable(0); + +export async function refreshScanCount() { + try { + const history = await getHistory(); + scanCount.set(history.length); + } catch (e) { + console.error('Failed to refresh scan count:', e); + } +} diff --git a/apps/web/src/routes/+layout.svelte b/apps/web/src/routes/+layout.svelte index e33f4b8..d8f9b33 100644 --- a/apps/web/src/routes/+layout.svelte +++ b/apps/web/src/routes/+layout.svelte @@ -1,8 +1,16 @@