Skip to content
📦 ARCHIVED SNAPSHOT (v1.0) You are viewing historical business logic and documentation for Webpage (planovi.app) v1.0 (frozen on 2026-11-23, commit 69f9463). Switch to Latest →

9. Internal Docs-as-Code Portal & Deployment Tooling

Repository: Webpage (planovi-webpage) • Rule Prefix: BR-OPS • Documented Rules: 5 • Open [TEAM_WHY_NEEDED] Questions: 2

1. Business Purpose & Actors

  • Problem solved: Hosts repo-local developer documentation built with Astro Starlight (docs/), AI agent guardrails (AGENTS.md / CLAUDE.md), and legacy deployment script (deploy.sh).
  • Actors: Internal PLANOVI engineers onboarding to or deploying planovi-webpage; AI coding agents; documentation build pipeline (planovi-docs).

2. All Features & End-to-End Flows

  • Flow A — Astro Starlight Static Site (docs/):
    • Build (npm run build in docs/): Compiles 12 Markdown/MDX pages in docs/src/content/docs/ using Astro 4.16.19 + Starlight 0.28.6 (docs/astro.config.mjs).
    • Custom remarkMermaid() plugin (docs/astro.config.mjs:6-19): Walks MDAST and converts ```mermaid fenced blocks into raw <pre class="mermaid">...</pre> nodes, rendered client-side via mermaid@10.9.0 CDN with securityLevel: 'loose', auto-matching data-theme, and re-running on astro:after-swap.
    • Custom SiteTitle.astro (docs/src/components/SiteTitle.astro:1-115): Prepends a burger toggle button that collapses the desktop sidebar (window.innerWidth >= 800, persisted in localStorage.planovi_docs_sidebar_collapsed) or opens the mobile drawer (< 800px, toggles body[data-mobile-menu-expanded]). Default Starlight right-side mobile button is hidden via CSS.
    • Brand styling (docs/src/styles/brand.css): Applies PLANOVI Zone 1 Starlight color variables (#32CA42 dark / #22A830 light, neutral #09090B / #FAFAFA, #09090B text on .sl-link-button.primary).
  • Flow B — Legacy Manual FTP Script (deploy.sh:1-34):
    • Finds all non-hidden files (-not -path "*/\.*" -not -name "deploy.sh") and uploads each via curl -s --ftp-create-dirs -T "$filepath" "ftp://$HOST/$filepath" --user "$USER:$PASS".
    • Note: Because find excludes only dotfiles and deploy.sh, running deploy.sh uploads config.php, docs/node_modules/ (if present), docs/, supabase/website_schema.sql, and scripts/ to the FTP root!

3. Hard Business Rules, Validations, Calculations & Edge Cases

  • BR-OPS-01 (Critical Security Defect — Hardcoded FTP Credentials in deploy.sh): deploy.sh:4-6 contains plaintext FTP host, username, and password committed directly to git history, AND .htaccess:12 does not block HTTP downloads of .sh files.
  • BR-OPS-02 (Docs Drift in docs/src/content/docs/): docs/astro.config.mjs:175-212 and all 12 markdown pages predate commit ca2682d (Native PHP + HTMX Blog) and completely omit blog.php, blog-post.php, sitemap.php, includes/blog-repository.php, includes/security.php, router.php, and supabase/website_schema.sql.
  • BR-OPS-03 (Mermaid securityLevel: 'loose'): docs/astro.config.mjs:62,71 initializes Mermaid with securityLevel: 'loose' (enables HTML labels/click handlers; acceptable only for trusted repo-authored Markdown).
  • BR-OPS-04 (No CI/CD Workflows in Repository): .github/ is empty (deployment workflow deleted in commit d40fc6b; deployments rely on an external Hostinger VPS webhook listener outside this repo).
  • BR-OPS-05 (AI Rule Symlink): CLAUDE.md is a relative symlink to AGENTS.md enforcing Zone 1 branding rules and forbidding reading/committing config.php or .env.

4. State Machines & Data Lifecycle

Static site build lifecycle: docs/src/content/docs/**/*.md → npm run build → docs/dist/ (gitignored). Sidebar UI state persisted in localStorage.planovi_docs_sidebar_collapsed.

5. Technical Contract (Inputs → Processing → Side Effects)

  • Inputs: Markdown/MDX files, docs/astro.config.mjs, docs/src/styles/brand.css, docs/public/brand/*.
  • Side Effects: npm run build outputs static HTML/CSS/JS to docs/dist/; deploy.sh mutates remote FTP server filesystem.

6. Cross-Repository Dependencies

Caller → CalleeProtocol & AuthExact Endpoint / Contract
docs/astro.config.mjs → jsDelivr CDNPublic HTTPS GEThttps://cdn.jsdelivr.net/npm/mermaid@10.9.0/dist/mermaid.min.js
GitHub Repo → Hostinger VPS DeployerHTTPS GitHub Webhook (configured outside repo)Triggers git pull / deploy on develop (dev-webpage.planovi.app) and main (planovi.app)

7. Why It Works This Way (Decisions, Trade-offs & Workarounds)

  • Zero-dependency remarkMermaid() plugin: Avoids Playwright/Chromium/Puppeteer build-time dependencies when rendering Mermaid diagrams in Starlight (docs/astro.config.mjs:4-5).
  • GitHub Actions workflow removed (commit d40fc6b): Replaced by Hostinger VPS webhook deployment.
  • [TEAM_WHY_NEEDED: Is deploy.sh completely deprecated now that VPS GitHub webhook deployment is active? Have the exposed FTP credentials in deploy.sh been rotated and revoked, and can deploy.sh be purged from the repo?]
  • [TEAM_WHY_NEEDED: Once planovi-docs hosts the centralized webpage documentation tab, will the repo-local docs/ Astro Starlight folder be retired or kept in sync?]

8. Debugging, Logs & Common Failure Modes

Symptom / Error MessageRoot Cause in CodeHow to VerifyFix
Mermaid diagrams show raw text in docs/ previewOffline environment blocking cdn.jsdelivr.net, or astro:after-swap fired before deferred Mermaid script loaded (docs/astro.config.mjs:45-76)Check browser Network & Console tabsEnsure CDN access and guard if (window.mermaid) before calling mermaid.initialize()
deploy.sh fails or uploads unwanted filesHardcoded FTP credentials or unexcluded docs/node_modules/ / config.php (deploy.sh:14)Do not execute deploy.shRotate/revoke FTP account and remove deploy.sh