Skip to content

6. Local Docs-as-Code Scaffold & Repository Hygiene

Repository: VPS Infrastructure (planovi-vps) • Rule Prefix: BR-DOC • Documented Rules: 3 • Open [TEAM_WHY_NEEDED] Questions: 1

Business Purpose & Actors

  • Problem solved: Houses a standalone Astro Starlight documentation build (docs/) documenting the VPS topology, security, storage, deployment workflows, and troubleshooting runbooks, plus repository ignore hygiene (.gitignore) preventing accidental commits of live .env secrets, SSL keys, backups, and runtime volumes.
  • Actors: Infrastructure engineers maintaining VPS documentation; Astro/Starlight build toolchain.

All Features & End-to-End Flows

  1. Astro Starlight Site (docs/astro.config.mjs, docs/src/):
    • Custom zero-dependency Remark plugin remarkMermaid() converts fenced ```mermaid blocks into <pre class="mermaid">...</pre> so Expressive Code does not intercept them, rendered client-side via Mermaid 10.9.0 CDN with dark/light theme detection (docs/astro.config.mjs:6-69).
    • Custom SiteTitle.astro override (docs/src/components/SiteTitle.astro:1-115) adds a left-aligned sidebar collapse toggle button persisted in localStorage under key planovi_docs_sidebar_collapsed (desktop >= 800px collapses sidebar; mobile < 800px toggles data-mobile-menu-expanded drawer).
    • 14 Markdown/MDX pages covering Architecture, Services, Developer Guide, Operations, and Troubleshooting.
  2. Repository Ignore Hygiene (.gitignore:1-28):
    • Ignores .env, .env.local, .env.*.local, devops_handover_guide.md, cloudflare-ssl/, *.log, *.metadata.json, volumes/, backups/, supabase/, flutter-app/, migrations/, root kong.yml, php-app/index.php, and docs/{node_modules,.astro,dist}/.

Hard Business Rules, Validations, Calculations & Edge Cases

  • BR-DOC-01 (Secret & Runtime Exclusion): .gitignore:1-23 excludes live .env, cloudflare-ssl/, backups/, volumes/, and supabase/ runtime function directories from Git tracking.
  • BR-DOC-02 (Mermaid Rendering Security Level): docs/astro.config.mjs:54,63 initializes Mermaid 10.9.0 with securityLevel: 'loose' and re-runs on astro:after-swap View Transitions.
  • BR-DOC-03 (Duplicate Docs Portal Drift): PA-IDEAS/planovi-docs is the live Cloudflare Pages hub (dev-docs-arq.pages.dev, docs.planovi.app), making planovi-vps/docs/ a secondary copy that can drift from the central portal (it also still uses pre-rebrand styling rather than the #32CA42 / #09090B Starlight theme).

State Machines & Data Lifecycle

Static site build (astro build -> docs/dist/).

Technical Contract

  • Build Commands: npm run dev, npm run build, npm run preview (docs/package.json:6-11).
  • External Dependency: https://cdn.jsdelivr.net/npm/mermaid@10.9.0/dist/mermaid.min.js.

Cross-Repository Dependencies

  • Content in docs/src/content/docs/ mirrors the /vps/ tab inside PA-IDEAS/planovi-docs.

Why It Works This Way

  • Created during an earlier repo-local Docs-as-Code rollout (commit d5c2fc0) before documentation was consolidated into PA-IDEAS/planovi-docs.
  • [TEAM_WHY_NEEDED: Should planovi-vps/docs/ be deprecated/removed once PA-IDEAS/planovi-docs is updated from this blueprint, to prevent engineers from editing stale local docs?]

Debugging, Logs & Common Failure Modes

  • Symptom: Diagrams fail to render after client-side page navigation -> Root Cause: Mermaid script did not re-bind on Astro View Transitions -> Verify: Inspect browser console for mermaid errors on astro:after-swap -> Fix: Confirm astro.config.mjs:59-68 runs mermaid.run({ querySelector: '.mermaid' }).