From ca09c415bfe115a13925ca2422b0b95bf3411367 Mon Sep 17 00:00:00 2001 From: Olivier Chafik Date: Tue, 25 Nov 2025 02:40:48 +0000 Subject: [PATCH] setup ci & presubmit (#20) * ci & presubmit * Update ci.yml --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++++++++++++++ .husky/pre-commit | 4 ++++ CONTRIBUTING.md | 0 package.json | 3 ++- src/app-bridge.ts | 5 +---- 5 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .husky/pre-commit create mode 100644 CONTRIBUTING.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c00caa1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - uses: actions/setup-node@v4 + with: + node-version: "20" + + - run: npm install + + - run: npm run build + + - name: Build simple-host example + working-directory: examples/simple-host + run: | + npm install + npm run build + + - name: Build simple-server example + working-directory: examples/simple-server + run: | + npm install + npm run build + + - run: npm run prettier diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..f474323 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +npm run build +npm run prettier:fix +( cd examples/simple-host && npm run build ) +( cd examples/simple-server && npm run build ) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..e69de29 diff --git a/package.json b/package.json index ef32670..3d312d1 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "start:example-mcp-server": "cd examples//simple-server && npm --registry=https://registry.npmjs.org/ install && npm start", "start": "NODE_ENV=development npm run build && concurrently 'npm run start:example-host' 'npm run start:example-mcp-server'", "build": "bun build.bun.ts", - "prepare": "npm run build", + "prepare": "npm run build && husky", "prettier:base-cmd": "prettier -u --ignore-path ./.gitignore --ignore-path ./.prettierignore", "prettier": "yarn prettier:base-cmd \"$(pwd)/**/*.{js,jsx,ts,tsx,mjs,json,md,yml,yaml}\" --check", "prettier:fix": "yarn prettier:base-cmd \"$(pwd)/**/*.{js,jsx,ts,tsx,mjs,json,md,yml,yaml}\" --write --list-different" @@ -40,6 +40,7 @@ "cors": "^2.8.5", "esbuild": "^0.25.12", "express": "^5.1.0", + "husky": "^9.1.7", "prettier": "^3.6.2", "typescript": "^5.9.3" }, diff --git a/src/app-bridge.ts b/src/app-bridge.ts index ea4c5e8..fcc8390 100644 --- a/src/app-bridge.ts +++ b/src/app-bridge.ts @@ -266,10 +266,7 @@ export class AppBridge extends Protocol { ListResourceTemplatesRequestSchema, ListResourceTemplatesResultSchema, ); - this.forwardRequest( - ReadResourceRequestSchema, - ReadResourceResultSchema, - ); + this.forwardRequest(ReadResourceRequestSchema, ReadResourceResultSchema); if (serverCapabilities.resources.listChanged) { this.forwardNotification(ResourceListChangedNotificationSchema); }