Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
493f765
Initial plan
Copilot Jan 6, 2026
c2a2e1f
Add MCP configuration, dev environment, and enhance Copilot instructions
Copilot Jan 6, 2026
ed3b35f
Add DEVELOPMENT.md guide and MCP verification script
Copilot Jan 6, 2026
2d5dde2
Add comprehensive MCP and dev environment documentation
Copilot Jan 6, 2026
23438e1
Fix code review issues: correct URLs, improve error handling, update …
Copilot Jan 6, 2026
551a550
Merge branch 'main' into copilot/configure-model-context-protocol-ser…
d-morrison Jan 7, 2026
71e2e67
Merge remote-tracking branch 'origin/copilot/configure-model-context-…
d-morrison Jan 7, 2026
c46866f
Initial plan
Copilot Jan 7, 2026
e1d7822
Initial plan
Copilot Jan 7, 2026
8c4bec5
Fix pkgdown workflow: correct file paths and update deprecated actions
Copilot Jan 7, 2026
6ff113f
Optimize JAGS dependencies: remove unused platform steps from test-co…
Copilot Jan 7, 2026
d62b98d
Update pkgdown.yaml
d-morrison Jan 7, 2026
7d022a1
ignore pdfs
d-morrison Jan 7, 2026
969b20a
Fix getting-started.qmd: correct data variable references and remove …
Copilot Jan 8, 2026
e79c669
Remove Rplots.pdf and add to .gitignore
Copilot Jan 8, 2026
a6c08a0
Update pkgdown.yaml
d-morrison Jan 8, 2026
e485f0c
Merge branch 'test-mcp' into copilot/sub-pr-163-again
d-morrison Jan 8, 2026
ddfc3d4
Merge pull request #164 from UCD-SERG/copilot/sub-pr-163
d-morrison Jan 8, 2026
432dbac
Merge pull request #165 from UCD-SERG/copilot/sub-pr-163-again
d-morrison Jan 8, 2026
ffd2370
Merge branch 'main' into test-mcp
d-morrison Jan 8, 2026
0914ed2
Merge branch 'main' into test-mcp
d-morrison Jan 8, 2026
fe57e7d
Initial plan
Copilot Jan 8, 2026
0b13d9f
Address PR review comments: fix indentation, update paths, use offici…
Copilot Jan 8, 2026
3c7d7a0
Merge pull request #169 from UCD-SERG/copilot/sub-pr-163-again
d-morrison Jan 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@

^_quarto\.yml$
^\.quarto$
^\.vscode$
^\.devcontainer$
^DEVELOPMENT\.md$
155 changes: 155 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# Development Container Configuration

This directory contains the configuration for a containerized development environment for the serodynamics R package.

## What is a Dev Container?

Dev Containers allow you to use a Docker container as a full-featured development environment. This ensures that all developers work in a consistent environment with the same dependencies, tools, and configurations.

## Features

The serodynamics dev container includes:

- **R Environment**: Based on `rocker/tidyverse:latest` with R and tidyverse packages
- **JAGS**: Pre-installed JAGS 4.3.1 for Bayesian MCMC modeling
- **System Dependencies**: All required system libraries for R package development
- **R Development Tools**: devtools, roxygen2, testthat, lintr, spelling, covr
- **Quarto**: For rendering vignettes and documentation
- **VS Code Extensions**: R debugger, language support, GitHub Copilot, and more
- **Git & GitHub CLI**: For version control and GitHub integration
- **Node.js**: For MCP server support

## Quick Start

### Prerequisites

1. **Docker Desktop**: Install from https://www.docker.com/products/docker-desktop
2. **VS Code**: Install from https://code.visualstudio.com/
3. **Dev Containers Extension**: Install from VS Code marketplace

### Opening the Dev Container

1. Open the serodynamics repository in VS Code
2. Press `F1` or `Ctrl+Shift+P` (Cmd+Shift+P on macOS)
3. Select "Dev Containers: Reopen in Container"
4. Wait for the container to build (first time may take 5-10 minutes)
5. Once ready, you'll have a fully configured development environment

### Using the Dev Container

After opening in the container:

```r
# Load the package in development mode
devtools::load_all()

# Run tests
devtools::test()

# Check the package
devtools::check()

# Generate documentation
devtools::document()

# Lint the code
lintr::lint_package()
```

You can also use VS Code tasks (Ctrl+Shift+P -> "Tasks: Run Task") to run common operations.

## Container Configuration

### devcontainer.json

The main configuration file that defines:
- Base Docker image
- VS Code extensions to install
- VS Code settings
- Port forwarding (8787 for RStudio Server)
- Environment variables
- Post-create commands

### setup.sh

