feat: port CLI, TUI, and launcher from v1.5 into v2 (#1452)
Ports the CLI, TUI, and launcher from v1.5 into v2 behind a single `mcp-inspector` entrypoint (launcher → web/cli/tui). Includes the `mcp-inspector --web --dev` launcher fix (Vite alias resolution + prod-server double-start), the root `postinstall` install cascade with simplified CI, and spec/AGENTS docs (no-workspaces rationale, Development setup). Closes #1246. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
53dc4549be
commit
2488ca5e38
1 changed files with 25594 additions and 236 deletions
50
clients/launcher/__tests__/parse-launcher-argv.test.ts
Normal file
50
clients/launcher/__tests__/parse-launcher-argv.test.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { parseLauncherArgv } from "../src/parse-launcher-argv.js";
|
||||
|
||||
const EXEC = ["node", "/path/to/launcher/build/index.js"];
|
||||
|
||||
describe("parseLauncherArgv", () => {
|
||||
it("defaults to web when no mode flag is in the prefix", () => {
|
||||
expect(parseLauncherArgv([...EXEC, "--method", "tools/list"])).toEqual({
|
||||
mode: "web",
|
||||
forwardedArgv: [...EXEC, "--method", "tools/list"],
|
||||
hasPrefixModeFlag: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("selects mode from a leading mode flag and strips only the prefix", () => {
|
||||
expect(
|
||||
parseLauncherArgv([...EXEC, "--cli", "node", "./server.js", "--cli"]),
|
||||
).toEqual({
|
||||
mode: "cli",
|
||||
forwardedArgv: [...EXEC, "node", "./server.js", "--cli"],
|
||||
hasPrefixModeFlag: true,
|
||||
});
|
||||
});
|
||||
|
||||
it("does not treat a trailing mode-like token as launcher mode", () => {
|
||||
expect(parseLauncherArgv([...EXEC, "node", "./server.js", "--cli"])).toEqual(
|
||||
{
|
||||
mode: "web",
|
||||
forwardedArgv: [...EXEC, "node", "./server.js", "--cli"],
|
||||
hasPrefixModeFlag: false,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects multiple mode flags in the launcher prefix", () => {
|
||||
expect(() => parseLauncherArgv([...EXEC, "--cli", "--tui"])).toThrow(
|
||||
/at most one of --web, --cli, or --tui/,
|
||||
);
|
||||
});
|
||||
|
||||
it("forwards a later mode-like token after non-mode app args", () => {
|
||||
expect(
|
||||
parseLauncherArgv([...EXEC, "--tui", "--config", "x", "--cli"]),
|
||||
).toEqual({
|
||||
mode: "tui",
|
||||
forwardedArgv: [...EXEC, "--config", "x", "--cli"],
|
||||
hasPrefixModeFlag: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue