fix(packages): polish cli and mcp package contracts
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
export function mdTable(headers: string[], rows: string[][]): string {
|
||||
const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] || "").length), 3));
|
||||
const header = `| ${headers.map((h, i) => h.padEnd(widths[i])).join(" | ")} |`;
|
||||
const sep = `| ${widths.map((w) => "-".repeat(w)).join(" | ")} |`;
|
||||
const body = rows.map((r) => `| ${r.map((c, i) => (c || "").padEnd(widths[i])).join(" | ")} |`).join("\n");
|
||||
return body ? `${header}\n${sep}\n${body}` : `${header}\n${sep}`;
|
||||
}
|
||||
|
||||
export function formatCell(value: unknown): string {
|
||||
if (value === null || value === undefined) return "NULL";
|
||||
if (typeof value === "object") return JSON.stringify(value);
|
||||
return String(value);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ export * from "./bridge.js";
|
||||
export * from "./connections.js";
|
||||
export * from "./database.js";
|
||||
export * from "./diagnostics.js";
|
||||
export * from "./format.js";
|
||||
export * from "./paths.js";
|
||||
export * from "./schema-context.js";
|
||||
export * from "./sql-safety.js";
|
||||
|
||||
Reference in New Issue
Block a user