|
| 1 | +# Repository Usage Guide |
| 2 | + |
| 3 | +## Getting Started |
| 4 | +1. Install dependencies: `npm install`. |
| 5 | +2. Copy `.env.example` to `.env` and set `MCP_BASIC_KEY`, `MCP_PAPERSCORE_KEY`, and any other secrets required by the agents. |
| 6 | +3. Run `npm run start` to boot the API via ts-node, or use `make dev` for the auto-rebuilding Docker dev stack (`api-dev` service). `make build && make up` builds and starts the production docker-compose stack locally. |
| 7 | + |
| 8 | +## Local Testing and Builds |
| 9 | +- `npm test`: runs the Jest suites in `src/*.test.ts` and any request tests. |
| 10 | +- `npm run test:coverage`: produces a coverage report under `coverage/`. |
| 11 | +- `npm run build`: compiles TypeScript into `dist/` and copies `src/templates/`. |
| 12 | +- `npm run serve`: executes the compiled `dist/app.js` using Node. |
| 13 | +Use these commands locally before pushing to keep CI green. |
| 14 | + |
| 15 | +## Publishing to GitHub Container Registry (GHCR) |
| 16 | +The repository publishes multi-architecture images to `ghcr.io/<owner>/paperdebugger-mcp-server` via the `Build and Push Docker Image` workflow (`.github/workflows/build.yaml`). When you push to `main` or open/update a pull request targeting `main`, GitHub Actions: |
| 17 | +1. Checks out the repo (with submodules) using `actions/checkout`. |
| 18 | +2. Sets up Buildx and authenticates to GHCR with `${{ secrets.GITHUB_TOKEN }}`. |
| 19 | +3. Generates tags for the branch, PR, and short SHA through `docker/metadata-action`. |
| 20 | +4. Builds `docker/Dockerfile` for `linux/amd64` and `linux/arm64` and pushes all tags to GHCR. |
| 21 | +Manual publishing is rarely needed, but you can mimic the pipeline locally: `docker build -t ghcr.io/<owner>/paperdebugger-mcp-server:dev -f docker/Dockerfile .` and then `docker push ghcr.io/<owner>/paperdebugger-mcp-server:dev` after `docker login ghcr.io` with a PAT scoped to packages. |
| 22 | + |
| 23 | +## Pulling the Latest Image from GitHub |
| 24 | +To consume the newest container, pull the tag emitted by the workflow: |
| 25 | +```bash |
| 26 | +docker pull ghcr.io/<owner>/paperdebugger-mcp-server:main |
| 27 | +docker pull ghcr.io/<owner>/paperdebugger-mcp-server:main-<short_sha> |
| 28 | +``` |
| 29 | +Tags `main`, `pr-<id>`, and `<branch>-<short_sha>` are updated during each run; production deployments typically use the `main` tag or a specific SHA tag for reproducibility. |
| 30 | + |
| 31 | +## GitHub Actions Overview |
| 32 | +### Build and Push Docker Image |
| 33 | +- **Trigger:** push to `main` or PR targeting `main`. |
| 34 | +- **Inputs:** repository source, `${{ secrets.PERSONAL_ACCESS_TOKEN }}` for checkout, `${{ secrets.GITHUB_TOKEN }}` for GHCR login. |
| 35 | +- **Process:** checkout → Buildx setup → tag calculation → multi-arch build → push to GHCR (with caching via `type=gha`). |
| 36 | +- **Output:** versioned Docker images stored in GHCR plus workflow metadata (tags, labels). |
| 37 | + |
| 38 | +### Test Coverage Workflow |
| 39 | +- **Trigger:** push or PR against `main` or `develop`. |
| 40 | +- **Inputs:** codebase, Node 20 runtime, secrets like `MCP_AUTO_TEST_KEY` for OpenAI calls. |
| 41 | +- **Process:** checkout → `npm ci` → `npm run test:coverage` → upload `coverage/` artifact → append summary → comment on PR (when applicable). |
| 42 | +- **Output:** stored coverage artifact, GitHub step summary, and a PR comment showing line/function/branch/statement coverage. |
0 commit comments