|
| 1 | +# AGENTS.md: project-monai.github.io |
| 2 | + |
| 3 | +This is the marketing/community website for the MONAI project. It is **not** the |
| 4 | +MONAI framework code; that lives at `Project-MONAI/MONAI`. |
| 5 | + |
| 6 | +## Stack |
| 7 | + |
| 8 | +- Astro 5.x (static site) |
| 9 | +- Tailwind 3.x |
| 10 | +- Model Zoo: a self-contained Vue 3 SPA (CDN UMD + `public/src/model-zoo-vue.js`, |
| 11 | + hash routing). It is NOT an Astro island; `@astrojs/vue` was removed 2026-06-10. |
| 12 | +- Deployed to GitHub Pages from `master` via `.github/workflows/deploy.yml` |
| 13 | +- Vitest for unit tests |
| 14 | + |
| 15 | +## Dev setup |
| 16 | + |
| 17 | +```bash |
| 18 | +npm install |
| 19 | +npm run dev # http://localhost:3000 + LAN IP |
| 20 | +npm run build # outputs dist/ |
| 21 | +npm test # vitest unit tests |
| 22 | +``` |
| 23 | + |
| 24 | +## Code conventions |
| 25 | + |
| 26 | +- Pages live under `src/pages/`. Default to `.astro` for new pages. `.md`/`.mdx` |
| 27 | + is supported but the site's existing pages use `.astro` for layout consistency. |
| 28 | +- Every page declares a `frontmatter` const with `title`, `description`, |
| 29 | + `canonical`. Optional: `audience` (array of `researcher` / `engineer` / |
| 30 | + `clinician` / `newcomer`), `schemaType` (`Course` / `Article` / `WebPage`), |
| 31 | + `metaRefresh` (for redirect-style pages). |
| 32 | +- Site visual conventions live in `docs/STYLEGUIDE.md` (component recipes) and |
| 33 | + `docs/DESIGN.md` (design direction, color roles, migration checklist, decision |
| 34 | + log). Read both before changing visual design; log notable decisions in |
| 35 | + DESIGN.md's decision log. |
| 36 | +- Tailwind classes only, no per-page CSS files. |
| 37 | +- **Asset naming**: images live in category folders with kebab-case names: |
| 38 | + `public/assets/img/people/<first-last>.<ext>` (headshots), |
| 39 | + `public/assets/img/logos/<org>.<ext>` (partner/contributor logos), |
| 40 | + `public/assets/img/figures/<page-or-topic>-<name>.<ext>` (figures/diagrams), |
| 41 | + and brand marks in `public/assets/logo/`. No spaces or CamelCase in filenames. |
| 42 | +- Follow the Writing voice rules in DESIGN.md for all user-facing copy and docs |
| 43 | + (no em dashes, no marketing AI-isms). |
| 44 | +- Inline `<script>` must use `is:inline` to bypass Vite processing. |
| 45 | +- **Analytics instrumentation** (event schema and GA4 setup: `docs/ANALYTICS.md`): |
| 46 | + when adding or editing a page, tag primary CTAs with |
| 47 | + `data-track="cta_click" data-track-cta-id="<page>_<slug>" |
| 48 | + data-track-cta-dest="<href>"`, and filter buttons with |
| 49 | + `data-track="filter_use"` + `data-track-filter-type/-value`. |
| 50 | + `public/assets/js/track.js` handles the rest; the footer markdown link |
| 51 | + (`md_twin_click`) ships site-wide automatically. |
| 52 | + |
| 53 | +## Load-bearing invariants (do not break these) |
| 54 | + |
| 55 | +- `build.format: 'file'` in `astro.config.mjs` emits `core.html`-style URLs. Internal |
| 56 | + hrefs are literal `*.html`, and the nav-active script and md-twins both parse `.html` |
| 57 | + filenames. The canonical URL must stay `https://project-monai.github.io` with `.html` paths. |
| 58 | +- Integration order in `astro.config.mjs` matters: `mdTwins()` must be registered before |
| 59 | + `llmsTxt()` (llms-full.txt reads the twins md-twins emits). |
| 60 | +- `src/integrations/llms-config.json` curates which pages concatenate into `llms-full.txt`. |
| 61 | +- The agent-detect script inlined in `BaseHead.astro` must run before gtag; treat that |
| 62 | + bootstrap as frozen (it has unit tests). |
| 63 | +- Tailwind's content globs must keep `./public/src/**/*.js`, or the Model Zoo's classes |
| 64 | + get purged from the compiled CSS. |
| 65 | +- After editing `public/src/model-zoo-vue.js`: run `node --check` on it, and keep both |
| 66 | + branches of `:class` ternaries as complete literal class strings (Tailwind scans literals). |
| 67 | +- `npm run build` first curls `model_data.json` from the live site (fallback: |
| 68 | + `model_data.sample.json`); keep that fallback file. |
| 69 | + |
| 70 | +## Build expectations |
| 71 | + |
| 72 | +`npm run build` must produce, in `dist/`: |
| 73 | +- One `.html` per page in `src/pages/` |
| 74 | +- One `.md` twin per page (via `src/integrations/md-twins.ts`) |
| 75 | +- `llms.txt`, `llms-full.txt`, `sitemap-index.xml`, `sitemap-llms.xml`, |
| 76 | + `robots.txt` |
| 77 | + |
| 78 | +If any of these are missing after a build, the integration is broken. |
| 79 | + |
| 80 | +## Testing |
| 81 | + |
| 82 | +Vitest unit tests live under `tests/`. Run with `npm test`. |
| 83 | + |
| 84 | +Visual regression tooling (optional, manual): |
| 85 | +- `npm run snapshot:current` captures dist screenshots with Puppeteer. |
| 86 | +- `npm run diff` compares against `visual-baseline/` (gitignored). |
| 87 | + |
| 88 | +## Pointers (doc map) |
| 89 | + |
| 90 | +- `docs/DESIGN.md`: design direction, color roles, alignment rules, decision log (canonical for "why") |
| 91 | +- `docs/STYLEGUIDE.md`: component-level class recipes |
| 92 | +- `docs/ARCHITECTURE.md`: stack decision (stay on Astro), simplification history, next steps |
| 93 | +- `docs/ANALYTICS.md`: GA4 operator guide (events, dimensions, dashboards) |
| 94 | + |
| 95 | +## What NOT to do |
| 96 | + |
| 97 | +- Don't add inline `<style>` blocks; use Tailwind utility classes. |
| 98 | +- Don't add `<!-- #include -->` directives; that pattern was retired with the |
| 99 | + Astro migration. Use Astro components. |
| 100 | +- Don't add new build scripts under `scripts/` without a clear reason; Astro |
| 101 | + integrations should handle most build-time work. |
| 102 | +- Don't bump `astro` to a major version (currently 5.x) without verifying the |
| 103 | + ecosystem integrations (`@astrojs/tailwind`, `@astrojs/sitemap`, `@astrojs/mdx`) |
| 104 | + and the custom `astro:build:done` integrations are compatible. |
| 105 | +- Don't re-add `@astrojs/vue`; nothing uses it (the Model Zoo is a CDN SPA). |
0 commit comments