fix(npm): use latest entry points without install scripts
This commit is contained in:
@@ -17,7 +17,7 @@ describe("client registration status", () => {
|
||||
]);
|
||||
await writeFile(
|
||||
join(home, ".codex/config.toml"),
|
||||
'[mcp_servers.rea]\ncommand = "npx"\nargs = ["-y", "rea-agents", "mcp"]\n',
|
||||
'[mcp_servers.rea]\ncommand = "npx"\nargs = ["-y", "rea-agents@latest", "mcp"]\n',
|
||||
);
|
||||
await writeFile(
|
||||
join(home, ".cursor/mcp.json"),
|
||||
@@ -44,4 +44,23 @@ describe("client registration status", () => {
|
||||
);
|
||||
expect(JSON.stringify(statuses)).not.toContain("SECRET");
|
||||
});
|
||||
|
||||
it("reports an unversioned npx registration as stale", async () => {
|
||||
const home = await mkdtemp(join(tmpdir(), "rea-registrations-"));
|
||||
await mkdir(join(home, ".codex"));
|
||||
await writeFile(
|
||||
join(home, ".codex/config.toml"),
|
||||
'[mcp_servers.rea]\ncommand = "npx"\nargs = ["-y", "rea-agents", "mcp"]\n',
|
||||
);
|
||||
|
||||
const statuses = await readClientRegistrationStatuses(home);
|
||||
|
||||
expect(statuses).toEqual([
|
||||
expect.objectContaining({
|
||||
client: "codex",
|
||||
command: ["npx", "-y", "rea-agents", "mcp"],
|
||||
state: "stale",
|
||||
}),
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ import { z } from "zod";
|
||||
import { PRODUCT_IDENTITY } from "../src/identity.js";
|
||||
|
||||
describe("package identity", () => {
|
||||
it("keeps the manifest, executable, and floating MCP command aligned", async () => {
|
||||
it("keeps the manifest, executable, and latest MCP command aligned", async () => {
|
||||
const packageJson = z
|
||||
.object({
|
||||
name: z.string(),
|
||||
@@ -28,7 +28,12 @@ describe("package identity", () => {
|
||||
);
|
||||
expect(packageJson.name).toBe(PRODUCT_IDENTITY.packageName);
|
||||
expect(Object.keys(packageJson.bin)).toEqual([PRODUCT_IDENTITY.cliBinary]);
|
||||
expect(PRODUCT_IDENTITY.mcpCommand).toBe(`npx -y ${packageJson.name} mcp`);
|
||||
expect(PRODUCT_IDENTITY.packageSpecifier).toBe(
|
||||
`${packageJson.name}@latest`,
|
||||
);
|
||||
expect(PRODUCT_IDENTITY.mcpCommand).toBe(
|
||||
`npx -y ${packageJson.name}@latest mcp`,
|
||||
);
|
||||
expect(packageJson.scripts.start).toBe("node scripts/rea.mjs mcp");
|
||||
expect(packageJson.scripts.prepare).toBe("npm run build && husky");
|
||||
expect(packageJson.scripts.prepack).toBe(
|
||||
|
||||
@@ -61,10 +61,10 @@ describe("localized README product facts", () => {
|
||||
expect(content).toContain(
|
||||
"curl -fsSL https://raw.githubusercontent.com/morluto/rea/main/install.sh | bash",
|
||||
);
|
||||
expect(content).toContain("npx -y rea-agents setup");
|
||||
expect(content).toContain("npx -y rea-agents doctor");
|
||||
expect(content).toContain("npx -y rea-agents@latest setup");
|
||||
expect(content).toContain("npx -y rea-agents@latest doctor");
|
||||
expect(content).toContain("rea uninstall");
|
||||
expect(content).toContain('"args": ["-y", "rea-agents", "mcp"]');
|
||||
expect(content).toContain('"args": ["-y", "rea-agents@latest", "mcp"]');
|
||||
expect(content).toContain("Node.js 22");
|
||||
expect(content).toContain("macOS 12");
|
||||
expect(content).toContain("Ubuntu 24.04");
|
||||
@@ -81,7 +81,8 @@ describe("localized README product facts", () => {
|
||||
|
||||
it("keeps both English CLI onboarding paths discoverable", async () => {
|
||||
const content = await readFile(resolve("README.md"), "utf8");
|
||||
expect(content).toContain("npx -y rea-agents analyze");
|
||||
expect(content).toContain("npx -y rea-agents@latest analyze");
|
||||
expect(content).toContain("npm install rea-agents` without `--global`");
|
||||
expect(content).toContain("npm install --global rea-agents");
|
||||
expect(content).toContain("rea setup");
|
||||
expect(content).toContain("--install-hopper");
|
||||
|
||||
@@ -55,7 +55,7 @@ describe("JSON client configuration transaction", () => {
|
||||
other: { command: "other" },
|
||||
rea: {
|
||||
command: "npx",
|
||||
args: ["-y", "rea-agents", "mcp"],
|
||||
args: ["-y", "rea-agents@latest", "mcp"],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -79,7 +79,7 @@ describe("JSON client configuration transaction", () => {
|
||||
mcpServers: {
|
||||
rea: {
|
||||
command: "npx",
|
||||
args: ["-y", "rea-agents", "mcp"],
|
||||
args: ["-y", "rea-agents@latest", "mcp"],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -108,7 +108,7 @@ describe("JSON client configuration transaction", () => {
|
||||
const configPath = join(directory, "mcp.json");
|
||||
await writeFile(
|
||||
configPath,
|
||||
'{"mcpServers":{"rea":{"command":"npx","args":["-y","rea-agents","mcp"]}}}\n',
|
||||
'{"mcpServers":{"rea":{"command":"npx","args":["-y","rea-agents@latest","mcp"]}}}\n',
|
||||
);
|
||||
expect(await configureJsonClient({ name: "cursor", configPath })).toEqual({
|
||||
status: "unchanged",
|
||||
@@ -118,6 +118,30 @@ describe("JSON client configuration transaction", () => {
|
||||
).rejects.toThrow();
|
||||
});
|
||||
|
||||
it("migrates an unversioned npx registration and preserves sibling configuration", async () => {
|
||||
directory = await mkdtemp(join(tmpdir(), "rea-setup-"));
|
||||
const configPath = join(directory, "mcp.json");
|
||||
const original =
|
||||
'{"theme":"dark","mcpServers":{"rea":{"command":"npx","args":["-y","rea-agents","mcp"]},"other":{"command":"other"}}}\n';
|
||||
await writeFile(configPath, original);
|
||||
|
||||
expect(await configureJsonClient({ name: "cursor", configPath })).toEqual(
|
||||
expect.objectContaining({ status: "configured" }),
|
||||
);
|
||||
|
||||
expect(JSON.parse(await readFile(configPath, "utf8"))).toEqual({
|
||||
theme: "dark",
|
||||
mcpServers: {
|
||||
rea: {
|
||||
command: "npx",
|
||||
args: ["-y", "rea-agents@latest", "mcp"],
|
||||
},
|
||||
other: { command: "other" },
|
||||
},
|
||||
});
|
||||
expect(await readFile(`${configPath}.rea.backup`, "utf8")).toBe(original);
|
||||
});
|
||||
|
||||
it("persists a custom Hopper launcher and remains idempotent", async () => {
|
||||
directory = await mkdtemp(join(tmpdir(), "rea-setup-"));
|
||||
const configPath = join(directory, "mcp.json");
|
||||
@@ -132,7 +156,7 @@ describe("JSON client configuration transaction", () => {
|
||||
mcpServers: {
|
||||
rea: {
|
||||
command: "npx",
|
||||
args: ["-y", "rea-agents", "mcp"],
|
||||
args: ["-y", "rea-agents@latest", "mcp"],
|
||||
env: { HOPPER_LAUNCHER_PATH: hopperPath },
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user