# Repo Sync Service

Repository acquisition and snapshot lifecycle service for the code intelligence indexing pipeline.

## Responsibilities

- Receive Bitbucket webhooks and admin sync requests in future tasks
- Clone/fetch/checkout repositories in future tasks
- Publish `repo.snapshot.ready`, `files.changed`, and `commits.changed` events (TW-92)
- Track indexing runs and snapshot file inventory in MongoDB (TW-92)
- Expose REST health and status endpoints now

## Quick Start

```sh
make dev
make test
make build
```

## Default Port

`6001`

## Local PM2

```sh
pm2 start ecosystem.config.json
pm2 status
pm2 logs repo-sync-service
pm2 stop ecosystem.config.json
```

## Docs

- [Architecture](docs/architecture.md)
- [API](docs/api.md)
- [Local Setup](docs/local-setup.md)
- [Events](docs/events.md)

## Future Work

- Bitbucket webhook receiver
- Git clone/fetch/diff integration
- Redis Streams producers
