diff --git a/extension/manifest.json b/extension/manifest.json index 1380c53..53eb9c9 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "Yoke", - "version": "0.1.10", + "version": "0.1.11", "description": "Let MCP clients drive your signed in Chrome by tab id: tabs, page text, trusted input, screenshots, console, network.", "icons": { "16": "icons/16.png", diff --git a/package-lock.json b/package-lock.json index c241fc5..ad48b4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "yoke-mcp", - "version": "0.1.10", + "version": "0.1.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "yoke-mcp", - "version": "0.1.10", + "version": "0.1.11", "license": "MIT", "bin": { "yoke": "dist/cli.js" diff --git a/package.json b/package.json index aec68de..16ff303 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yoke-mcp", - "version": "0.1.10", + "version": "0.1.11", "description": "MCP server for the Chrome you are already signed in to. Every tab in every window, addressed by tab id, with no second profile and no browser-wide debugging port.", "bin": { "yoke": "dist/cli.js" diff --git a/scripts/check-extension-id.mjs b/scripts/check-extension-id.mjs index bec3f9d..7c1cd1f 100644 --- a/scripts/check-extension-id.mjs +++ b/scripts/check-extension-id.mjs @@ -49,7 +49,7 @@ const bundle = new URL('../extension/browser/background.js', import.meta.url); if (!existsSync(bundle)) { throw new Error('extension/browser/background.js is missing. Run `npm run build` before packaging.'); } -const bundleVersion = readFileSync(bundle, 'utf8').match(/io\.github\.hamzahamidi\.yoke/); +const bundleVersion = /io\.github\.hamzahamidi\.yoke/.exec(readFileSync(bundle, 'utf8')); if (!bundleVersion) { throw new Error('the built extension does not name the current native messaging host, so it is stale'); } diff --git a/scripts/check-versions.mjs b/scripts/check-versions.mjs index 942c8dc..865f257 100644 --- a/scripts/check-versions.mjs +++ b/scripts/check-versions.mjs @@ -14,7 +14,7 @@ const manifest = JSON.parse(read('../extension/manifest.json')); // Read from source rather than dist, so this works before a build. const serverSource = read('../src/mcp-server.ts'); -const found = serverSource.match(/SERVER_VERSION\s*=\s*'([^']+)'/); +const found = /SERVER_VERSION\s*=\s*'([^']+)'/.exec(serverSource); if (!found) { throw new Error('could not find SERVER_VERSION in src/mcp-server.ts'); } diff --git a/src/mcp-server.ts b/src/mcp-server.ts index 7777aff..e51517b 100644 --- a/src/mcp-server.ts +++ b/src/mcp-server.ts @@ -20,7 +20,7 @@ import type { ResultOf } from './protocol.js'; import { ask, ExtensionUnavailable, NOT_CONNECTED } from './socket-client.js'; export const SERVER_NAME = 'yoke'; -export const SERVER_VERSION = '0.1.10'; +export const SERVER_VERSION = '0.1.11'; export const PROTOCOL_VERSION = '2024-11-05'; /** diff --git a/src/socket-path.ts b/src/socket-path.ts index 2309bee..dc66da5 100644 --- a/src/socket-path.ts +++ b/src/socket-path.ts @@ -89,6 +89,6 @@ export function listEndpoints(): string[] { if (!existsSync(dir)) { return []; } return readdirSync(dir) .filter((name) => endpointIdOf(name) !== undefined) - .sort() + .sort((left, right) => left.localeCompare(right, 'en')) .map((name) => join(dir, name)); } diff --git a/test/release-checks.test.ts b/test/release-checks.test.ts new file mode 100644 index 0000000..004475a --- /dev/null +++ b/test/release-checks.test.ts @@ -0,0 +1,9 @@ +import { test } from 'node:test'; + +test('the extension identifier release check accepts the built extension', async () => { + await import('../scripts/check-extension-id.mjs'); +}); + +test('the version release check accepts matching package, manifest, and server versions', async () => { + await import('../scripts/check-versions.mjs'); +}); diff --git a/test/socket-path.test.ts b/test/socket-path.test.ts index 555218e..d07a80c 100644 --- a/test/socket-path.test.ts +++ b/test/socket-path.test.ts @@ -5,9 +5,12 @@ // work: node:path is bound to the real platform at import, so join() keeps // producing that platform's separators whatever the flag says. import assert from 'node:assert/strict'; +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; import { test } from 'node:test'; -import { LEGACY_ID, endpointIdOf, endpointPathFor } from '../dist/socket-path.js'; +import { LEGACY_ID, endpointIdOf, endpointPathFor, listEndpoints } from '../dist/socket-path.js'; const windows = process.platform === 'win32'; @@ -19,6 +22,23 @@ test('on unix the legacy id is the socket every earlier release used', { skip: w assert.equal(endpointIdOf('/x/yoke/notes.txt'), undefined); }); +test('on unix listEndpoints returns valid socket paths in alphabetical order', { skip: windows }, () => { + const runtime = mkdtempSync(join(tmpdir(), 'yoke-socket-path-')); + const previous = process.env['XDG_RUNTIME_DIR']; + process.env['XDG_RUNTIME_DIR'] = runtime; + const directory = join(runtime, 'yoke'); + mkdirSync(directory); + for (const name of ['b.sock', 'a.sock', 'notes.txt', 'bad id.sock']) { + writeFileSync(join(directory, name), ''); + } + try { + assert.deepEqual(listEndpoints(), [join(directory, 'a.sock'), join(directory, 'b.sock')]); + } finally { + if (previous === undefined) { delete process.env['XDG_RUNTIME_DIR']; } else { process.env['XDG_RUNTIME_DIR'] = previous; } + rmSync(runtime, { recursive: true, force: true }); + } +}); + test('on windows the legacy id is the bare pipe name, and a profile id is suffixed', { skip: !windows }, () => { const previous = process.env['USERNAME']; process.env['USERNAME'] = 'hamza';