Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cli/ui/Wizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,9 @@ function mcpItems(): SelectItem<string>[] {
});
}

function placeholderFor(entry: CatalogEntry): string {
if (entry.name === "filesystem") return "e.g. /tmp/carboncode-sandbox";
if (entry.name === "sqlite") return "e.g. ./notes.sqlite";
export function placeholderFor(entry: CatalogEntry): string {
if (entry.name === "filesystem") return t("wizard.mcpArgsFilesystemPlaceholder");
if (entry.name === "sqlite") return t("wizard.mcpArgsSqlitePlaceholder");
return entry.userArgs ?? "";
}

Expand Down
2 changes: 2 additions & 0 deletions src/i18n/EN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ export const EN: TranslationSchema = {
mcpArgsRequiredParam: "Required parameter: ",
mcpArgsEmpty: "{name} needs a value — got an empty string.",
mcpArgsNotADir: "{path} exists but is not a directory.",
mcpArgsFilesystemPlaceholder: "e.g. /tmp/carboncode-sandbox",
mcpArgsSqlitePlaceholder: "e.g. ./notes.sqlite",
reviewTitle: "Ready to save",
reviewLabelApiKey: "API key",
reviewLabelLanguage: "Language",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ export interface TranslationSchema {
mcpArgsRequiredParam: string;
mcpArgsEmpty: string;
mcpArgsNotADir: string;
mcpArgsFilesystemPlaceholder: string;
mcpArgsSqlitePlaceholder: string;
themeTitle: string;
themeSubtitle: string;
themeSampleHeading: string;
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,8 @@ export const zhCN: TranslationSchema = {
mcpArgsRequiredParam: "必填参数:",
mcpArgsEmpty: "{name} 需要一个值 — 不能为空。",
mcpArgsNotADir: "{path} 存在但不是目录。",
mcpArgsFilesystemPlaceholder: "例如:/tmp/carboncode-sandbox",
mcpArgsSqlitePlaceholder: "例如:./notes.sqlite",
reviewTitle: "确认保存",
reviewLabelApiKey: "API key",
reviewLabelLanguage: "语言",
Expand Down
28 changes: 27 additions & 1 deletion tests/wizard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { render } from "ink-testing-library";
import React from "react";
import { afterEach, describe, expect, it } from "vitest";
import { Wizard, buildSpec, validateDeepSeekApiKey } from "../src/cli/ui/Wizard.js";
import { Wizard, buildSpec, placeholderFor, validateDeepSeekApiKey } from "../src/cli/ui/Wizard.js";
import { setLanguageRuntime } from "../src/i18n/index.js";
import { parseMcpSpec } from "../src/mcp/spec.js";

Expand Down Expand Up @@ -66,6 +66,32 @@ describe("Wizard — first-launch language picker", () => {
});
});

describe("Wizard — localized MCP argument placeholders", () => {
afterEach(() => {
setLanguageRuntime("EN");
});

it("localizes filesystem and sqlite placeholders in zh-CN", () => {
setLanguageRuntime("zh-CN");

expect(
placeholderFor({ name: "filesystem", command: "npx", args: [], userArgs: "<dir>" }),
).toBe("例如:/tmp/carboncode-sandbox");
expect(placeholderFor({ name: "sqlite", command: "npx", args: [], userArgs: "<db>" })).toBe(
"例如:./notes.sqlite",
);
});

it("keeps filesystem and sqlite placeholders in EN", () => {
expect(
placeholderFor({ name: "filesystem", command: "npx", args: [], userArgs: "<dir>" }),
).toBe("e.g. /tmp/carboncode-sandbox");
expect(placeholderFor({ name: "sqlite", command: "npx", args: [], userArgs: "<db>" })).toBe(
"e.g. ./notes.sqlite",
);
});
});

describe("Wizard API-key validation", () => {
it("accepts a key when DeepSeek auth check succeeds", async () => {
const fetcher = async () => new Response(JSON.stringify({ data: [] }), { status: 200 });
Expand Down