mirror of
https://github.com/aaronsb/obsidian-mcp-plugin.git
synced 2026-07-22 06:45:14 +00:00
Reimplemented from PR #126 (djsplice, who also reported #125), reduced to the parts that are verified-clean. The worker-offload half of #126 is split out to a tracking issue (inert as wired + correctness divergences — see PR discussion / the follow-up issue). SSE route deconfliction In @modelcontextprotocol/sdk@1.29.0 (the pinned version), `GET /mcp` is the standalone server->client SSE stream for server-initiated messages — verified in webStandardStreamableHttp.js:handleGetRequest (opens `_GET_stream`, Content-Type text/event-stream, gated on Accept: text/event-stream + session + protocol version). A debug route returning application/json on `GET /mcp` shadowed it, so any client that opens the standalone stream (mcp-remote-class bridges — #128's logs show one in use here) received JSON instead of an SSE stream and treated it as failed. Moved debug to `GET /mcp-info`; `GET /mcp` and `POST /mcp` both reach handleMCPRequest. Unlike #126's `app.all('/mcp')`, GET/POST are registered individually so the existing explicit `app.delete('/mcp')` session-close handler is preserved. Scope note: this restores the server-initiated-notification channel (a real latent defect on its own). It is NOT claimed to fix #128 — per the #190 investigation that is a separate SDK-1.29 compat-init problem — and #125's "SSE reconnection loop" is the reporter's un-reproduced diagnosis. Two-row Levenshtein fuzzy-match.ts rewritten from a full (m+1)x(n+1) matrix to a two-row formulation (O(n) memory, no per-line array-of-arrays allocation) plus length heuristics and a 0.95 early-exit. Pure CPU/memory win on the main-thread edit.window path; behaviour-preserving. Adds the first fuzzy-match tests (classic Levenshtein distances, symmetry, heuristic-preservation). build.yml: PR-status-comment step set continue-on-error so it cannot red an otherwise-green build on fork/limited-token PRs. Co-authored-by: djsplice <barrows.jeff@gmail.com>
68 lines
No EOL
1.6 KiB
YAML
68 lines
No EOL
1.6 KiB
YAML
name: Build and Test
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, 'feat/**', 'feature/**', 'fix/**', 'hotfix/**' ]
|
|
paths-ignore:
|
|
- '**.md'
|
|
- '.gitignore'
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
env:
|
|
PLUGIN_NAME: obsidian-mcp-plugin
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
issues: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0 # Fetch full history for version bumping
|
|
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Lint code
|
|
run: npm run lint
|
|
|
|
- name: Run tests
|
|
run: npm run test
|
|
|
|
- name: Build plugin
|
|
run: npm run build
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: ${{ env.PLUGIN_NAME }}-${{ github.sha }}
|
|
path: |
|
|
main.js
|
|
manifest.json
|
|
styles.css
|
|
|
|
- name: Comment on PR with build status
|
|
if: github.event_name == 'pull_request'
|
|
# Never let the status-comment step (can fail on fork PRs / limited
|
|
# token perms) red the whole build — the build itself already passed.
|
|
continue-on-error: true
|
|
uses: actions/github-script@v9
|
|
with:
|
|
script: |
|
|
github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: '✅ Build succeeded! Artifacts are available in the Actions tab.'
|
|
}) |