Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
221 changes: 221 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
# Agent Guidelines for The Combine

This document provides guidelines for AI coding agents working on The Combine codebase. Following these guidelines ensures consistency, quality, and compatibility with the project's development workflow.

## Table of Contents

1. [Commit Messages](#commit-messages)
2. [Code Style](#code-style)
3. [Formatting](#formatting)
4. [Dependency Management](#dependency-management)
5. [Backend Controllers](#backend-controllers)
6. [Localization](#localization)

---

## Commit Messages

All commit messages must satisfy the defaults of [gitlint](https://jorisroovers.com/gitlint/).

**Key requirements:**
- Minimum title length: 4 characters (as configured in `.gitlint`)
- Follow conventional commit message format
- Keep the title concise and descriptive
- Add detailed explanations in the commit body when necessary

**Example:**
```
Add user authentication endpoint

Implements JWT-based authentication for user login.
Includes validation and error handling.
```
Comment on lines +27 to +32
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add language identifier to code fence.

The commit message example should specify a language identifier for proper syntax highlighting.

Proposed fix
-```
+```text
 Add user authentication endpoint
 
 Implements JWT-based authentication for user login.
 Includes validation and error handling.
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

27-27: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
In `@AGENTS.md` around lines 27 - 32, Update the commit message example code fence
so it includes a language identifier (e.g., change the opening ``` to ```text)
around the block starting "Add user authentication endpoint" to enable proper
syntax highlighting; edit the fenced block in AGENTS.md where the commit example
is shown so the fence marker includes the language token.


---

## Code Style

Follow the project's established style guides:

### TypeScript/JavaScript
- Refer to [`docs/style_guide/ts_style_guide.md`](docs/style_guide/ts_style_guide.md) for comprehensive TypeScript and JavaScript conventions
- Key points include:
- Use `camelCase` for variables and functions
- Use `PascalCase` for components, classes, and interfaces
- Prefer `const` over `let`, avoid `var`
- Use semicolons
- Use single quotes for strings
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Incorrect quote style guidance.

This line states "Use single quotes for strings," but the TypeScript style guide at line 343 specifies: "Prefer double quotes ("your text") to single quotes ('your text')."

Proposed fix
-  - Use single quotes for strings
+  - Use double quotes for strings
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Use single quotes for strings
- Use double quotes for strings
🤖 Prompt for AI Agents
In `@AGENTS.md` at line 47, Update the guidance text in AGENTS.md that currently
reads "Use single quotes for strings" to match the TypeScript style guide by
changing it to recommend double quotes (e.g., "Prefer double quotes (\"your
text\") to single quotes (\'your text\')"). Locate the exact string "Use single
quotes for strings" in AGENTS.md and replace it with the corrected guidance so
the document is consistent with the style rule referenced at line 343 of the
TypeScript guide.

Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The TypeScript/JavaScript key points should include alphabetizing React component props, as this was specifically mentioned in the issue requirements and has been added to the style guide. Consider adding "- Alphabetize component props in interfaces and JSX" to this list for completeness.

Suggested change
- Use single quotes for strings
- Use single quotes for strings
- Alphabetize component props in interfaces and JSX

Copilot uses AI. Check for mistakes.

### C#
- Refer to [`docs/style_guide/c_sharp_style_guide.md`](docs/style_guide/c_sharp_style_guide.md) for C# conventions
- Key points include:
- Follow Microsoft C# Coding Guidelines with project-specific exceptions
- Use type inference (`var`) wherever possible
- Add braces to one-line `if` statements
- Prefer `Range` for simple loop iteration

---

## Formatting

### Backend Changes

**After any backend changes**, run the backend formatter:

```bash
npm run fmt-backend
```

This command runs `dotnet format` on both the main Backend project and Backend.Tests.

**To check formatting without making changes:**

```bash
npm run fmt-backend-check
```

### Frontend Changes

**After any frontend changes**, run the frontend formatter:

```bash
npm run fmt-frontend
```

This command runs Prettier on all TypeScript, JavaScript, JSON, Markdown, and YAML files in the frontend directories (`.github`, `.vscode`, `deploy`, `docs`, `maintenance`, `public`, `scripts`, `src`).

**To check formatting without making changes:**

```bash
npm run fmt-frontend-check
```

---

## Dependency Management

### Backend Dependencies

**After any backend dependency changes**, generate an updated license report:

```bash
npm run license-report-backend
```

This command:
1. Runs `nuget-license` to analyze all backend dependencies (including transitive dependencies)
2. Outputs the results to `docs/user_guide/assets/licenses/backend_licenses.json`
3. Runs a post-processing script to create formatted license documentation

### Frontend Dependencies

**After any frontend dependency changes**, generate an updated license report:

```bash
npm run license-report-frontend
```

This command:
1. Runs `license-checker-rseidelsohn` to analyze all frontend dependencies
2. Outputs the results to `docs/user_guide/assets/licenses/frontend_licenses.txt`

---

## Backend Controllers

**When there are changes in `Backend/Controllers/`**, you must regenerate the OpenAPI specification.

### Prerequisites

1. Set up a Python virtual environment per the README instructions (see the "Python" section under "Getting Started with Development"):

```bash
# Create virtual environment (if not already created)
python3 -m venv venv

# Activate the virtual environment
# On Windows:
venv\Scripts\activate
# On Linux/macOS:
source venv/bin/activate

# Install required packages
python -m pip -q install pip==24.2 pip-tools==7.5.1
python -m piptools sync -q dev-requirements.txt
```

2. Start the backend server:

```bash
npm run backend
```

### Generate OpenAPI Specification

With the backend running and the virtual environment activated:

```bash
python ./scripts/generate_openapi.py
```

This script:
- Connects to the running backend
- Extracts the OpenAPI specification
- Generates TypeScript client bindings for the frontend
- Updates the API documentation

**Important:** Do not manually edit the generated OpenAPI files. Always regenerate them using this script.

---

## Localization

### Translation Files

**Do not translate any strings** added to `public/locales/en/translation.json`.

**Rationale:**
- Localization is handled externally through [Crowdin](https://crowdin.com/project/the-combine)
- Professional translators manage translations for all supported languages
- Manual translations in the codebase will be overwritten during the next Crowdin sync

**What to do:**
1. Add new English strings to `public/locales/en/translation.json`
2. Use appropriate translation keys in your code
3. Leave translation to other languages for the Crowdin platform

**Example:**

```json
{
"myNewFeature": {
"title": "My New Feature",
"description": "This is a description of my new feature."
}
}
```

```tsx
// In your React component
import { useTranslation } from "react-i18next";

function MyComponent() {
const { t } = useTranslation();
return <h1>{t("myNewFeature.title")}</h1>;
}
```

---

## Summary Checklist

Before finalizing your changes, ensure you have:

- [ ] Written commit messages that satisfy gitlint requirements
- [ ] Followed the appropriate style guide (TypeScript or C#)
- [ ] Run `npm run fmt-backend` after backend changes
- [ ] Run `npm run fmt-frontend` after frontend changes
- [ ] Run `npm run license-report-backend` after backend dependency changes
- [ ] Run `npm run license-report-frontend` after frontend dependency changes
- [ ] Regenerated OpenAPI specification after `Backend/Controllers/` changes
- [ ] Added only English strings to translation files (no manual translations)
34 changes: 34 additions & 0 deletions docs/style_guide/ts_style_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Key Sections:
- [Specificity preferred](#specificity-preferred)
- [`KeyboardEvent`s](#keyboardevents)
- [Components](#components)
- [Component Props](#component-props)
- [Function return type](#function-return-type)
- [Hooks](#hooks)

Expand Down Expand Up @@ -500,6 +501,39 @@ class Component extends React.Component<ComponentProps, ComponentState> {
}
```

### Component Props

- Alphabetize React component props for consistency and readability.

**Good**

```tsx
interface MyComponentProps {
className?: string;
id: string;
onClick: () => void;
title: string;
}
```

**Bad**

```tsx
interface MyComponentProps {
title: string;
id: string;
onClick: () => void;
className?: string;
}
```

> Reason: Consistent ordering makes props easier to find and reduces merge conflicts.

This convention applies to:
- Interface/type definitions for component props
- Prop destructuring in function parameters
- Props passed to components in JSX

## Function return type

- Specify the return type of a named function, whether declared as a `function` or `const`.
Expand Down