From 17bb1130c821da3d481454e287fec32135ef3389 Mon Sep 17 00:00:00 2001 From: bendtherules Date: Sat, 21 Mar 2026 00:22:31 +0530 Subject: [PATCH] build: color-code open output --- bun.lock | 3 +++ package.json | 1 + src/core/open.ts | 30 +++++++++++++++++++----------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/bun.lock b/bun.lock index 7e37a9c..68daa8b 100644 --- a/bun.lock +++ b/bun.lock @@ -6,6 +6,7 @@ "name": "@username/opencode-multi-model", "dependencies": { "@opencode-ai/plugin": "^1.2.27", + "chalk": "^5.3.0", "commander": "^12.0.0", }, "devDependencies": { @@ -25,6 +26,8 @@ "bun-types": ["bun-types@1.3.11", "", { "dependencies": { "@types/node": "*" } }, "sha512-1KGPpoxQWl9f6wcZh57LvrPIInQMn2TQ7jsgxqpRzg+l0QPOFvJVH7HmvHo/AiPgwXy+/Thf6Ov3EdVn1vOabg=="], + "chalk": ["chalk@5.6.2", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="], + "commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="], "undici-types": ["undici-types@7.18.2", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="], diff --git a/package.json b/package.json index 0f4176d..09f0859 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "release": "bash ./scripts/release.sh" }, "dependencies": { + "chalk": "^5.3.0", "@opencode-ai/plugin": "^1.2.27", "commander": "^12.0.0" }, diff --git a/src/core/open.ts b/src/core/open.ts index f55f734..2ddc13d 100644 --- a/src/core/open.ts +++ b/src/core/open.ts @@ -1,4 +1,5 @@ import * as fs from "node:fs"; +import chalk from 'chalk'; import type { MultiModelOptions, MultiModelResult } from "../types"; import { runCommand, @@ -201,13 +202,17 @@ export async function openMultiModel(options: MultiModelOptions): Promise 0 ? succeededModels.join(", ") : "none"}.`, - `Failed: ${failedModels.join(", ")}.`, - `Attach with \`${attachCommand}\` to inspect the session.`, - `Cleanup when done using either:`, - `1. ${primaryCleanup}`, - `2. Or run manually: \`${cleanupCommand}\``, + chalk.red(`Error: Created tmux session '${sessionName}', but some model launches failed.`), + chalk.red(`Failed: ${failedModels.join(", ")}.`), + chalk.dim(`Succeeded: ${succeededModels.length > 0 ? succeededModels.join(", ") : "none"}.`), + "", + chalk.bold(`Attach with \`${attachCommand}\` to inspect the session.`), + "", + chalk.dim(`When finished, clean up using:`), + primaryCleanup, + "", + chalk.dim(`Alternate manual cleanup - `), + chalk.dim(cleanupCommand) ].join("\n"), }; } @@ -217,10 +222,13 @@ export async function openMultiModel(options: MultiModelOptions): Promise