@ankimcp/anki-mcp-server
Version:
Model Context Protocol server for Anki - enables AI assistants to interact with your Anki flashcards
74 lines • 2.46 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.success = success;
exports.warn = warn;
exports.info = info;
exports.blank = blank;
exports.box = box;
exports.formatBanner = formatBanner;
exports.dim = dim;
exports.error = error;
exports.createCli = createCli;
const version_1 = require("../version.js");
const colors = {
reset: "\x1b[0m",
green: "\x1b[32m",
red: "\x1b[31m",
yellow: "\x1b[33m",
cyan: "\x1b[36m",
dim: "\x1b[2m",
};
function success(message) {
console.log(`${colors.green}✓${colors.reset} ${message}`);
}
function warn(message) {
console.warn(`${colors.yellow}!${colors.reset} ${message}`);
}
function info(message) {
console.log(message);
}
function blank() {
console.log();
}
function box(title, content) {
const width = Math.max(title.length, content.length) + 4;
const border = "─".repeat(width);
console.log(`┌${border}┐`);
console.log(`│ ${title.padEnd(width - 2)} │`);
console.log(`├${border}┤`);
console.log(`│ ${content.padEnd(width - 2)} │`);
console.log(`└${border}┘`);
}
function formatBanner(label) {
const version = (0, version_1.getVersion)();
const title = `AnkiMCP ${label} Server v${version}`;
const innerWidth = 64;
const padding = Math.floor((innerWidth - title.length) / 2);
const paddedTitle = " ".repeat(padding) +
title +
" ".repeat(innerWidth - padding - title.length);
return `╔════════════════════════════════════════════════════════════════╗
║${paddedTitle}║
╚════════════════════════════════════════════════════════════════╝`;
}
function dim(message) {
console.log(`${colors.dim}${message}${colors.reset}`);
}
function error(message, err, debug = false) {
console.error(`${colors.red}✗${colors.reset} ${message}`);
if (err && debug && err.stack) {
console.error(`${colors.dim}${err.stack}${colors.reset}`);
}
}
function createCli(debug) {
return {
success,
warn,
info,
blank,
box,
dim,
error: (message, err) => error(message, err, debug),
};
}
//# sourceMappingURL=cli-output.js.map