pages/.github/copilot-instructions.md
George 25b758805c
Added copilot instructions, AGENTS.md, improved README files (#3486)
This pull request introduces several documentation improvements and adds
comprehensive Copilot and agent instruction files to the al-folio
repository. The most significant changes are the addition of
repository-wide and path-specific Copilot instructions, updates to agent
documentation to reference these instructions, and improvements to the
documentation structure and clarity regarding file purposes and
workflows.

**Copilot and Agent Instruction Enhancements:**

- Added a new `.github/copilot-instructions.md` file providing detailed,
repository-wide setup, build, CI/CD, troubleshooting, and file format
guidance for Copilot coding agents.
- Introduced `.github/instructions/bibtex-bibliography.instructions.md`
with specific instructions for editing and validating BibTeX files,
including custom keywords, formatting rules, and integration with
Jekyll-Scholar.
- Updated agent documentation files (`customize.agent.md`,
`docs.agent.md`) to reference the new Copilot instruction files and
explain their purpose and usage for both repository-wide and
path-specific scenarios.
[[1]](diffhunk://#diff-15864f2655921f50a97689076e3b8feba0da320463750845be6a76eb2e30bfe4L57-R65)
[[2]](diffhunk://#diff-15864f2655921f50a97689076e3b8feba0da320463750845be6a76eb2e30bfe4L107-R122)
[[3]](diffhunk://#diff-961a46180ce568ce43c20bf7129dc5e4926a9aa4e0d7bc19926ca5ee3ff95cd0L49-R51)
[[4]](diffhunk://#diff-961a46180ce568ce43c20bf7129dc5e4926a9aa4e0d7bc19926ca5ee3ff95cd0L106-R137)

**Documentation Structure and Clarity Improvements:**

- Clarified and reorganized the documentation file list in agent files,
removing references to deprecated or merged files (e.g.,
`MAINTENANCE.md`, `ACCESSIBILITY.md`) and updating descriptions to
reflect current usage.
[[1]](diffhunk://#diff-15864f2655921f50a97689076e3b8feba0da320463750845be6a76eb2e30bfe4L57-R65)
[[2]](diffhunk://#diff-961a46180ce568ce43c20bf7129dc5e4926a9aa4e0d7bc19926ca5ee3ff95cd0L21-R21)
[[3]](diffhunk://#diff-961a46180ce568ce43c20bf7129dc5e4926a9aa4e0d7bc19926ca5ee3ff95cd0L106-R137)
- Enhanced documentation on the purpose and application of each
documentation file, and added detailed explanations of Copilot
instruction files and their role in project development.

**Workflow and Validation Updates:**

- Updated references and descriptions for GitHub Actions workflows in
agent documentation to include the Copilot environment setup and clarify
pre-commit and CI/CD requirements.
[[1]](diffhunk://#diff-15864f2655921f50a97689076e3b8feba0da320463750845be6a76eb2e30bfe4L57-R65)
[[2]](diffhunk://#diff-961a46180ce568ce43c20bf7129dc5e4926a9aa4e0d7bc19926ca5ee3ff95cd0L49-R51)
- Corrected references for accessibility guidance, now directing users
to `TROUBLESHOOTING.md` instead of the removed `ACCESSIBILITY.md`.

These changes collectively improve the onboarding experience for both
human contributors and AI agents, ensuring consistent adherence to
project conventions and reducing errors.

**References:**  

[[1]](diffhunk://#diff-227c2c26cb2ee0ce0f46a320fc48fbcbdf21801a57f59161b1d0861e8aad55f5R1-R253)
[[2]](diffhunk://#diff-6fd2827fb8d9c2dd6dc973572201853487ecbbd1120b00425d4f1c21dfdcf35fR1-R174)
[[3]](diffhunk://#diff-15864f2655921f50a97689076e3b8feba0da320463750845be6a76eb2e30bfe4L57-R65)
[[4]](diffhunk://#diff-15864f2655921f50a97689076e3b8feba0da320463750845be6a76eb2e30bfe4L107-R122)
[[5]](diffhunk://#diff-15864f2655921f50a97689076e3b8feba0da320463750845be6a76eb2e30bfe4L550-R562)
[[6]](diffhunk://#diff-961a46180ce568ce43c20bf7129dc5e4926a9aa4e0d7bc19926ca5ee3ff95cd0L21-R21)
[[7]](diffhunk://#diff-961a46180ce568ce43c20bf7129dc5e4926a9aa4e0d7bc19926ca5ee3ff95cd0L49-R51)
[[8]](diffhunk://#diff-961a46180ce568ce43c20bf7129dc5e4926a9aa4e0d7bc19926ca5ee3ff95cd0L106-R137)

---------

Signed-off-by: George Araújo <george.gcac@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-28 22:55:05 -03:00

254 lines
8.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Copilot Coding Agent Instructions
## Repository Overview
**al-folio** is a simple, clean, and responsive [Jekyll](https://jekyllrb.com/) theme for academics and researchers. It enables users to create professional portfolio and blog websites with minimal configuration. The repository serves both as a template and as a reference implementation.
- **Type:** Jekyll static site generator template
- **Target Users:** Academics, researchers, and professionals
- **Key Features:** CV display, publication bibliography, blog posts, projects, news/announcements, course listings
## Tech Stack & Versions
**Core Technologies:**
- **Jekyll:** v4.x (Ruby static site generator)
- **Ruby:** 3.3.5 (primary CI/CD version), 3.2.2 (some workflows)
- **Python:** 3.13 (for nbconvert, jupyter notebook support)
- **Node.js:** Latest (for purgecss and prettier)
- **Docker:** Uses prebuilt image `amirpourmand/al-folio:v0.16.3` (Ruby slim-based)
**Build Dependencies (from Gemfile):**
- `classifier-reborn` Related posts calculation
- `jekyll-archives-v2` Archive page generation
- `jekyll-jupyter-notebook` Jupyter notebook embedding
- `jekyll-minifier` CSS/JS minification
- `jekyll-paginate-v2` Pagination
- `jekyll-scholar` Bibliography management
- `jekyll-tabs` Tab UI components
- `jekyll-toc` Table of contents generation
- `jemoji` Emoji support
- Multiple other specialized jekyll plugins
**Code Quality Tools:**
- **Prettier:** v3.8.0+ with `@shopify/prettier-plugin-liquid` Code formatter (mandatory for PRs)
- **Purgecss:** CSS purification for production builds
## Building & Local Development
### Docker (Recommended Approach)
**Always use Docker for local development.** This ensures consistency with CI/CD and avoids Ruby/Python environment issues.
**Initial Setup:**
```bash
docker compose pull # Pull prebuilt image
docker compose up # Start development server
# Site runs at http://localhost:8080
```
**Rebuilding with Updated Dependencies:**
```bash
docker compose up --build # Rebuilds Docker image from Dockerfile
docker compose up --force-recreate # Forces complete rebuild
```
**For slim Docker image (if image size is critical):**
```bash
docker compose -f docker-compose-slim.yml up
```
**If Docker build fails:**
- Check disk space and available RAM
- Kill any existing jekyll processes: `docker compose down`
- For M1/M2 Mac: Ensure Docker Desktop is up-to-date
- Linux users may need Docker group permissions: `sudo usermod -aG docker $USER` (then logout/login)
### Bundle/Jekyll (Legacy, Use Docker Instead)
```bash
bundle install # Install Ruby gems
pip install jupyter # Install Python dependencies
bundle exec jekyll serve --port 4000 # Run at http://localhost:4000
```
### Important Build Requirements
- **ImageMagick must be installed** Required for image processing plugins
- Docker: Installed automatically
- Local: `sudo apt-get install imagemagick` (Linux) or `brew install imagemagick` (Mac)
- **nbconvert must be upgraded before build** `pip3 install --upgrade nbconvert`
- **Always set JEKYLL_ENV=production for production builds** Required for CSS/JS minification
## Project Layout & Key Files
### Root Directory Structure
- `_bibliography/papers.bib` BibTeX bibliography for publications
- `_config.yml` **Primary configuration file** (title, author, URLs, baseurl, feature flags)
- `_data/` YAML data files (socials.yml, coauthors.yml, cv.yml, citations.yml, venues.yml, repositories.yml)
- `_includes/` Reusable Liquid template components
- `_layouts/` Page layout templates (about.liquid, post.liquid, bib.liquid, distill.liquid, cv.liquid, etc.)
- `_news/` News/announcement entries
- `_pages/` Static pages (about.md, cv.md, publications.md, projects.md, teaching.md, etc.)
- `_posts/` Blog posts (format: YYYY-MM-DD-title.md)
- `_projects/` Project showcase entries
- `_sass/` SCSS stylesheets
- `_scripts/` JavaScript files for functionality
- `_teachings/` Course and teaching entries
- `assets/img/` Images, profile pictures
- `docker-compose.yml` Docker compose configuration
- `Dockerfile` Docker image definition
- `Gemfile` & `Gemfile.lock` Ruby dependency specifications
- `package.json` Node.js dependencies (prettier only)
- `purgecss.config.js` PurgeCSS configuration for production CSS optimization
### Configuration Priority
When making changes:
1. **Always start with `_config.yml`** for site-wide settings
2. **Feature flags are in `_config.yml`** Look for `enabled: true/false` options
3. **Social media links:** `_data/socials.yml`
4. **Content data:** Respective `_data/*.yml` files
5. **Styling:** `_sass/` directory (uses SCSS)
## CI/CD Pipeline & Validation
### GitHub Workflows (in `.github/workflows/`)
- **deploy.yml** Main deployment workflow (runs on push/PR to main/master)
- Sets up Ruby 3.3.5, Python 3.13
- Installs imagemagick, nbconvert
- Runs `bundle exec jekyll build` with JEKYLL_ENV=production
- Runs purgecss for CSS optimization
- Commits built site to gh-pages branch
- **Triggers on:** Changes to site files, assets, config (NOT documentation files alone)
- **prettier.yml** Code formatting validation (mandatory)
- Runs prettier on all files
- **Fails PRs if code is not properly formatted**
- Generates HTML diff artifact on failure
- Must install prettier locally to avoid failures: `npm install prettier @shopify/prettier-plugin-liquid`
- **broken-links.yml, broken-links-site.yml** Link validation
- **axe.yml** Accessibility testing
- **codeql.yml** Security scanning
- **update-citations.yml** Automatic citation updates
- **render-cv.yml** CV rendering from RenderCV format
### Pre-commit Requirements
**You must run these locally before pushing:**
1. **Prettier formatting (mandatory):**
```bash
npm install --save-dev prettier @shopify/prettier-plugin-liquid
npx prettier . --write
```
2. **Local build test with Jekyll:**
```bash
docker compose pull && docker compose up
# Let it build (wait 30-60 seconds)
# Visit http://localhost:8080 and verify site renders correctly
# Exit with Ctrl+C
```
3. **Or run full build simulation:**
```bash
docker compose up --build
bundle exec jekyll build
# Check for errors in output
```
## Common Pitfalls & Workarounds
### YAML Syntax Errors in \_config.yml
- **Problem:** Special characters (`:`, `&`, `#`) in values cause parse errors
- **Solution:** Quote string values: `title: "My: Cool Site"`
- **Debug:** Run locally to see detailed error: `bundle exec jekyll build`
### "Unknown tag 'toc'" Error on Deployment
- **Problem:** Deploy succeeds locally but fails on GitHub Actions
- **Cause:** Jekyll plugins don't load properly
- **Solution:** Verify gh-pages branch is set as deployment source in Settings → Pages
### CSS/JS Not Loading After Deploy
- **Problem:** Site loads but has no styling
- **Cause:** Incorrect `url` and `baseurl` in `_config.yml`
- **Fix:**
- Personal site: `url: https://username.github.io`, `baseurl:` (empty)
- Project site: `url: https://username.github.io`, `baseurl: /repo-name/`
- Clear browser cache (Ctrl+Shift+Del or private browsing)
### Prettier Formatting Failures
- **Problem:** PR fails prettier check after local builds passed
- **Solution:** Run prettier before committing:
```bash
npx prettier . --write
git add . && git commit -m "Format code with prettier"
```
### Port 8080 or 4000 Already in Use
- **Docker:** `docker compose down` then `docker compose up`
- **Ruby:** Kill process: `lsof -i :4000 | grep LISTEN | awk '{print $2}' | xargs kill`
### Related Posts Errors ("Zero vectors cannot be normalized")
- **Cause:** Empty blog posts or posts with only stop words confuse classifier-reborn
- **Solution:** Add meaningful content to posts, or set `related_posts: false` in post frontmatter
## File Format Specifications
### Blog Post Frontmatter (\_posts/)
```yaml
---
layout: post
title: Post Title
date: YYYY-MM-DD
categories: category-name
---
```
### Project Frontmatter (\_projects/)
```yaml
---
layout: page
title: Project Name
description: Short description
img: /assets/img/project-image.jpg
importance: 1
---
```
### BibTeX Format (papers.bib)
- Standard BibTeX format
- al-folio supports custom keywords: `pdf`, `code`, `preview`, `doi`, etc.
- Check CUSTOMIZE.md for custom bibtex keyword documentation
## Trust These Instructions
This guidance documents the tested, working build process and project structure. **Trust these instructions and only perform additional searches if:**
1. Specific information contradicts what you observe in the codebase
2. You need implementation details beyond what's documented
3. Error messages reference features or files not mentioned here
The instructions are designed to reduce unnecessary exploration and allow you to focus on code changes.