diff --git a/src/__tests__/bot-commands.test.ts b/src/__tests__/bot-commands.test.ts index abb577c..8622cbb 100644 --- a/src/__tests__/bot-commands.test.ts +++ b/src/__tests__/bot-commands.test.ts @@ -49,35 +49,33 @@ describe("parseCommand", () => { }); describe("bot messages", () => { - it("createdMessage (ru) has bootstrap and npm run agent only (no preview links yet)", () => { + it("createdMessage (ru) has spawn link and command", () => { const message = createdMessage( "ru", "demo-app", - "npx -y @spawn-dock/create@beta --token pair_demo", + "spawn-dock spawn --token pair_demo", + "spawndock://spawn?token=pair_demo", ); expect(message).not.toContain("Preview URL:"); expect(message).not.toContain("Telegram Link:"); - expect(message).not.toContain("TMA URL:"); - expect(message).not.toContain("Ссылки:"); - expect(message).not.toContain("Pairing Token:"); - expect(message).toContain("1. Запусти bootstrap-команду локально:"); - expect(message).toContain("Эту команду можно запускать повторно для этого проекта."); - expect(message).toContain("2. После bootstrap запусти агента и превью одной командой:"); - expect(message).toContain("npm run agent"); - expect(message).not.toContain("pnpm"); + expect(message).toContain("Нажми на ссылку, чтобы открыть рабочее окружение:"); + expect(message).toContain("spawndock://spawn?token=pair_demo"); + expect(message).toContain("Или запусти команду локально в терминале:"); + expect(message).toContain("spawn-dock spawn --token pair_demo"); }); it("createdMessage (en) uses English copy", () => { const message = createdMessage( "en", "demo-app", - "npx -y @spawn-dock/create@beta --token pair_demo", + "spawn-dock spawn --token pair_demo", + "spawndock://spawn?token=pair_demo", ); expect(message).toContain("Project"); - expect(message).toContain("1. Run the bootstrap command locally:"); - expect(message).toContain("npm run agent"); + expect(message).toContain("Click the link to open the workspace:"); + expect(message).toContain("spawndock://spawn?token=pair_demo"); }); it("includes TMA and preview links in launchMessage", () => { diff --git a/src/bot/i18n.ts b/src/bot/i18n.ts index 5f0acf2..93a6a1e 100644 --- a/src/bot/i18n.ts +++ b/src/bot/i18n.ts @@ -37,7 +37,7 @@ export function welcomeMessage(locale: BotLocale): string { "SpawnDock бот готов.", "", "Команды:", - "/new <название проекта> — создать TMA и получить bootstrap-команду", + "/new <название проекта> — создать проект и получить ссылку (или команду) для spawn-dock", "/launch <slug> — получить TMA и preview ссылки проекта", "/gettoken — показать общий API_TOKEN для MCP и dev tunnel", "/lang <en|ru> — язык интерфейса", @@ -48,7 +48,7 @@ export function welcomeMessage(locale: BotLocale): string { "SpawnDock bot is ready.", "", "Commands:", - "/new <project title> — create a TMA and get the bootstrap command", + "/new <project title> — create a project and get the spawn-dock link (or command)", "/launch <slug> — get TMA and preview links for the project", "/gettoken — show shared API_TOKEN for MCP and dev tunnel", "/lang <en|ru> — interface language", @@ -96,28 +96,26 @@ export function launchUsageMessage(locale: BotLocale): string { return "Use /launch <slug> to get the preview URL and current tunnel status."; } -export function createdMessage(locale: BotLocale, slug: string, bootstrapCmd: string): string { +export function createdMessage(locale: BotLocale, slug: string, spawnCmd: string, spawnLink: string): string { if (locale === "ru") { return [ `Проект ${esc(slug)} создан.`, "", - "1. Запусти bootstrap-команду локально:", - `${esc(bootstrapCmd)}`, - "Эту команду можно запускать повторно для этого проекта.", + "Нажми на ссылку, чтобы открыть рабочее окружение:", + renderLink(spawnLink), "", - "2. После bootstrap запусти агента и превью одной командой:", - "npm run agent", + "Или запусти команду локально в терминале:", + `${esc(spawnCmd)}` ].join("\n"); } return [ `Project ${esc(slug)} created.`, "", - "1. Run the bootstrap command locally:", - `${esc(bootstrapCmd)}`, - "You can run this command again for this project.", + "Click the link to open the workspace:", + renderLink(spawnLink), "", - "2. After bootstrap, start the agent and preview with one command:", - "npm run agent", + "Or run this command locally in your terminal:", + `${esc(spawnCmd)}` ].join("\n"); } @@ -148,8 +146,8 @@ export function launchMessage( export function ackCreatingProject(locale: BotLocale): string { return locale === "ru" - ? "Создаю проект и готовлю bootstrap-команду..." - : "Creating the project and preparing the bootstrap command..."; + ? "Создаю проект и готовлю ссылку на рабочее окружение..." + : "Creating the project and preparing the workspace link..."; } export function ackCheckingLaunch(locale: BotLocale): string { diff --git a/src/bot/polling.ts b/src/bot/polling.ts index db9c6c4..931e801 100644 --- a/src/bot/polling.ts +++ b/src/bot/polling.ts @@ -158,8 +158,9 @@ async function processUpdate(cfg: ReturnType, update: Tele clearTimeout(ackTimeout); const slug = data.project.slug; const token = data.pairingToken.token; - const bootstrapCmd = `npx -y @spawn-dock/create@beta --token ${token}`; - await sendMessage(cfg.telegramBotToken, msg.chat.id, createdMessage(locale, slug, bootstrapCmd)); + const spawnCmd = `spawn-dock spawn --token ${token}`; + const spawnLink = `spawndock://spawn?token=${token}`; + await sendMessage(cfg.telegramBotToken, msg.chat.id, createdMessage(locale, slug, spawnCmd, spawnLink)); return; }