# Contributing to Agent Orchestrator

## Dual-Repository Model

This project uses a dual-repo structure:

| Repository | License | Purpose |
|------------|---------|---------|
| `DexterFromLab/agent-orchestrator` | MIT | Community edition (open source) |
| `agents-orchestrator/agents-orchestrator` | MIT + Commercial | Commercial edition (this repo) |

Community contributions target the community repo. Commercial development happens
exclusively in this repo. The two share a common `main` branch that is synced
periodically.

## Community Contributions

All community contributions go to **DexterFromLab/agent-orchestrator**. Do not open
PRs against this repo for community features.

### Contributor License Agreement (CLA)

Every community contributor must sign the CLA before their first PR is merged.
CLA signing is automated via [CLA-assistant.io](https://cla-assistant.io/) on
the community repository. The bot will prompt you on your first PR.

The CLA grants the project maintainers a perpetual, irrevocable license to use
your contribution in both the community and commercial editions.

## Commercial Development

Commercial features are developed only in this repository. Access is restricted
to authorized team members.

### SPDX License Headers

All commercial source files must include the following header as the first line:

```
// SPDX-License-Identifier: LicenseRef-Commercial
```

For CSS/HTML files:

```
/* SPDX-License-Identifier: LicenseRef-Commercial */
```

For Rust files:

```rust
// SPDX-License-Identifier: LicenseRef-Commercial
```

Community-shared code uses the MIT identifier:

```
// SPDX-License-Identifier: MIT
```

### Commercial Directories

Files under these paths are always commercial-only:

- `agor-pro/`
- `src/lib/commercial/`

## Branch Model

| Branch | Purpose |
|--------|---------|
| `main` | Shared with community edition. Never commit commercial code here. |
| `commercial/*` | Commercial-only features. Merged into the commercial release branch. |
| `feature/*`, `fix/*` | Standard development branches. |

### Sync Flow

The community repo's `main` is merged into this repo's `main` periodically:

```
community/main --> origin/main --> commercial branches
```

Use `make sync` to pull community changes. Never force-push `main`.

## Commit Conventions

Use [Conventional Commits](https://www.conventionalcommits.org/):

```
type(scope): description

feat(dashboard): add team analytics panel
fix(sidecar): handle timeout on agent restart
docs(api): update webhook payload reference
chore(deps): bump tauri to 2.3.1
```

Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`, `ci`, `build`.

Breaking changes use `type!:` prefix or include `BREAKING CHANGE:` in the footer.

## Testing

Both editions must pass their respective test suites before merge:

```bash
# Community tests (must always pass on main)
npm run test:all

# Commercial tests (includes commercial-specific tests)
npm run test:all:commercial
```

Do not merge a PR if either suite is red. If a community sync introduces
failures in commercial tests, fix them before merging.

## Code Review

- All PRs require at least one approval.
- Commercial PRs must be reviewed by a team member with commercial repo access.
- Verify no commercial code leaks into community-bound branches before approving.