Runs after the container is created to:
- Install JAGS
- Install system dependencies
- Install Quarto
- Install R development packages
- Install package dependencies
- Verify JAGS installation

## RStudio Server Access

The container includes RStudio Server running on port 8787. To access it:

1. After the container starts, open http://localhost:8787 in your browser
2. Login with:
- Username: `rstudio`
- Password: `rstudio` (default)

## Customization

### Adding R Packages

Edit `setup.sh` to add more R packages to the base installation.

### Adding VS Code Extensions

Edit the `extensions` array in `devcontainer.json`.

### Adding System Dependencies

Edit the `apt-get install` command in `setup.sh`.

## Troubleshooting

### Container fails to build

1. Ensure Docker Desktop is running
2. Check that you have sufficient disk space (container is ~2-3 GB)
3. Try rebuilding: "Dev Containers: Rebuild Container"

### JAGS not found

The setup script should install JAGS automatically. If it fails:

1. Rebuild the container
2. Check the setup.sh logs for errors
3. Manually install JAGS in the container terminal

### R packages not installing

1. Check internet connection
2. Try installing manually: `Rscript -e "devtools::install_dev_deps()"`
3. Check for system dependency errors in the logs

### Performance issues

1. Allocate more resources to Docker Desktop (Settings -> Resources)
2. Close other containers and applications
3. Use a local R installation for better performance on simple tasks

## Benefits of Using Dev Containers

1. **Consistency**: Everyone works in the same environment
2. **Isolation**: Development environment is separate from your system
3. **Reproducibility**: Easy to share and recreate the environment
4. **Onboarding**: New contributors can start immediately
5. **Clean System**: No need to install R, JAGS, or dependencies on your system

## Alternative: Codespaces

This dev container configuration also works with GitHub Codespaces:

1. Navigate to the repository on GitHub
2. Click "Code" -> "Codespaces" -> "Create codespace on main"
3. Wait for the environment to set up
4. Start coding in your browser or connect from VS Code

## References

- [Dev Containers Documentation](https://code.visualstudio.com/docs/devcontainers/containers)
- [Rocker Project](https://rocker-project.org/)
- [GitHub Codespaces](https://github.com/features/codespaces)
55 changes: 55 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "serodynamics R Package Development",
"image": "rocker/tidyverse:latest",

"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/node:1": {
"version": "lts"
}
},

"customizations": {
"vscode": {
"settings": {
"r.rterm.linux": "/usr/local/bin/R",
"r.rpath.linux": "/usr/local/bin/R",
"terminal.integrated.defaultProfile.linux": "bash"
},
"extensions": [
"rdebugger.r-debugger",
"reditorsupport.r",
"github.copilot",
"github.copilot-chat",
"quarto.quarto",
"redhat.vscode-yaml",
"yzhang.markdown-all-in-one",
"streetsidesoftware.code-spell-checker",
"eamodio.gitlens"
]
}
},

"postCreateCommand": "bash .devcontainer/setup.sh",

"remoteUser": "rstudio",

"forwardPorts": [8787],

"portsAttributes": {
"8787": {
"label": "RStudio Server",
"onAutoForward": "notify"
}
},

"mounts": [
"source=${localWorkspaceFolder}/.Rprofile,target=/home/rstudio/.Rprofile,type=bind,consistency=cached"
],

"containerEnv": {
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}",
"TZ": "UTC"
}
}
63 changes: 63 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
set -e

echo "Setting up serodynamics development environment..."

# Update package list
echo "Updating package list..."
apt-get update

# Install JAGS (required for serodynamics)
echo "Installing JAGS..."
apt-get install -y jags

# Install system dependencies for R packages
echo "Installing system dependencies..."
apt-get install -y \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libfontconfig1-dev \
libharfbuzz-dev \
libfribidi-dev \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev \
libgit2-dev

# Install Quarto
echo "Installing Quarto..."
QUARTO_VERSION="1.6.40" # Updated to latest stable version (January 2026)
wget -q https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.deb
dpkg -i quarto-${QUARTO_VERSION}-linux-amd64.deb
rm quarto-${QUARTO_VERSION}-linux-amd64.deb

# Install R packages needed for development
echo "Installing R development packages..."
Rscript -e "install.packages(c('devtools', 'roxygen2', 'testthat', 'lintr', 'spelling', 'covr', 'rcmdcheck', 'pak'), repos = 'https://cloud.r-project.org')"

# Install rjags from source (required for JAGS interface)
echo "Installing rjags..."
Rscript -e "install.packages('rjags', repos = 'https://cloud.r-project.org', type = 'source')"

# Install package dependencies
echo "Installing package dependencies..."
Rscript -e "if (!requireNamespace('pak', quietly = TRUE)) install.packages('pak', repos = 'https://cloud.r-project.org'); pak::local_install_dev_deps(dependencies = TRUE)"

