Ariane — Copilot Instructions (concise)
Ariane — Copilot Instructions (concise)
Section titled “Ariane — Copilot Instructions (concise)”Canonical quick-start for AI coding agents. Focus on THIS repo’s real patterns; keep edits minimal & secure.
Structure & Roles
Section titled “Structure & Roles”site/Astro 5 app (Vercel). Pagessrc/pages/**, API routessrc/pages/api/**, edge logicsrc/middleware.ts.studio/Sanity v4 Studio (schemasstudio/schemas/**, exported viastudio/schemaTypes/index.ts).constellation/Docs (Astro + Starlight).infrastructure/Terraform + Ansible (Proxmox, Cloudflare Access). Entry:deploy.sh.scripts/&ops/Operational automation & server runbooks; security autofix scripts.wasm/Optional Rust→WASM signer (fallback JS insite/src/lib/auth/signer.ts).
Auth & Security (treat as hot path)
Section titled “Auth & Security (treat as hot path)”- Central entry:
site/src/middleware.ts(enforcesAUTH_MODE=public|app|cf-access-only, sets ALL security headers viaaddSecurityHeaders()). Never duplicate header logic elsewhere. - Session / cookie signing:
site/src/lib/auth/signer.ts(dynamic WASM load, JS fallback). Tests setSESSION_SECRETintests/setup/vitest.setup.ts. - Cloudflare Access JWT + group gating:
site/src/lib/cfAccess.ts(Terraform config underinfrastructure/cloudflare-access/). - Security automation:
scripts/security-autofix*.js(invoke withnpm run security:autofix). Review diff; do not weaken policies.
Development Workflows
Section titled “Development Workflows”- Site dev:
npm run dev:site(port 4321 expected by Playwright E2E). - Studio dev:
npm run dev:studio(deploys via Vercel deploy hook +vercel.jsonignore). - Preview build locally:
npm --prefix site run build && npm --prefix site run preview. - Combined dev + Cloudflare named tunnel:
npm run dev:bubble(usessite/cloudflared/config.yml). - WASM signer (optional):
npm --prefix site run wasm:build:signer(requires Rust toolchain present) — always keep JS fallback intact. - Tests:
npm run test(Vitest + Playwright; ensure site dev server running for E2E where needed). - Infra apply:
cd infrastructure && ./deploy.sh apply(Terraform then Ansible orchestration).
Data & Content Patterns
Section titled “Data & Content Patterns”- Sanity read helper:
site/src/lib/sanity.tsviafetchSanity<T>(groq, params)(CDN published only). - Server-side mutations:
site/src/lib/sanityServer.ts(needsSANITY_WRITE_TOKEN). - Consolidate GROQ: add/update in
site/src/lib/queries.ts— import from there instead of inlining long queries. - Content workflow: (1) create schema file (2) export in
studio/schemaTypes/index.ts(3) add GROQ inqueries.ts(4) consume viafetchSanity.
Deployment & Preview Nuances
Section titled “Deployment & Preview Nuances”- Vercel
ignoreCommandinsite/vercel.jsonandstudio/vercel.jsonprevents unnecessary builds; PR site previews gated by workflow +VERCEL_FORCE_PREVIEW=1label flow. - Keep security headers changes isolated to middleware or
site/vercel.json.
Infrastructure Snapshot (Oct 2025)
Section titled “Infrastructure Snapshot (Oct 2025)”- Proxmox host
neve(54.39.102.214) online; currently no active VMs/LXCs (Zitadel still on external host). Details & SSH patterns:docs/agents/CLAUDE.md,ops/proxmox-server.md. - Cloudflare Access Terraform under
infrastructure/cloudflare-access/(auto import script:ensure-imports.sh).
Testing & Mocks
Section titled “Testing & Mocks”- Global test setup:
tests/setup/vitest.setup.ts(MSW, crypto, DOM observer mocks). Ensure new network calls are either mocked or intentionally exercised.
Critical Constraints (DO NOT VIOLATE)
Section titled “Critical Constraints (DO NOT VIOLATE)”- Never downgrade dependencies; reject or amend automated downgrade PRs. Inspect
.github/workflows/*before altering dependency automation. - Don’t alter
addSecurityHeaders()semantics or secret handling without adding/adjusting tests. - Keep PRs single-concern, minimal surface; add tests/docs for changed behavior.
Fast Reference When Stuck
Section titled “Fast Reference When Stuck”Auth/edge: site/src/middleware.ts, site/src/lib/auth/*, site/src/lib/cfAccess.ts
Content: site/src/lib/sanity.ts, site/src/lib/queries.ts, studio/schemas/**
Infra: infrastructure/README.md, deploy.sh, docs/agents/CLAUDE.md
Security: scripts/security-autofix*.js, .github/workflows/security-*.yml
Keep this file concise; retain the dependency‑downgrade warning & security header centralization rule.