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", "name": "@username/opencode-multi-model",
"dependencies": { "dependencies": {
"@opencode-ai/plugin": "^1.2.27", "@opencode-ai/plugin": "^1.2.27",
"chalk": "^5.3.0",
"commander": "^12.0.0", "commander": "^12.0.0",
}, },
"devDependencies": { "devDependencies": {
@@ -25,6 +26,8 @@
"bun-types": ["bun-types@1.3.11", "", { "dependencies": { "@types/node": "*" } }, "sha512-1KGPpoxQWl9f6wcZh57LvrPIInQMn2TQ7jsgxqpRzg+l0QPOFvJVH7HmvHo/AiPgwXy+/Thf6Ov3EdVn1vOabg=="], "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=="], "commander": ["commander@12.1.0", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="],
"undici-types": ["undici-types@7.18.2", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="], "undici-types": ["undici-types@7.18.2", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="],
+1
View File
@@ -24,6 +24,7 @@
"release": "bash ./scripts/release.sh" "release": "bash ./scripts/release.sh"
}, },
"dependencies": { "dependencies": {
"chalk": "^5.3.0",
"@opencode-ai/plugin": "^1.2.27", "@opencode-ai/plugin": "^1.2.27",
"commander": "^12.0.0" "commander": "^12.0.0"
}, },
+19 -11
View File
@@ -1,4 +1,5 @@
import * as fs from "node:fs"; import * as fs from "node:fs";
import chalk from 'chalk';
import type { MultiModelOptions, MultiModelResult } from "../types"; import type { MultiModelOptions, MultiModelResult } from "../types";
import { import {
runCommand, runCommand,
@@ -201,13 +202,17 @@ export async function openMultiModel(options: MultiModelOptions): Promise<MultiM
sessionName, sessionName,
windows: windowNames, windows: windowNames,
instructions: [ instructions: [
`Error: Created tmux session '${sessionName}', but some model launches failed.`, chalk.red(`Error: Created tmux session '${sessionName}', but some model launches failed.`),
`Succeeded: ${succeededModels.length > 0 ? succeededModels.join(", ") : "none"}.`, chalk.red(`Failed: ${failedModels.join(", ")}.`),
`Failed: ${failedModels.join(", ")}.`, chalk.dim(`Succeeded: ${succeededModels.length > 0 ? succeededModels.join(", ") : "none"}.`),
`Attach with \`${attachCommand}\` to inspect the session.`, "",
`Cleanup when done using either:`, chalk.bold(`Attach with \`${attachCommand}\` to inspect the session.`),
`1. ${primaryCleanup}`, "",
`2. Or run manually: \`${cleanupCommand}\``, chalk.dim(`When finished, clean up using:`),
primaryCleanup,
"",
chalk.dim(`Alternate manual cleanup - `),
chalk.dim(cleanupCommand)
].join("\n"), ].join("\n"),
}; };
} }
@@ -217,10 +222,13 @@ export async function openMultiModel(options: MultiModelOptions): Promise<MultiM
sessionName, sessionName,
windows: windowNames, windows: windowNames,
instructions: [ instructions: [
`Use \`${attachCommand}\` to join session.`, chalk.bold(`Use \`${attachCommand}\` to join session.`),
`When finished, clean up using either:`, "",
`1. ${primaryCleanup}`, chalk.dim(`When finished, clean up using:`),
`2. Or run manually: \`${cleanupCommand}\``, primaryCleanup,
"",
chalk.dim(`Alternate manual cleanup - `),
chalk.dim(cleanupCommand)
].join("\n"), ].join("\n"),
}; };
} }