Skip to content
Merged
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
28 changes: 14 additions & 14 deletions .agents/skills/build-jsdoc/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
---
name: build-jsdoc
description: Use when changing externally facing TypeScript in the market-making bot. Inventory public callables, enforce substantive JSDoc, and build browsable TypeDoc output before completion.
description: Use when changing externally facing TypeScript in the quoter-bot bot. Inventory public callables, enforce substantive JSDoc, and build browsable TypeDoc output before completion.
version: 1.1.0
author: Morpho
license: Apache-2.0
metadata:
hermes:
tags: [typescript, jsdoc, typedoc, market-making, verification]
tags: [typescript, jsdoc, typedoc, quoter-bot, verification]
related_skills: []
---

# Build Market-Making JSDoc
# Build Quoter Bot JSDoc

## Overview

Use the package-owned TypeScript AST inventory and TypeDoc configuration to keep the market-making
Use the package-owned TypeScript AST inventory and TypeDoc configuration to keep the quoter-bot
public surface documented. The build treats TypeDoc warnings as errors and writes ignored, browsable
HTML; generated output is verification evidence, not a committed artifact.

## When to Use

- Any change to an exported function, class, interface, or type under
`bots/market-making/src/**`.
`bots/quoter-bot/src/**`.
- Any change to a public constructor, method, accessor, or exported callable signature.
- Before completing market-making work that could alter runtime/package boundaries.
- Before completing quoter-bot work that could alter runtime/package boundaries.

Do not use this workflow to document private implementation helpers unless their safety behavior cannot
be understood from the public contract.
Expand Down Expand Up @@ -54,13 +54,13 @@ corepack:

```sh
pnpm install --frozen-lockfile
pnpm --filter @morpho-org/market-making-bot run jsdoc:check
pnpm --filter @morpho-org/market-making-bot run jsdoc:build
pnpm --filter @morpho-org/quoter-bot run jsdoc:check
pnpm --filter @morpho-org/quoter-bot run jsdoc:build
```

- Coverage command: `jsdoc:check`
- TypeDoc config: `bots/market-making/typedoc.json`
- Output: `bots/market-making/build/jsdoc/index.html`
- TypeDoc config: `bots/quoter-bot/typedoc.json`
- Output: `bots/quoter-bot/build/jsdoc/index.html`
- Output policy: `build/` is ignored; do not stage generated HTML.

Completion criterion: the AST inventory exits zero, TypeDoc emits zero warnings/errors, and
Expand Down Expand Up @@ -95,7 +95,7 @@ Completion criterion: no named utility function declaration remains in changed s
shares a file with a class, and each protocol/viem reuse or local exception is evidenced in code or
the change report.

For the current market-making implementation, preserve these verified package boundaries:
For the current quoter-bot implementation, preserve these verified package boundaries:

- `@morpho-org/midnight-sdk@1.3.0/api` owns active-book URL construction and mapping through
`MidnightApi.fetchBooks`; inject the package's sanitized timeout-aware fetch adapter.
Expand All @@ -116,8 +116,8 @@ every added public callable exactly once.
## Inspect Generated Docs

```sh
test -s bots/market-making/build/jsdoc/index.html
python3 -m http.server 8000 --directory bots/market-making/build/jsdoc
test -s bots/quoter-bot/build/jsdoc/index.html
python3 -m http.server 8000 --directory bots/quoter-bot/build/jsdoc
```

Open `http://127.0.0.1:8000/` and inspect the setup-check service, state port, viem adapter,
Expand All @@ -144,7 +144,7 @@ URL, default runtime environment, raw provider response, or generated source-map
- [ ] Pinned pnpm install succeeds with the lockfile frozen.
- [ ] AST coverage prints the exhaustive public declaration inventory and exits zero.
- [ ] TypeDoc exits zero with warnings-as-errors enabled.
- [ ] `bots/market-making/build/jsdoc/index.html` exists and is non-empty.
- [ ] `bots/quoter-bot/build/jsdoc/index.html` exists and is non-empty.
- [ ] Generated output is ignored and absent from `git status`.
- [ ] Public docs explain failure, side-effect, timeout/deadline, and concurrency behavior where relevant.
- [ ] Independent checks still run concurrently through `Promise.all` where possible.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
RPC_URL_8453: ${{ secrets.RPC_URL_8453 }}

- name: Run browser smoke tests
run: pnpm --filter @morpho-org/market-making-bot run playground:smoke:test
run: pnpm --filter @morpho-org/quoter-bot run playground:smoke:test

Dead-Code:
runs-on: ubuntu-latest
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
- blue-liq
- midnight-liq
- crossed-books
- market-making
- quoter-bot

