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
17 changes: 16 additions & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,25 @@
"feedback",
"annotation"
],
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "diff -q \"${CLAUDE_PLUGIN_ROOT}/package.json\" \"${CLAUDE_PLUGIN_DATA}/package.json\" >/dev/null 2>&1 || (cd \"${CLAUDE_PLUGIN_DATA}\" && cp \"${CLAUDE_PLUGIN_ROOT}/package.json\" . && npm install --production) || rm -f \"${CLAUDE_PLUGIN_DATA}/package.json\""
}
]
}
]
},
"mcpServers": {
"browser-feedback": {
"command": "node",
"args": ["${CLAUDE_PLUGIN_ROOT}/src/server.js"]
"args": ["${CLAUDE_PLUGIN_ROOT}/src/server.js"],
"env": {
"NODE_PATH": "${CLAUDE_PLUGIN_DATA}/node_modules"
}
}
}
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Install plugin dependencies via `SessionStart` hook into the plugin data directory, and resolve `html2canvas` using `createRequire` so it works when `node_modules` lives outside the plugin root

## [0.6.3] - 2026-04-21

### Fixed
Expand Down
6 changes: 4 additions & 2 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import http from "http";
import fs from "fs";
import path from "path";
import crypto from "node:crypto";
import { fileURLToPath } from "url";
import { fileURLToPath, pathToFileURL } from "url";
import { createRequire } from "module";
import { execFile } from "child_process";
import { isValidSessionId, getPendingSummary, detectProjectUrl, formatFeedbackAsContent } from "./utils.js";

Expand Down Expand Up @@ -247,7 +248,8 @@ const httpServer = http.createServer((req, res) => {
}

if (urlObj.pathname === "/html2canvas.min.js") {
const html2canvasPath = path.join(__dirname, "..", "node_modules", "html2canvas", "dist", "html2canvas.min.js");
const require = createRequire(import.meta.url);
const html2canvasPath = path.join(path.dirname(require.resolve("html2canvas/package.json")), "dist", "html2canvas.min.js");
fs.readFile(html2canvasPath, "utf8", (err, content) => {
if (err) {
res.writeHead(404);
Expand Down
Loading