|
| 1 | +# OpenCHAMI.org Copilot Instructions |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +**OpenCHAMI.org** is a Hugo-based static documentation site for the [OpenCHAMI project](https://openchami.org), an open-source HPC system management platform. The site uses the **Doks theme** (via `@hyas/doks-core`) to build and deploy technical documentation, blog posts, events, and community contributor profiles. |
| 6 | + |
| 7 | +**Key Tech Stack:** |
| 8 | +- Hugo (0.123.7) for static site generation |
| 9 | +- Node.js + pnpm for dependency management |
| 10 | +- SCSS/CSS for styling (with Tabler Icons) |
| 11 | +- Netlify for hosting and CI/CD |
| 12 | +- REUSE specification for licensing compliance |
| 13 | + |
| 14 | +## Critical Developer Workflows |
| 15 | + |
| 16 | +### Local Development |
| 17 | +```bash |
| 18 | +npm install # Install dependencies (includes Hugo) |
| 19 | +npm run dev # Start dev server at http://localhost:1313 |
| 20 | +npm run dev:drafts # Include draft pages (--buildDrafts) |
| 21 | +npm run build # Production build |
| 22 | +npm run preview # Preview production build locally |
| 23 | +``` |
| 24 | + |
| 25 | +### Content Management |
| 26 | +```bash |
| 27 | +npm run create path/to/content # Create new content with archetype scaffolding |
| 28 | +npm run lint # Run all linters (scripts, styles, markdown) |
| 29 | +npm run clean # Remove build artifacts and caches |
| 30 | +``` |
| 31 | + |
| 32 | +### Cleaning Build Issues |
| 33 | +The site uses Hugo's build cache which can occasionally cause stale content. If pages don't update or the build fails unexpectedly: |
| 34 | +```bash |
| 35 | +rm -rf public resources .hugo_build.lock |
| 36 | +npm run dev # Restart server |
| 37 | +``` |
| 38 | + |
| 39 | +## Content Organization & Conventions |
| 40 | + |
| 41 | +### Directory Structure |
| 42 | +- **`content/`** – All markdown content (main source of truth) |
| 43 | + - `blog/` – Blog posts and articles (multiple subdirectories for organization) |
| 44 | + - `docs/` – Technical documentation, guides, architecture |
| 45 | + - `events/` – Conferences and community events |
| 46 | + - `contributors/` – Community member profiles |
| 47 | + - `announcements/` – Press releases and major announcements |
| 48 | + - `about-us/` – General company/project information |
| 49 | + - `news/` – News items |
| 50 | + |
| 51 | +- **`layouts/`** – Hugo templates (mostly inherited from Doks) |
| 52 | + - `index.html` – Custom homepage (modified extensively) |
| 53 | + - `_default/`, `docs/`, `partials/`, `shortcodes/` |
| 54 | + |
| 55 | +- **`config/_default/`** – Hugo configuration |
| 56 | + - `hugo.toml` – Core Hugo settings (title, baseURL, outputs) |
| 57 | + - `params.toml` – Theme parameters and Doks customization |
| 58 | + - `languages.toml` – Multilingual config (single language currently) |
| 59 | + - `module.toml` – Asset mounting (mounts node_modules resources) |
| 60 | + - `markup.toml` – Markdown parsing settings |
| 61 | + |
| 62 | +- **`assets/`** – SCSS, JavaScript, images, SVGs (compiled and bundled) |
| 63 | + |
| 64 | +### Front Matter Conventions |
| 65 | + |
| 66 | +**Blog Posts & Documentation:** |
| 67 | +```toml |
| 68 | ++++ |
| 69 | +title = "Post Title" |
| 70 | +description = "Short summary for SEO" |
| 71 | +date = 2024-01-15T10:00:00+00:00 |
| 72 | +lastmod = 2024-01-15T10:00:00+00:00 |
| 73 | +draft = false |
| 74 | +weight = 50 # Sort order (lower = earlier) |
| 75 | +contributors = ["GitHub Username"] |
| 76 | ++++ |
| 77 | +``` |
| 78 | + |
| 79 | +**Key Fields:** |
| 80 | +- `date` – Publication date (ISO 8601 format) |
| 81 | +- `draft` – Set to `true` to hide from production (visible with `npm run dev:drafts`) |
| 82 | +- `weight` – Controls ordering in lists and navigation (not always present) |
| 83 | +- `contributors` – List of GitHub usernames |
| 84 | +- `homepage` – If `true`, featured on homepage (used sparingly) |
| 85 | + |
| 86 | +### Taxonomies |
| 87 | +- **Contributors** – Defined in `config/_default/hugo.toml` as taxonomy `contributors` |
| 88 | +- **Tags & Categories** – Auto-generated from content organization |
| 89 | + |
| 90 | +## Key Files & Patterns |
| 91 | + |
| 92 | +### Homepage Customization |
| 93 | +[layouts/index.html](layouts/index.html) – Heavily customized HTML (not inherited from Doks): |
| 94 | +- Three-column feature section (Security, Simplicity, Modularity) |
| 95 | +- Call-to-action buttons linking to `/docs/tutorial/` |
| 96 | +- Newsletter signup form (Mailerlite integration) |
| 97 | +- YouTube video embed shortcode |
| 98 | +- **Do NOT edit Doks theme files directly** – customize via parameters in `config/` |
| 99 | + |
| 100 | +### Hugo Configuration Priorities |
| 101 | +Hugo loads config in this order (most specific wins): |
| 102 | +1. `config/` (base) |
| 103 | +2. `config/_default/` (default environment) |
| 104 | +3. `config/production/` or `config/next/` (environment-specific) |
| 105 | +4. Command-line flags override everything |
| 106 | + |
| 107 | +### Theme Inheritance |
| 108 | +- **Base theme**: `@hyas/doks-core` (npm package in `node_modules/`) |
| 109 | +- **Customization points**: |
| 110 | + - Override Doks parameters in `config/_default/params.toml` |
| 111 | + - Add custom layouts/partials in `layouts/` (they shadow theme files) |
| 112 | + - Custom SCSS in `assets/scss/` (mounted to override theme CSS) |
| 113 | + - Example: `flexSearch`, `navbarSticky`, `colorMode` parameters control theme behavior |
| 114 | + |
| 115 | +## Search & Navigation Configuration |
| 116 | + |
| 117 | +The site uses **FlexSearch** for full-text search: |
| 118 | +- Index generated in JSON format (`hugo_stats.json`, `search-index.json`) |
| 119 | +- Configured in `params.toml`: `searchLimit = 99`, `indexSummary = false` |
| 120 | +- Excludes content types via `searchExclTypes` (customize as needed) |
| 121 | +- Navigation menus in `config/_default/menus/` |
| 122 | + |
| 123 | +## Deployment & Hosting |
| 124 | + |
| 125 | +**Netlify Configuration** ([netlify.toml](netlify.toml)): |
| 126 | +- Build command: `pnpm build` |
| 127 | +- Publish directory: `public/` |
| 128 | +- Environment contexts for production, deploy-preview, branch-deploy, and "next" branch |
| 129 | +- Node version: 18.16.1, NPM: 9.5.1 |
| 130 | + |
| 131 | +**Manual Deployment Workflow:** |
| 132 | +1. Merge to main branch |
| 133 | +2. Local testing required before merge (no auto-deploy on PR) |
| 134 | +3. Manual release to hosting after approval |
| 135 | +4. Deploy via `npm run deploy` (requires S3 credentials) |
| 136 | + |
| 137 | +## Licensing & REUSE Compliance |
| 138 | + |
| 139 | +This project follows the **REUSE specification** (https://reuse.software/): |
| 140 | +- Primary license: MIT (`LICENSE`, `LICENSES/MIT.txt`) |
| 141 | +- Metadata: `REUSE.toml` in repo root |
| 142 | +- All files implicitly licensed MIT by `REUSE.toml` aggregate annotation |
| 143 | +- CI check: `.github/workflows/reuse.yml` validates compliance |
| 144 | +- To verify: `reuse lint` (requires Python + REUSE tool) |
| 145 | + |
| 146 | +**No need to add license headers** to markdown files – covered by aggregate rule. |
| 147 | + |
| 148 | +## Linting & Code Quality |
| 149 | + |
| 150 | +**Lint Commands:** |
| 151 | +- `npm run lint` – Run all linters |
| 152 | +- `npm run lint:scripts` – ESLint (JavaScript in `assets/js/`) |
| 153 | +- `npm run lint:styles` – Stylelint (SCSS in `assets/scss/`) |
| 154 | +- `npm run lint:markdown` – Markdownlint (all `.md` files) |
| 155 | + |
| 156 | +**Cache Management:** Linters cache results in `.eslintcache`, `.stylelintcache`. Use `npm run clean:lint` to reset. |
| 157 | + |
| 158 | +## Branch & Contribution Workflow |
| 159 | + |
| 160 | +- **Branch naming**: `<github-username>/<kebab-case-description>` (enforced by convention) |
| 161 | +- **Merge strategy**: Branches deleted after merge; no automatic deploy |
| 162 | +- **Testing**: Build locally (`npm run build`) and preview before PR |
| 163 | +- **PR validation**: `.github/workflows/validate_pr.yml` runs build check on every PR |
| 164 | + |
| 165 | +## Common Tasks & Patterns |
| 166 | + |
| 167 | +### Adding a Blog Post |
| 168 | +1. Create directory: `content/blog/<slug>/` |
| 169 | +2. Create `_index.md` with front matter (use archetype: `npm run create blog/<slug>`) |
| 170 | +3. Add additional pages as needed (e.g., `introduction.md` for sub-sections) |
| 171 | +4. Reference images relative to the directory |
| 172 | + |
| 173 | +### Adding Documentation |
| 174 | +- Place in `content/docs/<section>/` |
| 175 | +- Use weight to control order |
| 176 | +- Link to other docs with relative paths (Hugo rewrites them) |
| 177 | +- Include in navigation via `config/_default/menus/` |
| 178 | + |
| 179 | +### Adding Events |
| 180 | +- Create in `content/events/<type>/<year>/` |
| 181 | +- Example: `content/events/Conferences/2026/HPSFCon26.md` |
| 182 | +- Can use `layout = "cards"` for special card-based display |
| 183 | + |
| 184 | +### Custom Shortcodes |
| 185 | +Available Doks shortcodes: |
| 186 | +- `{{< youtube VIDEO_ID >}}` – Embed YouTube videos |
| 187 | +- Check `layouts/shortcodes/` for others |
| 188 | + |
| 189 | +## GitHub Actions Workflows |
| 190 | + |
| 191 | +- **`validate_pr.yml`** – Runs `npm install` + `npm run build` on PRs (blocks merge if build fails) |
| 192 | +- **`reuse.yml`** – Validates REUSE compliance |
| 193 | +- **`S3_Deploy_Hugo.yml`** – Handles production S3 deployment |
| 194 | + |
| 195 | +## Debugging Tips |
| 196 | + |
| 197 | +**Hugo not found?** Clear install cache: |
| 198 | +```bash |
| 199 | +npm run clean:install && npm install |
| 200 | +``` |
| 201 | + |
| 202 | +**Stale content in dev server?** |
| 203 | +```bash |
| 204 | +rm -rf public resources .hugo_build.lock && npm run dev |
| 205 | +``` |
| 206 | + |
| 207 | +**Build passes locally but fails in CI?** Check: |
| 208 | +- Node version (18.16.1 on Netlify, verify locally) |
| 209 | +- pnpm version (>= 8.10.0) |
| 210 | +- Hugo version in `package.json` → `otherDependencies.hugo` |
| 211 | +- All dependencies installed: `npm install` |
| 212 | + |
| 213 | +**CSS/JS not updating?** Clear asset cache: |
| 214 | +```bash |
| 215 | +npm run clean && npm install && npm run dev |
| 216 | +``` |
0 commit comments