UNPKG

@kya-os/cli

Version:

CLI for MCP-I setup and management

52 lines 2.22 kB
import chalk from "chalk"; function statusLabel(status) { switch (status) { case "done": return chalk.green("done"); case "skipped": return chalk.gray("skipped"); case "would-change": return chalk.cyan("would change"); case "action-required": return chalk.yellow("action required"); case "failed": return chalk.red("failed"); } } /** Human-readable summary of a setup run, shared by `mcpi dco setup` and the register/init funnel. */ export function renderSetupResult(result) { console.log(""); if (result.agent) { console.log(` ${chalk.bold("Agent:")} ${result.agent.name} ${chalk.gray(`(${result.agent.did})`)}`); } if (result.human) { console.log(` ${chalk.bold("Human:")} ${result.human.name} ${chalk.gray(`<${result.human.email}>`)}`); } console.log(""); const width = Math.max(...result.steps.map((s) => s.title.length)); for (const step of result.steps) { console.log(` ${step.title.padEnd(width)} ${statusLabel(step.status)}`); if (step.detail && step.status !== "done" && step.status !== "skipped") { console.log(` ${" ".repeat(width)} ${chalk.gray(step.detail)}`); } } console.log(""); if (result.metadataPersistWarning) { console.log(chalk.yellow(` Note: could not cache agent metadata to .mcpi/agent.json (${result.metadataPersistWarning}); a later non-interactive run may prompt again.`)); } const dryRun = result.steps.some((s) => s.status === "would-change"); if (!result.ok) { console.log(chalk.red(" Setup finished with failures. See details above.")); } else if (dryRun) { console.log(chalk.cyan(" Dry run: nothing was written. Re-run without --dry-run to apply.")); } else if (result.actionRequired) { console.log(chalk.yellow(" Setup finished, but some steps need your action. See details above.")); } else if (result.agent) { console.log(chalk.green(` Commits are now signed with your agent's identity key and attributed to ${result.agent.name}.`)); } console.log(""); } //# sourceMappingURL=render.js.map