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 buildindocs/): Compiles 12 Markdown/MDX pages indocs/src/content/docs/using Astro4.16.19+ Starlight0.28.6(docs/astro.config.mjs). - Custom
remarkMermaid()plugin (docs/astro.config.mjs:6-19): Walks MDAST and converts```mermaidfenced blocks into raw<pre class="mermaid">...</pre>nodes, rendered client-side viamermaid@10.9.0CDN withsecurityLevel: 'loose', auto-matchingdata-theme, and re-running onastro: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 inlocalStorage.planovi_docs_sidebar_collapsed) or opens the mobile drawer (< 800px, togglesbody[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 (#32CA42dark /#22A830light, neutral#09090B/#FAFAFA,#09090Btext on.sl-link-button.primary).
- Build (
- Flow B — Legacy Manual FTP Script (
deploy.sh:1-34):- Finds all non-hidden files (
-not -path "*/\.*" -not -name "deploy.sh") and uploads each viacurl -s --ftp-create-dirs -T "$filepath" "ftp://$HOST/$filepath" --user "$USER:$PASS". - Note: Because
findexcludes only dotfiles anddeploy.sh, runningdeploy.shuploadsconfig.php,docs/node_modules/(if present),docs/,supabase/website_schema.sql, andscripts/to the FTP root!
- Finds all non-hidden files (
3. Hard Business Rules, Validations, Calculations & Edge Cases
- BR-OPS-01 (Critical Security Defect — Hardcoded FTP Credentials in
deploy.sh):deploy.sh:4-6contains plaintext FTP host, username, and password committed directly to git history, AND.htaccess:12does not block HTTP downloads of.shfiles. - BR-OPS-02 (Docs Drift in
docs/src/content/docs/):docs/astro.config.mjs:175-212and all 12 markdown pages predate commitca2682d(Native PHP + HTMX Blog) and completely omitblog.php,blog-post.php,sitemap.php,includes/blog-repository.php,includes/security.php,router.php, andsupabase/website_schema.sql. - BR-OPS-03 (Mermaid
securityLevel: 'loose'):docs/astro.config.mjs:62,71initializes Mermaid withsecurityLevel: '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 commitd40fc6b; deployments rely on an external Hostinger VPS webhook listener outside this repo). - BR-OPS-05 (AI Rule Symlink):
CLAUDE.mdis a relative symlink toAGENTS.mdenforcing Zone 1 branding rules and forbidding reading/committingconfig.phpor.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 buildoutputs static HTML/CSS/JS todocs/dist/;deploy.shmutates remote FTP server filesystem.
6. Cross-Repository Dependencies
| Caller → Callee | Protocol & Auth | Exact Endpoint / Contract |
|---|---|---|
docs/astro.config.mjs → jsDelivr CDN | Public HTTPS GET | https://cdn.jsdelivr.net/npm/mermaid@10.9.0/dist/mermaid.min.js |
| GitHub Repo → Hostinger VPS Deployer | HTTPS 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 Message | Root Cause in Code | How to Verify | Fix |
|---|---|---|---|
Mermaid diagrams show raw text in docs/ preview | Offline 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 tabs | Ensure CDN access and guard if (window.mermaid) before calling mermaid.initialize() |
deploy.sh fails or uploads unwanted files | Hardcoded FTP credentials or unexcluded docs/node_modules/ / config.php (deploy.sh:14) | Do not execute deploy.sh | Rotate/revoke FTP account and remove deploy.sh |