Copilot AI Jan 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pak package is installed twice: first in line 38 as part of the development packages array, and then checked again in line 46 with a conditional install. This is redundant. Since pak is already installed in line 38, the conditional check in line 46 is unnecessary and can be simplified to just "pak::local_install_dev_deps(dependencies = TRUE)".

Suggested change
Rscript -e "if (!requireNamespace('pak', quietly = TRUE)) install.packages('pak', repos = 'https://cloud.r-project.org'); pak::local_install_dev_deps(dependencies = TRUE)"
Rscript -e "pak::local_install_dev_deps(dependencies = TRUE)"

Copilot uses AI. Check for mistakes.

# Verify JAGS installation
echo "Verifying JAGS installation..."
Rscript -e "library(rjags); library(runjags); runjags::testjags()"

# Clean up
echo "Cleaning up..."
apt-get clean
rm -rf /var/lib/apt/lists/*

echo "Development environment setup complete!"
echo ""
echo "You can now:"
echo " - Run 'devtools::load_all()' to load the package"
echo " - Run 'devtools::test()' to run tests"
echo " - Run 'devtools::check()' to check the package"
echo " - Use VS Code tasks (Ctrl+Shift+P -> Tasks: Run Task)"
64 changes: 63 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,53 @@
- **Key Dependencies**: runjags, rjags, JAGS 4.3.1, serocalculator, ggmcmc, dplyr, ggplot2
- **Lifecycle**: Experimental (under active development)

## Development Environment Options

The repository provides multiple ways to set up your development environment:

### Option 1: Dev Container (Recommended for consistency)

Use the preconfigured development container for a fully automated setup:

1. Install Docker Desktop and VS Code with Dev Containers extension
2. Open the repository in VS Code
3. Click "Reopen in Container" when prompted
4. All dependencies (R, JAGS, system libraries) are installed automatically

See `.devcontainer/README.md` for details.

### Option 2: Local Installation (Traditional)

Install R, JAGS, and dependencies directly on your system (see Critical Setup Requirements below).

### Option 3: GitHub Codespaces

Use the dev container configuration in a cloud environment:
1. Go to the repository on GitHub
2. Click "Code" → "Codespaces" → "Create codespace"
3. Development environment is ready in your browser

## Model Context Protocol (MCP) Integration

The repository includes MCP server configurations in `.github/mcp/mcp-config.json` for enhanced AI-assisted development:

- **Filesystem Server**: Navigate and edit repository files
- **GitHub Server**: Check CI/CD status, review PRs, manage issues
- **Git Server**: Version control operations (status, diff, commit, branch)
- **Brave Search Server**: Look up R documentation and CRAN resources

These servers enhance GitHub Copilot and other AI assistants with context-aware capabilities. See `.github/mcp/README.md` for setup instructions.

## VS Code Configuration

The `.vscode/` directory contains optimized settings for R package development:

- **settings.json**: R-specific editor settings, file associations, and Copilot configuration
- **extensions.json**: Recommended VS Code extensions for R development
- **tasks.json**: Quick tasks for common operations (document, test, check, lint)

Use tasks via `Ctrl+Shift+P` → "Tasks: Run Task" or the Command Palette.

## Critical Setup Requirements

### Quick Start with Docker (RECOMMENDED)
Expand Down Expand Up @@ -58,7 +105,7 @@ The package requires R version 4.1.0 or higher. Install R for your platform:
# Add CRAN repository for latest R version
sudo apt-get update
sudo apt-get install -y software-properties-common dirmngr
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/maruti.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
sudo apt-get update
sudo apt-get install -y r-base r-base-dev
Expand Down Expand Up @@ -339,6 +386,21 @@ Team members can trigger actions by commenting on PRs:
- **pkgdown/**: pkgdown website configuration
- `_pkgdown.yml`: Site structure, reference organization

- **.github/**: GitHub configuration and workflows
- `.github/workflows/`: CI/CD workflow definitions
- `.github/mcp/`: Model Context Protocol server configurations
- `.github/copilot-instructions.md`: Custom instructions for GitHub Copilot

- **.vscode/**: VS Code workspace configuration
- `settings.json`: Editor settings for R development
- `extensions.json`: Recommended VS Code extensions
- `tasks.json`: Quick tasks for common R package operations

- **.devcontainer/**: Development container configuration
- `devcontainer.json`: Container specification and VS Code integration
- `setup.sh`: Automated environment setup script
- `README.md`: Dev container usage documentation

### Configuration Files

- **DESCRIPTION**: Package metadata, dependencies, version (0.0.0.9044)
Expand Down
Loading
Loading