@speedscale/proxymock 2.5.1220 → 2.5.1233
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/README.md +25 -3
- package/bin/postinstall.js +1 -6
- package/bin/proxymock.js +6 -10
- package/package.json +2 -2
- package/test/launcher.test.js +44 -0
- package/test/postinstall.test.js +42 -0
- package/lib/register-mcp.js +0 -40
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ proxymock allows you to record, visualize, mock, and replay traffic on your loca
|
|
|
30
30
|
npx -y @speedscale/proxymock --help
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
The binary is downloaded and cached in `~/.speedscale/` during installation. proxymock
|
|
33
|
+
The binary is downloaded and cached in `~/.speedscale/` during installation. Run `proxymock mcp install --yes` when you want to register its MCP server and bundled skills with detected supported AI clients. Installation and ordinary CLI commands leave editor configurations unchanged.
|
|
34
34
|
|
|
35
35
|
## Getting Started
|
|
36
36
|
|
|
@@ -38,9 +38,9 @@ For complete setup instructions and tutorials, visit the [proxymock documentatio
|
|
|
38
38
|
|
|
39
39
|
## MCP (Model Context Protocol) Support
|
|
40
40
|
|
|
41
|
-
proxymock includes an MCP server for supported AI development tools.
|
|
41
|
+
proxymock includes an MCP server for supported AI development tools. Run `proxymock mcp install --yes` to configure detected clients, or add this configuration to your chosen client:
|
|
42
42
|
|
|
43
|
-
```
|
|
43
|
+
```json
|
|
44
44
|
{
|
|
45
45
|
"mcpServers": {
|
|
46
46
|
"proxymock-simulator": {
|
|
@@ -56,6 +56,28 @@ proxymock includes an MCP server for supported AI development tools. Installatio
|
|
|
56
56
|
}
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
## Kiro enterprise registry
|
|
60
|
+
|
|
61
|
+
Add this server entry to your organization's registry and select proxymock in Kiro. Node.js/npm must be available to Kiro, and `proxymock init` must have initialized your account. Kiro starts the server automatically. The CLI discovers its normal configuration without a config-path argument. Keep the registry version and package identifier unchanged for normal CLI releases.
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"servers": [{
|
|
66
|
+
"server": {
|
|
67
|
+
"name": "proxymock",
|
|
68
|
+
"description": "Speedscale proxymock MCP server.",
|
|
69
|
+
"version": "1.0.0",
|
|
70
|
+
"packages": [{
|
|
71
|
+
"registryType": "npm",
|
|
72
|
+
"identifier": "@speedscale/proxymock@latest",
|
|
73
|
+
"transport": {"type": "stdio"},
|
|
74
|
+
"packageArguments": [{"type": "positional", "value": "mcp"}]
|
|
75
|
+
}]
|
|
76
|
+
}
|
|
77
|
+
}]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
59
81
|
## Support
|
|
60
82
|
|
|
61
83
|
Join our [Slack community](https://slack.speedscale.com/). Seriously, come talk to us.
|
package/bin/postinstall.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import install from "../lib/install.js";
|
|
4
|
-
import { getPackageVersion } from "../lib/version.js";
|
|
5
|
-
import registerMcp from "../lib/register-mcp.js";
|
|
6
4
|
|
|
7
5
|
async function main() {
|
|
8
6
|
try {
|
|
9
7
|
await install();
|
|
10
8
|
} catch (error) {
|
|
11
9
|
console.warn(
|
|
12
|
-
`proxymock
|
|
10
|
+
`proxymock binary download skipped (${error.message}). Run npx -y @speedscale/proxymock --help to retry.`,
|
|
13
11
|
);
|
|
14
|
-
return;
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
await registerMcp(`v${getPackageVersion()}`);
|
|
18
13
|
}
|
|
19
14
|
|
|
20
15
|
main();
|
package/bin/proxymock.js
CHANGED
|
@@ -9,17 +9,13 @@ import {
|
|
|
9
9
|
import { binaryPath } from "../lib/constants.js";
|
|
10
10
|
import logger from "../lib/log.js";
|
|
11
11
|
import install from "../lib/install.js";
|
|
12
|
-
import registerMcp from "../lib/register-mcp.js";
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Spawns the proxymock binary with the provided command line arguments
|
|
16
15
|
* Exits the process with the same code as proxymock
|
|
17
16
|
*/
|
|
18
|
-
async function runProxyMock(
|
|
17
|
+
async function runProxyMock() {
|
|
19
18
|
const args = process.argv.slice(2);
|
|
20
|
-
if (args[0] !== "mcp") {
|
|
21
|
-
await registerMcp(version);
|
|
22
|
-
}
|
|
23
19
|
|
|
24
20
|
const child = spawn(binaryPath, args, {
|
|
25
21
|
stdio: "inherit",
|
|
@@ -39,14 +35,14 @@ async function runProxyMock(version) {
|
|
|
39
35
|
/**
|
|
40
36
|
* Installs proxymock and runs it, exiting on failure
|
|
41
37
|
*/
|
|
42
|
-
async function installAndRun(
|
|
38
|
+
async function installAndRun() {
|
|
43
39
|
try {
|
|
44
40
|
await install();
|
|
45
41
|
} catch (error) {
|
|
46
42
|
logger.error(`Installation failed: ${error.message}`);
|
|
47
43
|
process.exit(1);
|
|
48
44
|
}
|
|
49
|
-
await runProxyMock(
|
|
45
|
+
await runProxyMock();
|
|
50
46
|
}
|
|
51
47
|
|
|
52
48
|
/**
|
|
@@ -60,7 +56,7 @@ async function main() {
|
|
|
60
56
|
|
|
61
57
|
// Check if proxymock is installed
|
|
62
58
|
if (!existsSync(binaryPath)) {
|
|
63
|
-
await installAndRun(
|
|
59
|
+
await installAndRun();
|
|
64
60
|
return;
|
|
65
61
|
}
|
|
66
62
|
|
|
@@ -69,12 +65,12 @@ async function main() {
|
|
|
69
65
|
|
|
70
66
|
if (installedVersion === null || installedVersion !== expectedVersion) {
|
|
71
67
|
// Version unknown or mismatch, reinstall version from package
|
|
72
|
-
await installAndRun(
|
|
68
|
+
await installAndRun();
|
|
73
69
|
return;
|
|
74
70
|
}
|
|
75
71
|
|
|
76
72
|
// Version matches, run directly
|
|
77
|
-
await runProxyMock(
|
|
73
|
+
await runProxyMock();
|
|
78
74
|
}
|
|
79
75
|
|
|
80
76
|
main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speedscale/proxymock",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.1233",
|
|
4
4
|
"description": "A free desktop CLI that automatically creates mocks and tests from watching your app run.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"postinstall": "node bin/postinstall.js",
|
|
36
|
-
"test": "node --test
|
|
36
|
+
"test": "node --test",
|
|
37
37
|
"validate": "npm pack && echo 'Package validation complete'"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import test from "node:test";
|
|
8
|
+
|
|
9
|
+
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
10
|
+
const version = JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8")).version;
|
|
11
|
+
|
|
12
|
+
for (const args of [["--help"], ["--config", "dev.yaml", "mcp"], ["mcp"], ["mcp", "install", "--yes"]]) {
|
|
13
|
+
test(`forwards ${args.join(" ")} without implicit editor setup`, { skip: process.platform === "win32" }, (t) => {
|
|
14
|
+
const home = mkdtempSync(join(tmpdir(), "proxymock-launcher-"));
|
|
15
|
+
t.after(() => rmSync(home, { recursive: true, force: true }));
|
|
16
|
+
const installRoot = join(home, ".speedscale");
|
|
17
|
+
mkdirSync(installRoot);
|
|
18
|
+
const calls = join(home, "calls.jsonl");
|
|
19
|
+
const editorConfig = join(home, ".claude.json");
|
|
20
|
+
const originalConfig = '{"mcpServers":{"existing":{"command":"existing"}}}\n';
|
|
21
|
+
writeFileSync(editorConfig, originalConfig);
|
|
22
|
+
writeFileSync(join(installRoot, "proxymock"), `#!${process.execPath}
|
|
23
|
+
const fs = require("node:fs");
|
|
24
|
+
const args = process.argv.slice(2);
|
|
25
|
+
if (args[0] === "version") {
|
|
26
|
+
console.log(${JSON.stringify(`v${version}`)});
|
|
27
|
+
} else {
|
|
28
|
+
fs.appendFileSync(process.env.PROXYMOCK_TEST_CALLS, JSON.stringify(args) + "\\n");
|
|
29
|
+
if (args[0] === "mcp" && args[1] === "install") {
|
|
30
|
+
fs.writeFileSync(process.env.PROXYMOCK_TEST_EDITOR, "explicit setup");
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`, { mode: 0o755 });
|
|
34
|
+
const result = spawnSync(process.execPath, [join(packageRoot, "bin/proxymock.js"), ...args], {
|
|
35
|
+
env: { ...process.env, HOME: home, INSTALLROOT: installRoot, PROXYMOCK_TEST_CALLS: calls, PROXYMOCK_TEST_EDITOR: editorConfig },
|
|
36
|
+
encoding: "utf8",
|
|
37
|
+
timeout: 10000,
|
|
38
|
+
});
|
|
39
|
+
assert.equal(result.status, 0, result.stderr);
|
|
40
|
+
const invoked = readFileSync(calls, "utf8").trim().split("\n").map((line) => JSON.parse(line));
|
|
41
|
+
assert.deepEqual(invoked, [args]);
|
|
42
|
+
assert.equal(readFileSync(editorConfig, "utf8"), args[0] === "mcp" && args[1] === "install" ? "explicit setup" : originalConfig);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { existsSync, mkdtempSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import test from "node:test";
|
|
8
|
+
|
|
9
|
+
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
10
|
+
|
|
11
|
+
test("postinstall tolerates a failed download and leaves editor config alone", { skip: process.platform === "win32" }, (t) => {
|
|
12
|
+
const home = mkdtempSync(join(tmpdir(), "proxymock-postinstall-"));
|
|
13
|
+
t.after(() => rmSync(home, { recursive: true, force: true }));
|
|
14
|
+
const installRoot = join(home, ".speedscale");
|
|
15
|
+
mkdirSync(installRoot);
|
|
16
|
+
const calls = join(home, "calls.jsonl");
|
|
17
|
+
const editorConfig = join(home, ".claude.json");
|
|
18
|
+
const originalConfig = '{"mcpServers":{"existing":{"command":"existing"}}}\n';
|
|
19
|
+
writeFileSync(editorConfig, originalConfig);
|
|
20
|
+
writeFileSync(join(installRoot, "proxymock"), `#!${process.execPath}
|
|
21
|
+
require("node:fs").appendFileSync(process.env.PROXYMOCK_TEST_CALLS, JSON.stringify(process.argv.slice(2)) + "\\n");
|
|
22
|
+
`, { mode: 0o755 });
|
|
23
|
+
const offline = join(home, "offline.cjs");
|
|
24
|
+
writeFileSync(offline, `const https = require("node:https");
|
|
25
|
+
const { EventEmitter } = require("node:events");
|
|
26
|
+
https.get = () => {
|
|
27
|
+
const req = new EventEmitter();
|
|
28
|
+
process.nextTick(() => req.emit("error", new Error("offline")));
|
|
29
|
+
return req;
|
|
30
|
+
};
|
|
31
|
+
require("node:module").syncBuiltinESMExports();
|
|
32
|
+
`);
|
|
33
|
+
const result = spawnSync(process.execPath, ["--require", offline, join(packageRoot, "bin/postinstall.js")], {
|
|
34
|
+
env: { ...process.env, HOME: home, INSTALLROOT: installRoot, PROXYMOCK_TEST_CALLS: calls },
|
|
35
|
+
encoding: "utf8",
|
|
36
|
+
timeout: 10000,
|
|
37
|
+
});
|
|
38
|
+
assert.equal(result.status, 0, result.stderr);
|
|
39
|
+
assert.match(result.stderr + result.stdout, /binary download skipped \(offline\)/);
|
|
40
|
+
assert.equal(existsSync(calls), false);
|
|
41
|
+
assert.equal(readFileSync(editorConfig, "utf8"), originalConfig);
|
|
42
|
+
});
|
package/lib/register-mcp.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { spawn } from "child_process";
|
|
2
|
-
import { readFileSync, writeFileSync } from "fs";
|
|
3
|
-
import { join } from "path";
|
|
4
|
-
import { INSTALLROOT, binaryPath } from "./constants.js";
|
|
5
|
-
|
|
6
|
-
const markerPath = join(INSTALLROOT, "mcp-registration-version");
|
|
7
|
-
|
|
8
|
-
export default async function registerMcp(version) {
|
|
9
|
-
try {
|
|
10
|
-
if (readFileSync(markerPath, "utf8").trim() === version) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
} catch {}
|
|
14
|
-
|
|
15
|
-
const exitCode = await new Promise((resolve) => {
|
|
16
|
-
const child = spawn(binaryPath, ["mcp", "install", "--yes"], {
|
|
17
|
-
stdio: "inherit",
|
|
18
|
-
env: process.env,
|
|
19
|
-
});
|
|
20
|
-
child.on("error", (error) => {
|
|
21
|
-
console.warn(
|
|
22
|
-
`proxymock MCP setup skipped: ${error.message}. Run proxymock mcp install --yes after installation.`,
|
|
23
|
-
);
|
|
24
|
-
resolve(null);
|
|
25
|
-
});
|
|
26
|
-
child.on("exit", resolve);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
if (exitCode === 0) {
|
|
30
|
-
try {
|
|
31
|
-
writeFileSync(markerPath, version);
|
|
32
|
-
} catch (error) {
|
|
33
|
-
console.warn(`Could not save proxymock MCP setup state: ${error.message}`);
|
|
34
|
-
}
|
|
35
|
-
} else if (exitCode !== null) {
|
|
36
|
-
console.warn(
|
|
37
|
-
"proxymock MCP setup did not complete. Run proxymock mcp install --yes after installation.",
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
}
|