permissions:
contents: read
Expand All @@ -41,7 +41,7 @@ jobs:
blue_liq: ${{ steps.pick.outputs.blue_liq }}
midnight_liq: ${{ steps.pick.outputs.midnight_liq }}
crossed_books: ${{ steps.pick.outputs.crossed_books }}
market_making: ${{ steps.pick.outputs.market_making }}
quoter_bot: ${{ steps.pick.outputs.quoter_bot }}
steps:
- id: pick
env:
Expand All @@ -63,7 +63,7 @@ jobs:
echo "blue_liq=$(has blue-liq)"
echo "midnight_liq=$(has midnight-liq)"
echo "crossed_books=$(has crossed-books)"
echo "market_making=$(has market-making)"
echo "quoter_bot=$(has quoter-bot)"
} >> "$GITHUB_OUTPUT"

Blue:
Expand Down Expand Up @@ -101,10 +101,10 @@ jobs:
github_environment: crossed-books-prod
ref: ${{ github.sha }}

Market-making:
Quoter-bot:
needs: Select
if: ${{ needs.Select.outputs.market_making == 'true' }}
uses: ./.github/workflows/deploy-market-making-production.yml
if: ${{ needs.Select.outputs.quoter_bot == 'true' }}
uses: ./.github/workflows/deploy-quoter-bot-production.yml
secrets: inherit
with:
ref: ${{ github.sha }}
Expand Down Expand Up @@ -194,8 +194,8 @@ jobs:
gh release create "$tag" --target "$SHA" --title "$tag" --generate-notes \
${prev:+--notes-start-tag "$prev"}

Release-market-making:
needs: Market-making
Release-quoter-bot:
needs: Quoter-bot
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -208,7 +208,7 @@ jobs:
fetch-depth: 0
- name: Create release
env:
BOT: market-making
BOT: quoter-bot
SHA: ${{ github.sha }}
run: |
set -euo pipefail
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Deploy market-making playground to GitHub Pages
name: Deploy quoter-bot playground to GitHub Pages

on:
push:
branches: [main]
paths:
- bots/market-making/**
- bots/quoter-bot/**
- packages/bot-kit/**
- packages/logging/**
- packages/monitoring/**
Expand All @@ -18,13 +18,13 @@ on:
- .npmrc
- .nvmrc
- .github/actions/setup/action.yml
- .github/workflows/deploy-market-making-playground.yml
- .github/workflows/deploy-quoter-bot-playground.yml
workflow_dispatch:

permissions: {}

concurrency:
group: pages
group: quoter-bot-pages
cancel-in-progress: false

jobs:
Expand All @@ -47,16 +47,16 @@ jobs:
build-contracts: 'false'

- name: Test playground at the GitHub Pages subpath
run: PLAYGROUND_SMOKE_BASE_PATH=/morpho-bots/ pnpm --filter @morpho-org/market-making-bot run playground:smoke:test
run: PLAYGROUND_SMOKE_BASE_PATH=/morpho-bots/ pnpm --filter @morpho-org/quoter-bot run playground:smoke:test

- name: Build playground
run: pnpm --filter @morpho-org/market-making-bot run playground:build
run: pnpm --filter @morpho-org/quoter-bot run playground:build

- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
name: github-pages
path: bots/market-making/playground/dist
name: quoter-bot-github-pages
path: bots/quoter-bot/playground/dist
retention-days: 1

deploy:
Expand All @@ -81,4 +81,4 @@ jobs:
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
with:
artifact_name: github-pages
artifact_name: quoter-bot-github-pages
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Deploy market-making production
name: Deploy quoter-bot production

# Reusable deploy-only job for market-making's single Railway environment. Production's release
# selector calls this workflow after a `release-market-making` label lands on main.
# Reusable deploy-only job for quoter-bot's single Railway environment. Production's release
# selector calls this workflow after a `release-quoter-bot` label lands on main.

on:
workflow_call:
Expand All @@ -15,14 +15,14 @@ permissions:
contents: read

concurrency:
group: deploy-market-making-production
group: quoter-bot-production
cancel-in-progress: false

jobs:
Deploy:
runs-on: ubuntu-latest
timeout-minutes: 30
environment: market-making-production
environment: quoter-bot-production
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
Expand All @@ -42,4 +42,4 @@ jobs:
RAILWAY_ENVIRONMENT: production
RAILWAY_PROJECT_ID: ${{ vars.RAILWAY_PROJECT_ID }}
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
run: pnpm --filter @morpho-org/market-making-bot run deploy:railway
run: pnpm --filter @morpho-org/quoter-bot run deploy:railway
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ node_modules
.env.*
!.env.example

# Local market-making configuration (examples remain trackable)
# Local quoter-bot configuration (examples remain trackable)
**/quoter-bot.yaml
**/quoter-bot.yml
Comment thread
prd-carapulse[bot] marked this conversation as resolved.
!**/quoter-bot.example.yaml
!**/quoter-bot.example.yml
Comment thread
prd-carapulse[bot] marked this conversation as resolved.

