eyemark-local 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,4 @@
1
+ Copyright (c) 2026 Pablo Monteoliva. All rights reserved.
2
+
3
+ This software is not open source. No license to use, copy, modify, or distribute it is
4
+ granted except by written agreement with the copyright holder.
package/README.md CHANGED
@@ -1,3 +1,15 @@
1
- # Temporary Holding Version
1
+ # eyemark-local
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Eyemark's `measure` tool for your coding agent: the rendered checks on your dev server, run on
4
+ your machine. It uses your Eyemark MCP token to fetch the current checks on each call (nothing
5
+ is stored on disk), so you always run the newest ones with nothing to update.
6
+
7
+ ```bash
8
+ claude mcp add --scope user eyemark-local -e EYEMARK_TOKEN=<your Eyemark MCP token> -- npx -y eyemark-local
9
+ npx playwright install chromium
10
+ ```
11
+
12
+ Other clients: run `npx -y eyemark-local` with `EYEMARK_TOKEN` in its environment.
13
+
14
+ Then ask your agent to measure `http://localhost:3000` (or whichever port your dev server uses).
15
+ It answers PASS or FAIL with the fixes to make first. Node 22 or later.
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env node
2
+ // eyemark-local: Eyemark's measure tool as a small MCP server on stdio. It holds no checks. On each
3
+ // call it asks the hosted service for the current engine with your Eyemark MCP token, keeps it in
4
+ // memory (never on disk), and runs it here, so your dev server never leaves your machine and every
5
+ // run uses the newest checks. An unchanged engine costs one short request (304).
6
+
7
+ import readline from "node:readline";
8
+
9
+ const ENDPOINT = process.env.EYEMARK_ENGINE_URL || "https://mcp.eyemark.dev/api/engine";
10
+ const VERSION = "0.1.0";
11
+
12
+ // Shown until the engine loads, and when it can't: the same inputs the engine's tool takes.
13
+ const FALLBACK = {
14
+ name: "measure",
15
+ description: "Run Eyemark's rendered checks on the dev server on this machine (or any site, read-only), at desktop and phone width. Ends with PASS or FAIL and the fixes to make first.",
16
+ inputSchema: {
17
+ type: "object",
18
+ properties: {
19
+ url: { type: "string", description: "The dev server, e.g. http://localhost:3000." },
20
+ routes: { type: "array", items: { type: "string" }, description: "Routes to load. Defaults to [\"/\"]." },
21
+ only: { type: "array", items: { type: "string" }, description: "Keep only these checks or categories. Optional." },
22
+ },
23
+ required: ["url"],
24
+ },
25
+ };
26
+
27
+ let engine;
28
+ let etag;
29
+
30
+ // The current engine: fetched when there's none yet or the service has a newer one. When the
31
+ // service can't be reached, the one already loaded keeps working.
32
+ async function load() {
33
+ const token = process.env.EYEMARK_TOKEN;
34
+ if (!token) throw new Error("Set EYEMARK_TOKEN to your Eyemark MCP token (the one your hosted Eyemark MCP uses), then restart your agent.");
35
+ let res;
36
+ try {
37
+ res = await fetch(ENDPOINT, { headers: { authorization: `Bearer ${token}`, ...(etag && engine ? { "if-none-match": etag } : {}) }, signal: AbortSignal.timeout(15000) });
38
+ } catch (e) {
39
+ if (engine) return engine;
40
+ throw new Error(`Couldn't reach Eyemark (${ENDPOINT}): ${e.cause?.code ?? e.message}. measure needs the internet to get its checks.`);
41
+ }
42
+ if (res.status === 304 && engine) return engine;
43
+ if (res.status === 401) throw new Error("Eyemark refused the token in EYEMARK_TOKEN. Check it, or ask for a new one.");
44
+ if (!res.ok) {
45
+ if (engine) return engine;
46
+ throw new Error(`Eyemark answered ${res.status}. Try again in a minute.`);
47
+ }
48
+ const code = await res.text();
49
+ engine = await import(`data:text/javascript;base64,${Buffer.from(code).toString("base64")}`);
50
+ etag = res.headers.get("etag") ?? undefined;
51
+ return engine;
52
+ }
53
+
54
+ const text = (s) => ({ content: [{ type: "text", text: s }], isError: true });
55
+
56
+ async function handle(msg) {
57
+ const { id, method, params = {} } = msg;
58
+ const reply = (result) => ({ jsonrpc: "2.0", id, result });
59
+ switch (method) {
60
+ case "initialize":
61
+ return reply({
62
+ protocolVersion: params.protocolVersion ?? "2025-06-18",
63
+ capabilities: { tools: {} },
64
+ serverInfo: { name: "eyemark-local", version: VERSION },
65
+ instructions: "After building each part of a UI, call measure on the dev server (localhost) with the routes it touches, fix every error, and measure again until it passes before saying the work is done.",
66
+ });
67
+ case "ping":
68
+ return reply({});
69
+ case "tools/list":
70
+ try {
71
+ return reply({ tools: (await load()).TOOLS });
72
+ } catch (e) {
73
+ return reply({ tools: [{ ...FALLBACK, description: `${FALLBACK.description} Not ready: ${e.message}` }] });
74
+ }
75
+ case "tools/call":
76
+ try {
77
+ const playwright = await import("playwright");
78
+ return reply(await (await load()).call(String(params.name), params.arguments ?? {}, playwright));
79
+ } catch (e) {
80
+ return reply(text(`Error: ${e.message}`));
81
+ }
82
+ default:
83
+ return id === undefined ? undefined : { jsonrpc: "2.0", id, error: { code: -32601, message: `Method not found: ${method}` } };
84
+ }
85
+ }
86
+
87
+ const rl = readline.createInterface({ input: process.stdin });
88
+ rl.on("line", (line) => {
89
+ if (!line.trim()) return;
90
+ let msg;
91
+ try {
92
+ msg = JSON.parse(line);
93
+ } catch {
94
+ process.stdout.write(`${JSON.stringify({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "Parse error" } })}\n`);
95
+ return;
96
+ }
97
+ handle(msg).then((out) => out && process.stdout.write(`${JSON.stringify(out)}\n`));
98
+ });
package/package.json CHANGED
@@ -1,6 +1,21 @@
1
1
  {
2
2
  "name": "eyemark-local",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Eyemark's measure tool for your agent: the rendered checks on your dev server, run on your machine.",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "type": "module",
7
+ "bin": {
8
+ "eyemark-local": "./bin/eyemark-local.js"
9
+ },
10
+ "files": [
11
+ "bin",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "engines": {
16
+ "node": ">=22"
17
+ },
18
+ "dependencies": {
19
+ "playwright": "1.63.0"
20
+ }
21
+ }