Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(web): offer the Windows CLI installer alongside curl (MUL-7602)
Basuotian6278fdb8bc4e
diff --git a/apps/web/features/landing/components/download/cli-section.test.tsx b/apps/web/features/landing/components/download/cli-section.test.tsxnew file mode 100644index 0000000000..cda24e8a05--- /dev/null+++ b/apps/web/features/landing/components/download/cli-section.test.tsx@@ -0,0 +1,42 @@+import { render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { describe, expect, it, vi } from "vitest";+import { CliSection } from "./cli-section";++vi.mock("../../i18n", () => ({+ useLocale: () => ({+ t: {+ download: {+ cli: {+ title: "Prefer the CLI?",+ sub: "For servers and headless setups.",+ installLabel: "Install",+ platformGroup: "Choose your platform",+ platformMacosLinux: "macOS / Linux",+ platformWindows: "Windows",+ startLabel: "Start daemon",+ sshNote: "Already on a server?",+ copyLabel: "Copy",+ copiedLabel: "Copied",+ },+ },+ },+ }),+}));++const WINDOWS_CMD =+ "irm https://raw.githubusercontent.com/multica-ai/multica/main/scripts/install.ps1 | iex";++describe("CliSection", () => {+ // The switch itself is covered in @multica/views; this checks the landing+ // dictionary is wired into it and the daemon block stays shared.+ it("wires the platform switch into the install block", async () => {+ const user = userEvent.setup();+ render(<CliSection />);++ await user.click(screen.getByRole("tab", { name: "Windows" }));++ expect(screen.getByText(WINDOWS_CMD)).toBeInTheDocument();+ expect(screen.getByText("multica setup")).toBeInTheDocument();+ });+});diff --git a/apps/web/features/landing/components/download/cli-section.tsx b/apps/web/features/landing/components/download/cli-section.tsxindex b22811c44a..1251460db2 100644--- a/apps/web/features/landing/components/download/cli-section.tsx+++ b/apps/web/features/landing/components/download/cli-section.tsx@@ -1,18 +1,28 @@"use client";-import { useState } from "react";+import { useState, type ReactNode } from "react";import { Check, Copy, Terminal } from "lucide-react";+import { CliInstallCommand } from "@multica/views/common/cli-install-command";import { copyText } from "@multica/ui/lib/clipboard";import { useLocale } from "../../i18n";-const INSTALL_CMD =- "curl -fsSL https://raw.githubusercontent.com/multica-ai/multica/main/scripts/install.sh | bash";const SETUP_CMD = "multica setup";+/**+ * The landing palette bypasses the product tokens, so the shared platform+ * switch takes its list and trigger colours from here.+ */+const PLATFORM_TABS = {+ list: "border border-[#0a0d12]/10 bg-white",+ trigger:+ "text-[#0a0d12]/60 hover:text-[#0a0d12] data-active:bg-[#0a0d12]/5 data-active:text-[#0a0d12]",+};+/*** Scenario-first CLI section. Copy leans into servers / remote dev* boxes / headless setups rather than positioning CLI as a- * lightweight Desktop. Two copy-and-paste command blocks.+ * lightweight Desktop. Two copy-and-paste command blocks; the install one+ * carries the platform switch, since install.sh and install.ps1 differ.*/export function CliSection() {const { t } = useLocale();@@ -29,18 +39,33 @@ export function CliSection() {</p><div className="mt-10 flex flex-col gap-5">- <CommandBlock- label={d.installLabel}- cmd={INSTALL_CMD}- copyLabel={d.copyLabel}- copiedLabel={d.copiedLabel}- />- <CommandBlock- label={d.startLabel}- cmd={SETUP_CMD}- copyLabel={d.copyLabel}- copiedLabel={d.copiedLabel}- />+ <div>+ <CommandLabel>{d.installLabel}</CommandLabel>+ <CliInstallCommand+ labels={{+ group: d.platformGroup,+ macosLinux: d.platformMacosLinux,+ windows: d.platformWindows,+ }}+ classNames={PLATFORM_TABS}+ >+ {(cmd) => (+ <CommandRow+ cmd={cmd}+ copyLabel={d.copyLabel}+ copiedLabel={d.copiedLabel}+ />+ )}+ </CliInstallCommand>+ </div>+ <div>+ <CommandLabel>{d.startLabel}</CommandLabel>+ <CommandRow+ cmd={SETUP_CMD}+ copyLabel={d.copyLabel}+ copiedLabel={d.copiedLabel}+ />+ </div></div><p className="mt-6 text-label text-[#0a0d12]/60">{d.sshNote}</p>@@ -49,13 +74,19 @@ export function CliSection() {);}-function CommandBlock({- label,+function CommandLabel({ children }: { children: ReactNode }) {+ return (+ <p className="mb-2 text-caption font-medium uppercase tracking-[0.08em] text-[#0a0d12]/55">+ {children}+ </p>+ );+}++function CommandRow({cmd,copyLabel,copiedLabel,}: {- label: string;cmd: string;copyLabel: string;copiedLabel: string;@@ -70,37 +101,32 @@ function CommandBlock({};return (- <div>- <p className="mb-2 text-caption font-medium uppercase tracking-[0.08em] text-[#0a0d12]/55">- {label}- </p>- <div className="flex items-start gap-3 rounded-xl border border-[#0a0d12]/10 bg-white px-4 py-3 font-mono text-label">- <Terminal- className="mt-0.5 size-4 shrink-0 text-[#0a0d12]/55"- aria-hidden- />- <code className="min-w-0 flex-1 whitespace-pre-wrap break-all">- {cmd}- </code>- <button- type="button"- onClick={onCopy}- aria-label={copied ? copiedLabel : copyLabel}- className="inline-flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-caption font-medium text-[#0a0d12]/70 transition-colors hover:bg-[#0a0d12]/5 hover:text-[#0a0d12]"- >- {copied ? (- <>- <Check className="size-3.5" />- {copiedLabel}- </>- ) : (- <>- <Copy className="size-3.5" />- {copyLabel}- </>- )}- </button>- </div>+ <div className="flex items-start gap-3 rounded-xl border border-[#0a0d12]/10 bg-white px-4 py-3 font-mono text-label">+ <Terminal+ className="mt-0.5 size-4 shrink-0 text-[#0a0d12]/55"+ aria-hidden+ />+ <code className="min-w-0 flex-1 whitespace-pre-wrap break-all">+ {cmd}+ </code>+ <button+ type="button"+ onClick={onCopy}+ aria-label={copied ? copiedLabel : copyLabel}+ className="inline-flex shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-caption font-medium text-[#0a0d12]/70 transition-colors hover:bg-[#0a0d12]/5 hover:text-[#0a0d12]"+ >+ {copied ? (+ <>+ <Check className="size-3.5" />+ {copiedLabel}+ </>+ ) : (+ <>+ <Copy className="size-3.5" />+ {copyLabel}+ </>+ )}+ </button></div>);}diff --git a/apps/web/features/landing/i18n/en.ts b/apps/web/features/landing/i18n/en.tsindex 3ba02bd9d8..4c9cb7fc09 100644--- a/apps/web/features/landing/i18n/en.ts+++ b/apps/web/features/landing/i18n/en.ts@@ -3590,6 +3590,9 @@ export function createEnDict(allowSignup: boolean): LandingDict {title: "Prefer the CLI?",sub: "For servers, remote dev boxes, and headless setups. Same daemon as Desktop, installed via terminal.",installLabel: "Install",+ platformGroup: "Choose your platform",+ platformMacosLinux: "macOS / Linux",+ platformWindows: "Windows",startLabel: "Start daemon",sshNote: "Already on a server? Same commands work over SSH.",copyLabel: "Copy",diff --git a/apps/web/features/landing/i18n/ja.ts b/apps/web/features/landing/i18n/ja.tsindex be90af6764..7a4e5b1924 100644--- a/apps/web/features/landing/i18n/ja.ts+++ b/apps/web/features/landing/i18n/ja.ts@@ -3091,6 +3091,9 @@ export function createJaDict(allowSignup: boolean): LandingDict {title: "CLI のほうが便利ですか?",sub: "サーバー、リモート開発環境、ヘッドレス環境に最適です。デスクトップと同じデーモンを、ターミナルからインストールできます。",installLabel: "インストール",+ platformGroup: "プラットフォームを選択",+ platformMacosLinux: "macOS / Linux",+ platformWindows: "Windows",startLabel: "デーモンを起動",sshNote: "すでにサーバーに接続中ですか? 同じコマンドが SSH 上でもそのまま使えます。",copyLabel: "コピー",diff --git a/apps/web/features/landing/i18n/ko.ts b/apps/web/features/landing/i18n/ko.tsindex c790c24ee3..66bba97135 100644--- a/apps/web/features/landing/i18n/ko.ts+++ b/apps/web/features/landing/i18n/ko.ts@@ -3112,6 +3112,9 @@ export function createKoDict(allowSignup: boolean): LandingDict {title: "CLI가 더 편하신가요?",sub: "서버, 원격 개발 환경, headless 환경에 적합합니다. 데스크톱과 동일한 데몬을 터미널에서 바로 설치할 수 있습니다.",installLabel: "설치",+ platformGroup: "플랫폼 선택",+ platformMacosLinux: "macOS / Linux",+ platformWindows: "Windows",startLabel: "데몬 시작",sshNote: "이미 서버에 접속해 있나요? 같은 명령을 SSH에서도 그대로 사용할 수 있습니다.",copyLabel: "복사",diff --git a/apps/web/features/landing/i18n/types.ts b/apps/web/features/landing/i18n/types.tsindex ba28e4edac..3c80ed84f3 100644--- a/apps/web/features/landing/i18n/types.ts+++ b/apps/web/features/landing/i18n/types.ts@@ -183,6 +183,9 @@ export type LandingDict = {title: string;sub: string;installLabel: string;+ platformGroup: string;+ platformMacosLinux: string;+ platformWindows: string;startLabel: string;sshNote: string;copyLabel: string;diff --git a/apps/web/features/landing/i18n/zh.ts b/apps/web/features/landing/i18n/zh.tsindex ef8c549e49..55b7207bca 100644--- a/apps/web/features/landing/i18n/zh.ts+++ b/apps/web/features/landing/i18n/zh.ts@@ -3585,6 +3585,9 @@ export function createZhDict(allowSignup: boolean): LandingDict {title: "想用 CLI?",sub: "适合服务器、远程开发机、无图形界面环境。底层 daemon 与 Desktop 相同,通过终端安装。",installLabel: "安装",+ platformGroup: "选择你的系统",+ platformMacosLinux: "macOS / Linux",+ platformWindows: "Windows",startLabel: "启动 daemon",sshNote: "已经在服务器上?通过 SSH 执行同样的命令即可。",copyLabel: "复制",diff --git a/packages/views/common/cli-install-command.test.tsx b/packages/views/common/cli-install-command.test.tsxnew file mode 100644index 0000000000..565574d089--- /dev/null+++ b/packages/views/common/cli-install-command.test.tsx@@ -0,0 +1,64 @@+import { render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { describe, expect, it } from "vitest";+import {+ CLI_INSTALL_COMMANDS,+ CliInstallCommand,+} from "./cli-install-command";++const LABELS = {+ group: "Choose your platform",+ macosLinux: "macOS / Linux",+ windows: "Windows",+};++function renderSwitch() {+ return render(+ <CliInstallCommand labels={LABELS}>+ {(command) => <code>{command}</code>}+ </CliInstallCommand>,+ );+}++describe("CliInstallCommand", () => {+ it("defaults to the macOS / Linux installer", () => {+ renderSwitch();++ expect(+ screen.getByRole("tablist", { name: LABELS.group }),+ ).toBeInTheDocument();+ expect(screen.getByRole("tab", { name: "macOS / Linux" })).toHaveAttribute(+ "aria-selected",+ "true",+ );+ expect(+ screen.getByText(CLI_INSTALL_COMMANDS.macosLinux),+ ).toBeInTheDocument();+ expect(screen.queryByText(CLI_INSTALL_COMMANDS.windows)).toBeNull();+ });++ it("hands the Windows command to the row when that tab is picked", async () => {+ const user = userEvent.setup();+ renderSwitch();++ await user.click(screen.getByRole("tab", { name: "Windows" }));++ expect(screen.getByRole("tab", { name: "Windows" })).toHaveAttribute(+ "aria-selected",+ "true",+ );+ expect(screen.getByText(CLI_INSTALL_COMMANDS.windows)).toBeInTheDocument();+ expect(screen.queryByText(CLI_INSTALL_COMMANDS.macosLinux)).toBeNull();+ });++ // A real tablist: arrow keys move between platforms without a click.+ it("switches platform with the arrow keys", async () => {+ const user = userEvent.setup();+ renderSwitch();++ await user.click(screen.getByRole("tab", { name: "macOS / Linux" }));+ await user.keyboard("{ArrowRight}");++ expect(screen.getByText(CLI_INSTALL_COMMANDS.windows)).toBeInTheDocument();+ });+});diff --git a/packages/views/common/cli-install-command.tsx b/packages/views/common/cli-install-command.tsxnew file mode 100644index 0000000000..38074b59a9--- /dev/null+++ b/packages/views/common/cli-install-command.tsx@@ -0,0 +1,85 @@+"use client";++import type { ReactNode } from "react";+import {+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,+} from "@multica/ui/components/ui/tabs";++/**+ * The Multica CLI install commands, one per platform family.+ *+ * Three surfaces render install instructions — the runtimes "add computer"+ * dialog, onboarding's CLI card, and the landing download page. They read the+ * commands from here instead of each hardcoding a string, which is how Windows+ * silently went missing from all of them while scripts/install.ps1 sat in the+ * repo. The scripts' own headers are the source of truth.+ */+export const CLI_INSTALL_COMMANDS = {+ macosLinux:+ "curl -fsSL https://raw.githubusercontent.com/multica-ai/multica/main/scripts/install.sh | bash",+ windows:+ "irm https://raw.githubusercontent.com/multica-ai/multica/main/scripts/install.ps1 | iex",+} as const;++export type CliInstallPlatform = keyof typeof CLI_INSTALL_COMMANDS;++/** Tab order. macOS / Linux stays first so the default matches the old single command. */+const PLATFORMS = [+ "macosLinux",+ "windows",+] as const satisfies readonly CliInstallPlatform[];++export interface CliInstallCommandLabels {+ /** Accessible name for the platform switch. */+ group: string;+ macosLinux: string;+ windows: string;+}++/**+ * Platform switch for the install command, built on the shared Tabs primitive+ * so tab semantics and arrow-key navigation come for free.+ *+ * The switch is the only shared UI: `children` receives the selected command+ * and renders it, so each surface keeps its own command row — the product+ * surfaces their token-styled row with an icon copy button, the landing page+ * its marketing palette with a spelled-out one.+ */+export function CliInstallCommand({+ labels,+ classNames,+ children,+}: {+ labels: CliInstallCommandLabels;+ /** Palette overrides for surfaces that do not use the product tokens. */+ classNames?: { list?: string; trigger?: string };+ children: (command: string) => ReactNode;+}) {+ return (+ <Tabs defaultValue={PLATFORMS[0]}>+ <TabsList+ aria-label={labels.group}+ activateOnFocus+ className={classNames?.list}+ >+ {PLATFORMS.map((platform) => (+ <TabsTrigger+ key={platform}+ value={platform}+ className={classNames?.trigger}+ >+ {labels[platform]}+ </TabsTrigger>+ ))}+ </TabsList>+ {PLATFORMS.map((platform) => (+ <TabsContent key={platform} value={platform}>+ {children(CLI_INSTALL_COMMANDS[platform])}+ </TabsContent>+ ))}+ </Tabs>+ );+}diff --git a/packages/views/locales/en/onboarding.json b/packages/views/locales/en/onboarding.jsonindex 628e107d95..eab9066fab 100644--- a/packages/views/locales/en/onboarding.json+++ b/packages/views/locales/en/onboarding.json@@ -117,6 +117,9 @@"copy_aria": "Copy","intro": "You'll need an agent runtime on this computer (Claude Code, Codex, Cursor, …) for it to run your agent. Also works on servers and remote dev boxes.","step1_label": "Install the Multica CLI",+ "platform_group": "Choose your platform",+ "platform_macos_linux": "macOS / Linux",+ "platform_windows": "Windows","step2_label": "Start the daemon"},"cloud_waitlist": {diff --git a/packages/views/locales/en/runtimes.json b/packages/views/locales/en/runtimes.jsonindex 491ca56fb7..a20edab70e 100644--- a/packages/views/locales/en/runtimes.json+++ b/packages/views/locales/en/runtimes.json@@ -202,6 +202,9 @@"title": "Add a computer","description": "Run these two commands on the computer you want to add. We'll detect it the moment the daemon comes online.","step1_label": "Install the Multica CLI",+ "platform_group": "Choose your platform",+ "platform_macos_linux": "macOS / Linux",+ "platform_windows": "Windows","step2_label": "Start the daemon","step2_hint": "Opens a browser to sign in, then keeps the daemon running in the background.","live_listening": "Waiting for your computer",diff --git a/packages/views/locales/fr/onboarding.json b/packages/views/locales/fr/onboarding.jsonindex b987b04541..5684e8e41d 100644--- a/packages/views/locales/fr/onboarding.json+++ b/packages/views/locales/fr/onboarding.json@@ -117,6 +117,9 @@"copy_aria": "Copier","intro": "Il vous faut un runtime d'agent sur cet ordinateur (Claude Code, Codex, Cursor, …) pour qu'il exécute votre agent. Fonctionne aussi sur des serveurs et des machines de développement distantes.","step1_label": "Installer le CLI Multica",+ "platform_group": "Choisissez votre système",+ "platform_macos_linux": "macOS / Linux",+ "platform_windows": "Windows","step2_label": "Démarrer le daemon"},"cloud_waitlist": {diff --git a/packages/views/locales/fr/runtimes.json b/packages/views/locales/fr/runtimes.jsonindex ed74ddd05a..3d0194b374 100644--- a/packages/views/locales/fr/runtimes.json+++ b/packages/views/locales/fr/runtimes.json@@ -202,6 +202,9 @@"title": "Ajouter un ordinateur","description": "Exécutez ces deux commandes sur l'ordinateur à ajouter. Nous le détecterons dès que le daemon sera en ligne.","step1_label": "Installer le CLI Multica",+ "platform_group": "Choisissez votre système",+ "platform_macos_linux": "macOS / Linux",+ "platform_windows": "Windows","step2_label": "Démarrer le daemon","step2_hint": "Ouvre un navigateur pour la connexion, puis laisse le daemon tourner en arrière-plan.","live_listening": "En attente de votre ordinateur",diff --git a/packages/views/locales/ja/onboarding.json b/packages/views/locales/ja/onboarding.jsonindex 2d3841f2c3..8234d1adf9 100644--- a/packages/views/locales/ja/onboarding.json+++ b/packages/views/locales/ja/onboarding.json@@ -117,6 +117,9 @@"copy_aria": "コピー","intro": "エージェントを実行するには、このコンピュータにエージェントランタイム(Claude Code、Codex、Cursor など)が必要です。サーバーやリモート開発環境でも動作します。","step1_label": "Multica CLI をインストール",+ "platform_group": "プラットフォームを選択",+ "platform_macos_linux": "macOS / Linux",+ "platform_windows": "Windows","step2_label": "デーモンを起動"},"cloud_waitlist": {diff --git a/packages/views/locales/ja/runtimes.json b/packages/views/locales/ja/runtimes.jsonindex 39304befcf..aa8c233326 100644--- a/packages/views/locales/ja/runtimes.json+++ b/packages/views/locales/ja/runtimes.json@@ -190,6 +190,9 @@"title": "コンピュータを追加","description": "追加したいコンピュータで、この 2 つのコマンドを実行してください。デーモンがオンラインになった瞬間に検出します。","step1_label": "Multica CLI をインストール",+ "platform_group": "プラットフォームを選択",+ "platform_macos_linux": "macOS / Linux",+ "platform_windows": "Windows","step2_label": "デーモンを起動","step2_hint": "サインインのためにブラウザを開き、その後デーモンをバックグラウンドで実行し続けます。","live_listening": "あなたのコンピュータを待っています",diff --git a/packages/views/locales/ko/onboarding.json b/packages/views/locales/ko/onboarding.jsonindex 0992f2f591..a002b3fb1e 100644--- a/packages/views/locales/ko/onboarding.json+++ b/packages/views/locales/ko/onboarding.json@@ -117,6 +117,9 @@"copy_aria": "복사","intro": "이 컴퓨터에서 에이전트를 실행하려면 에이전트 런타임(Claude Code, Codex, Cursor 등)이 필요합니다. 서버와 원격 개발 환경에서도 사용할 수 있습니다.","step1_label": "Multica CLI 설치",+ "platform_group": "플랫폼 선택",+ "platform_macos_linux": "macOS / Linux",+ "platform_windows": "Windows","step2_label": "데몬 시작"},"cloud_waitlist": {diff --git a/packages/views/locales/ko/runtimes.json b/packages/views/locales/ko/runtimes.jsonindex f9184284e9..f49ac0c787 100644--- a/packages/views/locales/ko/runtimes.json+++ b/packages/views/locales/ko/runtimes.json@@ -190,6 +190,9 @@"title": "컴퓨터 추가","description": "추가하려는 컴퓨터에서 아래 두 명령을 실행하세요. 데몬이 온라인이 되는 순간 감지합니다.","step1_label": "Multica CLI 설치",+ "platform_group": "플랫폼 선택",+ "platform_macos_linux": "macOS / Linux",+ "platform_windows": "Windows","step2_label": "데몬 시작","step2_hint": "로그인을 위해 브라우저를 열고, 이후 데몬을 백그라운드에서 계속 실행합니다.","live_listening": "컴퓨터를 기다리는 중",diff --git a/packages/views/locales/zh-Hans/onboarding.json b/packages/views/locales/zh-Hans/onboarding.jsonindex c828122ae9..3a86e0b267 100644--- a/packages/views/locales/zh-Hans/onboarding.json+++ b/packages/views/locales/zh-Hans/onboarding.json@@ -117,6 +117,9 @@"copy_aria": "复制","intro": "这台电脑上需要安装一个智能体运行时(Claude Code、Codex、Cursor 等)才能运行你的智能体。也支持服务器和远程开发机。","step1_label": "安装 Multica CLI",+ "platform_group": "选择你的系统",+ "platform_macos_linux": "macOS / Linux",+ "platform_windows": "Windows","step2_label": "启动守护进程"},"cloud_waitlist": {diff --git a/packages/views/locales/zh-Hans/runtimes.json b/packages/views/locales/zh-Hans/runtimes.jsonindex 0578f2619e..1a7e162904 100644--- a/packages/views/locales/zh-Hans/runtimes.json+++ b/packages/views/locales/zh-Hans/runtimes.json@@ -190,6 +190,9 @@"title": "添加电脑","description": "在要添加的电脑上运行这两条命令。守护进程一上线,这里就会自动识别。","step1_label": "安装 Multica CLI",+ "platform_group": "选择你的系统",+ "platform_macos_linux": "macOS / Linux",+ "platform_windows": "Windows","step2_label": "启动守护进程","step2_hint": "会打开浏览器登录,然后在后台保持守护进程运行。","live_listening": "等待你的电脑上线",diff --git a/packages/views/onboarding/steps/cli-install-instructions.test.tsx b/packages/views/onboarding/steps/cli-install-instructions.test.tsxnew file mode 100644index 0000000000..2eb1202cd0--- /dev/null+++ b/packages/views/onboarding/steps/cli-install-instructions.test.tsx@@ -0,0 +1,30 @@+import { render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";+import { describe, expect, it } from "vitest";+import { I18nProvider } from "@multica/core/i18n/react";+import enCommon from "../../locales/en/common.json";+import enOnboarding from "../../locales/en/onboarding.json";+import { CliInstallInstructions } from "./cli-install-instructions";++const TEST_RESOURCES = { en: { common: enCommon, onboarding: enOnboarding } };++const WINDOWS_CMD =+ "irm https://raw.githubusercontent.com/multica-ai/multica/main/scripts/install.ps1 | iex";++describe("CliInstallInstructions", () => {+ // The switch itself is covered in common/cli-install-command.test.tsx; this+ // checks the card wires it into step 1 and leaves step 2 shared.+ it("offers the Windows installer in step 1 and keeps setup shared", async () => {+ const user = userEvent.setup();+ render(+ <I18nProvider locale="en" resources={TEST_RESOURCES}>+ <CliInstallInstructions />+ </I18nProvider>,+ );++ await user.click(screen.getByRole("tab", { name: "Windows" }));++ expect(screen.getByText(WINDOWS_CMD)).toBeInTheDocument();+ expect(screen.getByText("multica setup")).toBeInTheDocument();+ });+});diff --git a/packages/views/onboarding/steps/cli-install-instructions.tsx b/packages/views/onboarding/steps/cli-install-instructions.tsxindex a11ac6e939..fea6410c8c 100644--- a/packages/views/onboarding/steps/cli-install-instructions.tsx+++ b/packages/views/onboarding/steps/cli-install-instructions.tsx@@ -1,15 +1,14 @@"use client";-import { useState } from "react";+import { useState, type ReactNode } from "react";import { Check, Copy, Terminal } from "lucide-react";import { Card, CardContent } from "@multica/ui/components/ui/card";import { CODE_LIGATURE_CLASS } from "@multica/ui/lib/code-style";import { cn } from "@multica/ui/lib/utils";import { copyText } from "@multica/ui/lib/clipboard";+import { CliInstallCommand } from "../../common/cli-install-command";import { useT } from "../../i18n";-const INSTALL_CMD =- "curl -fsSL https://raw.githubusercontent.com/multica-ai/multica/main/scripts/install.sh | bash";const SETUP_CMD = "multica setup";function CopyButton({ text }: { text: string }) {@@ -40,35 +39,49 @@ function CopyButton({ text }: { text: string }) {);}-function Step({ n, label, cmd }: { n: number; label: string; cmd: string }) {+function CommandRow({ cmd }: { cmd: string }) {+ return (+ <div className="flex items-start gap-2 rounded-lg bg-muted px-3 py-2.5 font-mono text-body">+ <Terminal className="mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" />+ <code+ className={cn(+ "min-w-0 flex-1 whitespace-pre-wrap break-all",+ CODE_LIGATURE_CLASS,+ )}+ >+ {cmd}+ </code>+ <CopyButton text={cmd} />+ </div>+ );+}++function Step({+ n,+ label,+ children,+}: {+ n: number;+ label: string;+ children: ReactNode;+}) {return (<div><p className="mb-1.5 text-caption font-medium text-foreground">{n}. {label}</p>- <div className="flex items-start gap-2 rounded-lg bg-muted px-3 py-2.5 font-mono text-body">- <Terminal className="mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" />- <code- className={cn(- "min-w-0 flex-1 whitespace-pre-wrap break-all",- CODE_LIGATURE_CLASS,- )}- >- {cmd}- </code>- <CopyButton text={cmd} />- </div>+ {children}</div>);}/**- * CLI install instructions — two copy-and-run commands. Hardcoded because- * there's nothing environmental to infer: step 1 is the public install- * script, step 2 is the cloud `multica setup` which the CLI itself knows- * the endpoints for. Local development tests a self-host variant by- * typing the extended command directly in the terminal; no need to- * thread env vars through React.+ * CLI install instructions — two copy-and-run commands. Step 1 is the public+ * install script, which differs per OS and so renders through+ * `CliInstallCommand`'s platform switch; step 2 is the cloud+ * `multica setup`, hardcoded because the CLI itself knows the endpoints for+ * it. Local development tests a self-host variant by typing the extended+ * command directly in the terminal; no need to thread env vars through React.*/export function CliInstallInstructions() {const { t } = useT("onboarding");@@ -78,8 +91,20 @@ export function CliInstallInstructions() {<p className="text-caption leading-[1.55] text-muted-foreground">{t(($) => $.cli_install.intro)}</p>- <Step n={1} label={t(($) => $.cli_install.step1_label)} cmd={INSTALL_CMD} />- <Step n={2} label={t(($) => $.cli_install.step2_label)} cmd={SETUP_CMD} />+ <Step n={1} label={t(($) => $.cli_install.step1_label)}>+ <CliInstallCommand+ labels={{+ group: t(($) => $.cli_install.platform_group),+ macosLinux: t(($) => $.cli_install.platform_macos_linux),+ windows: t(($) => $.cli_install.platform_windows),+ }}+ >+ {(cmd) => <CommandRow cmd={cmd} />}+ </CliInstallCommand>+ </Step>+ <Step n={2} label={t(($) => $.cli_install.step2_label)}>+ <CommandRow cmd={SETUP_CMD} />+ </Step></CardContent></Card>);diff --git a/packages/views/package.json b/packages/views/package.jsonindex eb577e8812..5553cf0761 100644--- a/packages/views/package.json+++ b/packages/views/package.json@@ -11,6 +11,7 @@"exports": {"./navigation": "./navigation/index.ts","./common/actor-avatar": "./common/actor-avatar.tsx",+ "./common/cli-install-command": "./common/cli-install-command.tsx","./editor": "./editor/index.ts","./issues/components": "./issues/components/index.ts","./issues/hooks": "./issues/hooks/index.ts",diff --git a/packages/views/runtimes/components/connect-remote-dialog.test.tsx b/packages/views/runtimes/components/connect-remote-dialog.test.tsxindex 4f1933474a..56ddcadd6d 100644--- a/packages/views/runtimes/components/connect-remote-dialog.test.tsx+++ b/packages/views/runtimes/components/connect-remote-dialog.test.tsx@@ -1,5 +1,6 @@import { QueryClient, QueryClientProvider } from "@tanstack/react-query";import { act, render, screen, waitFor } from "@testing-library/react";+import userEvent from "@testing-library/user-event";import { beforeEach, describe, expect, it, vi } from "vitest";import { I18nProvider } from "@multica/core/i18n/react";import { configStore } from "@multica/core/config";@@ -9,6 +10,16 @@ import { ConnectRemoteDialog } from "./connect-remote-dialog";const TEST_RESOURCES = { en: { common: enCommon, runtimes: enRuntimes } };+// Mocked at the module boundary rather than through navigator.clipboard: jsdom+// exposes no clipboard, and user-event installs a getter-only stub of its own+// that would swallow the assertion. Assert what the button hands to copyText,+// not what the browser then does with it.+const clipboard = vi.hoisted(() => ({+ copyText: vi.fn<(text: string) => Promise<boolean>>(),+}));++vi.mock("@multica/ui/lib/clipboard", () => ({ copyText: clipboard.copyText }));+vi.mock("@multica/core/hooks", () => ({useWorkspaceId: () => "ws-test",}));@@ -27,6 +38,9 @@ const wsEventState = vi.hoisted(() => ({handler: null as ((payload: unknown) => void) | null,}));+const WINDOWS_CMD =+ "irm https://raw.githubusercontent.com/multica-ai/multica/main/scripts/install.ps1 | iex";+vi.mock("@multica/core/realtime", () => ({useWSEvent: (_event: string, handler: (payload: unknown) => void) => {wsEventState.handler = handler;@@ -69,6 +83,7 @@ function renderDialog(config?: {describe("ConnectRemoteDialog", () => {beforeEach(() => {wsEventState.handler = null;+ clipboard.copyText.mockReset().mockResolvedValue(true);});it("uses cloud setup commands by default", () => {@@ -101,6 +116,23 @@ describe("ConnectRemoteDialog", () => {);});+ // The install command is OS-specific, so the dialog can't hardcode one.+ // Before this switch existed the dialog shipped only the curl command and+ // Windows users had no path at all, despite scripts/install.ps1. The switch+ // itself is covered in common/cli-install-command.test.tsx; this checks it+ // is wired through to step 1's copy button.+ it("copies the installer for the platform picked in step 1", async () => {+ const user = userEvent.setup();+ renderDialog();++ await user.click(screen.getByRole("tab", { name: "Windows" }));+ await user.click(screen.getAllByRole("button", { name: "Copy" })[0]!);++ await waitFor(() => {+ expect(clipboard.copyText).toHaveBeenCalledWith(WINDOWS_CMD);+ });+ });+it("transitions from setup instructions to the connected state", async () => {const { baseElement } = renderDialog();diff --git a/packages/views/runtimes/components/connect-remote-dialog.tsx b/packages/views/runtimes/components/connect-remote-dialog.tsxindex 4ef41c8e28..36dffd6447 100644--- a/packages/views/runtimes/components/connect-remote-dialog.tsx+++ b/packages/views/runtimes/components/connect-remote-dialog.tsx@@ -1,6 +1,12 @@"use client";-import { useCallback, useEffect, useRef, useState } from "react";+import {+ useCallback,+ useEffect,+ useRef,+ useState,+ type ReactNode,+} from "react";import { AnimatePresence, motion, useReducedMotion } from "motion/react";import { Check, ChevronRight, Copy, Terminal } from "lucide-react";import { useQueryClient } from "@tanstack/react-query";@@ -25,13 +31,12 @@ import {UI_MOTION_DURATION,} from "@multica/ui/lib/motion";import { cn } from "@multica/ui/lib/utils";+import { CliInstallCommand } from "../../common/cli-install-command";import { useNavigation } from "../../navigation";import { useT } from "../../i18n";type Step = "instructions" | "success";-const INSTALL_CMD =- "curl -fsSL https://raw.githubusercontent.com/multica-ai/multica/main/scripts/install.sh | bash";const CLOUD_SERVER_URL = "https://api.multica.ai";const CLOUD_APP_URL = "https://multica.ai";@@ -191,37 +196,41 @@ function CopyButton({ text, ariaLabel }: { text: string; ariaLabel: string }) {);}+function CommandRow({ cmd, copyAria }: { cmd: string; copyAria: string }) {+ return (+ <div className="flex items-start gap-2 rounded-lg bg-muted px-3 py-2.5 font-mono text-body">+ <Terminal+ className="mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"+ aria-hidden+ />+ <code+ className={cn(+ "min-w-0 flex-1 break-all whitespace-pre-wrap tabular-nums",+ CODE_LIGATURE_CLASS,+ )}+ >+ {cmd}+ </code>+ <CopyButton text={cmd} ariaLabel={copyAria} />+ </div>+ );+}+function CommandStep({n,label,- cmd,- copyAria,+ children,}: {n: number;label: string;- cmd: string;- copyAria: string;+ children: ReactNode;}) {return (<div><p className="mb-1.5 text-caption font-medium text-foreground">{n}. {label}</p>- <div className="flex items-start gap-2 rounded-lg bg-muted px-3 py-2.5 font-mono text-body">- <Terminal- className="mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground"- aria-hidden- />- <code- className={cn(- "min-w-0 flex-1 break-all whitespace-pre-wrap tabular-nums",- CODE_LIGATURE_CLASS,- )}- >- {cmd}- </code>- <CopyButton text={cmd} ariaLabel={copyAria} />- </div>+ {children}</div>);}@@ -248,20 +257,33 @@ function InstructionsStep({ onClose }: { onClose: () => void }) {<div className="min-h-0 flex-1 overflow-y-auto px-6 py-4"><div className="space-y-4">- <CommandStep- n={1}- label={t(($) => $.connect.step1_label)}- cmd={INSTALL_CMD}- copyAria={t(($) => $.connect.copy_aria)}- />+ {/* Step 1 owns the platform switch: the install command differs by+ OS, so the user picks instead of us guessing. Step 2's+ `multica setup` is platform-independent. */}+ <CommandStep n={1} label={t(($) => $.connect.step1_label)}>+ <CliInstallCommand+ labels={{+ group: t(($) => $.connect.platform_group),+ macosLinux: t(($) => $.connect.platform_macos_linux),+ windows: t(($) => $.connect.platform_windows),+ }}+ >+ {(cmd) => (+ <CommandRow+ cmd={cmd}+ copyAria={t(($) => $.connect.copy_aria)}+ />+ )}+ </CliInstallCommand>+ </CommandStep><div>- <CommandStep- n={2}- label={t(($) => $.connect.step2_label)}- cmd={setupCmd}- copyAria={t(($) => $.connect.copy_aria)}- />+ <CommandStep n={2} label={t(($) => $.connect.step2_label)}>+ <CommandRow+ cmd={setupCmd}+ copyAria={t(($) => $.connect.copy_aria)}+ />+ </CommandStep><p className="mt-1.5 text-micro leading-[1.55] text-muted-foreground">{t(($) => $.connect.step2_hint)}</p>@@ -295,12 +317,12 @@ function TroubleshootingDetails({ tokenCmd }: { tokenCmd: string }) {</summary><div className="space-y-2 border-t px-3 pt-2.5 pb-3 text-micro leading-[1.55] text-muted-foreground"><p>{t(($) => $.connect.trouble_intro)}</p>- <CommandStep- n={2}- label={t(($) => $.connect.step2_label)}- cmd={tokenCmd}- copyAria={t(($) => $.connect.copy_aria)}- />+ <CommandStep n={2} label={t(($) => $.connect.step2_label)}>+ <CommandRow+ cmd={tokenCmd}+ copyAria={t(($) => $.connect.copy_aria)}+ />+ </CommandStep><p>{t(($) => $.connect.trouble_token_hint_prefix)}<span className="font-medium text-foreground">