Add provider triage health contract
This commit is contained in:
@@ -2,6 +2,7 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { type UniDeskConfig, repoRoot, rootPath } from "./config";
|
||||
import { runCommand } from "./command";
|
||||
import { runProviderTriage } from "./provider-triage";
|
||||
|
||||
interface ProviderAttachOptions {
|
||||
providerId: string;
|
||||
@@ -177,7 +178,14 @@ function inspectAttachedContainer(options: ProviderAttachOptions): ProviderAttac
|
||||
export async function runProviderCommand(config: UniDeskConfig, args: string[]): Promise<unknown> {
|
||||
const [sub] = args;
|
||||
if (sub !== "attach") {
|
||||
throw new Error("provider requires subcommand: attach");
|
||||
if (sub === "triage") {
|
||||
const providerId = args[1];
|
||||
if (providerId === undefined || providerId.length === 0) {
|
||||
throw new Error("provider triage requires provider id, for example: bun scripts/cli.ts provider triage D601");
|
||||
}
|
||||
return runProviderTriage(config, providerId, args.slice(2));
|
||||
}
|
||||
throw new Error("provider requires subcommand: attach|triage");
|
||||
}
|
||||
const options = parseAttachOptions(config, args.slice(1));
|
||||
mkdirSync(options.logDir, { recursive: true });
|
||||
|
||||
Reference in New Issue
Block a user