build: color-code open output

This commit is contained in:
2026-03-21 00:22:31 +05:30
parent c642148cac
commit 17bb1130c8
3 changed files with 23 additions and 11 deletions
+3
View File
@@ -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=="],
+1
View File
@@ -24,6 +24,7 @@
"release": "bash ./scripts/release.sh"
},
"dependencies": {
"chalk": "^5.3.0",
"@opencode-ai/plugin": "^1.2.27",
"commander": "^12.0.0"
},
+19 -11
View File
@@ -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<MultiM
sessionName,
windows: windowNames,
instructions: [
`Error: Created tmux session '${sessionName}', but some model launches failed.`,
`Succeeded: ${succeededModels.length > 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<MultiM
sessionName,
windows: windowNames,
instructions: [
`Use \`${attachCommand}\` to join session.`,
`When finished, clean up using either:`,
`1. ${primaryCleanup}`,
`2. Or run manually: \`${cleanupCommand}\``,
chalk.bold(`Use \`${attachCommand}\` to join session.`),
"",
chalk.dim(`When finished, clean up using:`),
primaryCleanup,
"",
chalk.dim(`Alternate manual cleanup - `),
chalk.dim(cleanupCommand)
].join("\n"),
};
}