# Legacy local configuration can still contain private keys after upgrading.
**/market-making.yaml
**/market-making.yml
!**/market-making.example.yaml
Expand Down
6 changes: 3 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Agent conventions:
- **JSDoc public surface**: Every externally facing function and public method changed in TypeScript
requires substantive JSDoc covering its applicable parameters, return value, failures, and side
effects. Before completion, follow `.agents/skills/build-jsdoc/SKILL.md` and run
`pnpm --filter @morpho-org/market-making-bot run jsdoc:build`; `.claude/skills` must be the real
`pnpm --filter @morpho-org/quoter-bot run jsdoc:build`; `.claude/skills` must be the real
symlink `../.agents/skills`, and independent checks must continue to run concurrently through
`Promise.all` where possible.
- **Utility isolation**: Utility functions must live in a different file from every file containing
Expand Down Expand Up @@ -157,7 +157,7 @@ This is a **pnpm workspaces monorepo** housing off-chain Morpho curator bots:
Each bot owns its own operator surface — `README.md`, `Dockerfile`, `docker-compose.yml`, and
`scripts/deploy-railway.ts` — so it ships as its own image and
deploys independently. `bots/blue-liquidation` and `bots/midnight-liquidation` are the live
liquidators; `bots/market-making` is the Midnight maker bot (setup checks, position bootstrap,
liquidators; `bots/quoter-bot` is the Midnight maker bot (setup checks, position bootstrap,
ladder quoting, combined monitoring); `bots/midnight-crossed-books` resolves crossed Midnight
books; `bots/kill-switch` is a proposal bot (docs only).
- `/packages/` — shared libraries: `@repo/bot-kit` (the shared bot runtime — viem
Expand Down Expand Up @@ -244,7 +244,7 @@ All commit messages, PR titles, and Linear ticket titles use the same format:
| Bot | Scope |
| ---------------------- | ------------------------ |
| blue-liquidation | `blue-liquidation` |
| market-making | `market-making` |
| quoter-bot | `quoter-bot` |
| midnight-crossed-books | `midnight-crossed-books` |
| midnight-liquidation | `midnight-liquidation` |

Expand Down
2 changes: 1 addition & 1 deletion bots/blue-liquidation/test/fork/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ async function waitForRpc(url: string, timeoutMs = 30_000): Promise<void> {
// Anvil port registry — vitest runs test FILES IN PARALLEL (bun's runner was serial, so fixed ports
// used to be safe within a bot only). Every fork suite in the repo must claim a distinct port:
// 8545 bots/blue-liquidation fork/liquidation
// 8546 bots/market-making e2e/setup-check
// 8546 bots/quoter-bot e2e/setup-check
// 8547 bots/midnight-liquidation fork/liquidation
// 8548 bots/midnight-liquidation fork/queue
/**
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion bots/midnight-liquidation/test/fork/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async function waitForRpc(url: string, timeoutMs = 30_000): Promise<void> {
// Anvil port registry — vitest runs test FILES IN PARALLEL (bun's runner was serial, so fixed ports
// used to be safe within a bot only). Every fork suite in the repo must claim a distinct port:
// 8545 bots/blue-liquidation fork/liquidation
// 8546 bots/market-making e2e/setup-check
// 8546 bots/quoter-bot e2e/setup-check
// 8547 bots/midnight-liquidation fork/liquidation
// 8548 bots/midnight-liquidation fork/queue
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ TRANSACTION_RECEIPT_TIMEOUT_MS=180000
# logship.misconfigured error and ships nothing.
BETTERSTACK_SOURCE_TOKEN=
BETTERSTACK_INGESTING_HOST=
# Optional Better Stack heartbeat URL. Heartbeat failures never interrupt market making.
# Optional Better Stack heartbeat URL. Heartbeat failures never interrupt quoter-bot.
BETTERSTACK_HEARTBEAT_URL=
# BOOTSTRAP_MARKETS replaces the YAML list. Every integer property must be a quoted decimal string.
BOOTSTRAP_MARKETS=[{"marketId":"0x5555555555555555555555555555555555555555555555555555555555555555","targetRate":{"strategy":"variable_rate_avg"},"creditTarget":"10000000000","acceptanceAssets":"100000000","offerSize":"500000000","premiumBps":"-50","maximumMarketExposure":"20000000000","maximumTotalExposure":"30000000000","minimumRateBps":"200","maximumRateBps":"800","autoRefill":false}]
Expand Down
4 changes: 2 additions & 2 deletions bots/market-making/Dockerfile → bots/quoter-bot/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
# Image for the market-making bot. The build context MUST be the repository root so workspace
# Image for the quoter-bot bot. The build context MUST be the repository root so workspace
# packages resolve. Node only: pnpm installs, esbuild bundles, node runs.
FROM node:24.14.1-slim
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
Expand All @@ -22,5 +22,5 @@ COPY --chown=node:node bots ./bots
RUN pnpm install --frozen-lockfile
RUN pnpm -r --if-present run build

WORKDIR /repo/bots/market-making
WORKDIR /repo/bots/quoter-bot
CMD ["node", "scripts/railway-entrypoint.mjs", "start", "--verbose"]
Loading
Loading