|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +> **Audience** – Automated coding assistants (OpenAI Codex, Sourcegraph AMP, Windsurf, etc.). Humans are welcome to read it too! |
| 4 | +
|
| 5 | +--- |
| 6 | + |
| 7 | +## 🚀 Quick Facts |
| 8 | + |
| 9 | +| Key | Value | |
| 10 | +| -------------------- | ----------------------------------------------------------------------------------------------- | |
| 11 | +| **Site** | **pan.dev** – public developer documentation for Palo Alto Networks | |
| 12 | +| **Generator** | Docusaurus **3.7.0** (static site) | |
| 13 | +| **Tooling** | Yarn 4 workspaces, Node 20 LTS (see `.nvmrc`) | |
| 14 | +| **Selective builds** | `PRODUCTS_INCLUDE` env‑var lets you build one or more products instead of the whole site (≈1 h) | |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## 🗺️ Repository Map (top‑level) |
| 19 | + |
| 20 | +| Path | Purpose | |
| 21 | +| ---------------- | ----------------------------------------------------------------------- | |
| 22 | +| `products/` | One folder per product → MDX docs, OpenAPI specs, `sidebars.{js,ts}` | |
| 23 | +| `src/pages/` | Homepage & other global landing pages – **agents SHOULD improve these** | |
| 24 | +| `src/` | Shared React + TS components, theme overrides, utilities | |
| 25 | +| `static/` | Assets copied verbatim to the final build | |
| 26 | +| `plugin-*` | Custom Docusaurus plugins (`plugin-sitemap-coveo`, GTM, etc.) | |
| 27 | +| `scripts/` | Automation helpers (e.g., `openapi-to-mdx.ts`) | |
| 28 | +| `openapi-specs/` | Raw OpenAPI JSON/YAML files fed into plugin‑openapi‑docs | |
| 29 | +| `.github/` | Workflows (self‑hosted runners, preview deploys) | |
| 30 | + |
| 31 | +> **Gotcha** – Some products share a sidebar. If you omit one of those products from `PRODUCTS_INCLUDE`, the build will throw an “Unknown sidebar” error. When unsure, include the whole family (e.g., `sase,access,sdwan,scm`). |
| 32 | +
|
| 33 | +--- |
| 34 | + |
| 35 | +## 🛠️ Local Dev Cheat‑Sheet |
| 36 | + |
| 37 | +```bash |
| 38 | +# Install deps (Node 20 LTS) |
| 39 | +corepack enable # enables Yarn 4 if needed |
| 40 | +yarn |
| 41 | + |
| 42 | +# Full dev (slow) |
| 43 | +yarn start |
| 44 | + |
| 45 | +# Fast dev – only selected products |
| 46 | +cross-env PRODUCTS_INCLUDE=panos,prisma-cloud yarn start |
| 47 | + |
| 48 | +# Lint & format |
| 49 | +yarn lint && yarn format |
| 50 | + |
| 51 | +# Production build (selected products) |
| 52 | +cross-env PRODUCTS_INCLUDE=panos yarn build |
| 53 | +``` |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +## ✍️ Writing & Coding Guidelines |
| 58 | + |
| 59 | +| ✅ **DO** | ❌ **AVOID** | |
| 60 | +| -------------------------------------------------------------------- | --------------------------------------- | |
| 61 | +| Use plain English; define acronyms on first use | Security‑jargon overload | |
| 62 | +| Add front‑matter: `id`, `title`, `sidebar_label`, `sidebar_position` | Missing or duplicate `id`s | |
| 63 | +| Keep headings hierarchical (H2 → H3 → H4) | Skipping heading levels | |
| 64 | +| Provide runnable examples (`curl`, `python`, `golang`) | Proprietary/internal endpoints | |
| 65 | +| Run `yarn format` (Prettier) before every commit | Inconsistent spacing or 100+‑char lines | |
| 66 | +| Add **alt text** for images (a11y) | Decorative images without alt text | |
| 67 | + |
| 68 | +### Front‑end Conventions |
| 69 | + |
| 70 | +* React functional components in **TypeScript strict mode** (see `tsconfig.json`). |
| 71 | +* Style with CSS Modules or Tailwind (theme pre‑configured). |
| 72 | +* Absolute import paths use the `@/` alias. |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## 🤖 Common Agent Tasks |
| 77 | + |
| 78 | +1. **Generate docs from OpenAPI** |
| 79 | + |
| 80 | + ```bash |
| 81 | + yarn openapi:generate |
| 82 | + ``` |
| 83 | +2. **Author / update MDX** – add file, update product sidebar, run selective build. |
| 84 | +3. **Fix links** |
| 85 | + |
| 86 | + ```bash |
| 87 | + yarn lint:links |
| 88 | + ``` |
| 89 | +4. **Improve landing pages** – edit `src/pages/index.mdx` & friends. |
| 90 | +5. **CI tweaks** – update `.github/workflows/*.yml`, keep `PRODUCTS_INCLUDE` label logic intact. |
| 91 | + |
| 92 | +> Always open a PR —even for small fixes. GitHub Actions deploys a preview to Firebase for human review. |
| 93 | +
|
| 94 | +--- |
| 95 | + |
| 96 | +## 🔒 Safety & Compliance |
| 97 | + |
| 98 | +* **NO SECRETS** – never commit API keys, internal hostnames, or proprietary code. |
| 99 | +* Repo is public; content must stay customer‑friendly & vendor‑neutral. |
| 100 | +* Aim for WCAG AA accessibility (semantic HTML, good contrast, alt text). |
| 101 | + |
| 102 | +--- |
| 103 | + |
| 104 | +## 📚 Further Reading |
| 105 | + |
| 106 | +* [`README.md`](./README.md) – project overview |
| 107 | +* [`CONTRIBUTING.md`](./CONTRIBUTING.md) – full contribution guide |
| 108 | +* Docusaurus docs → [https://docusaurus.io/docs](https://docusaurus.io/docs) |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +*Last updated: **2025‑06‑18*** |
0 commit comments