Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1#!/usr/bin/env node2 3/**4 * @fileoverview Main CLI that is run via the eslint command.5 * @author Nicholas C. Zakas6 */7 8/* eslint no-console:off -- CLI */9 10"use strict";11 12const mod = require("node:module");13 14// to use V8's code cache to speed up instantiation time15mod.enableCompileCache?.();16 17// must do this initialization *before* other requires in order to work18if (process.argv.includes("--debug")) {19 require("debug").enable("eslint:*,-eslint:code-path,eslintrc:*");20}21 22//------------------------------------------------------------------------------23// Helpers24//------------------------------------------------------------------------------25 26/**27 * Read data from stdin til the end.28 *29 * Note: See30 * - https://github.com/nodejs/node/blob/master/doc/api/process.md#processstdin31 * - https://github.com/nodejs/node/blob/master/doc/api/process.md#a-note-on-process-io32 * - https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-01/msg00419.html33 * - https://github.com/nodejs/node/issues/7439 (historical)34 *35 * On Windows using `fs.readFileSync(STDIN_FILE_DESCRIPTOR, "utf8")` seems36 * to read 4096 bytes before blocking and never drains to read further data.37 *38 * The investigation on the Emacs thread indicates:39 *40 * > Emacs on MS-Windows uses pipes to communicate with subprocesses; a41 * > pipe on Windows has a 4K buffer. So as soon as Emacs writes more than42 * > 4096 bytes to the pipe, the pipe becomes full, and Emacs then waits for43 * > the subprocess to read its end of the pipe, at which time Emacs will44 * > write the rest of the stuff.45 * @returns {Promise<string>} The read text.46 */47function readStdin() {48 return new Promise((resolve, reject) => {49 let content = "";50 let chunk = "";51 52 process.stdin53 .setEncoding("utf8")54 .on("readable", () => {55 while ((chunk = process.stdin.read()) !== null) {56 content += chunk;57 }58 })59 .on("end", () => resolve(content))60 .on("error", reject);61 });62}63 64/**65 * Get the error message of a given value.66 * @param {any} error The value to get.67 * @returns {string} The error message.68 */69function getErrorMessage(error) {70 // Lazy loading because this is used only if an error happened.71 const util = require("node:util");72 73 // Foolproof -- third-party module might throw non-object.74 if (typeof error !== "object" || error === null) {75 return String(error);76 }77 78 // Use templates if `error.messageTemplate` is present.79 if (typeof error.messageTemplate === "string") {80 try {81 const template = require(`../messages/${error.messageTemplate}.js`);82 83 return template(error.messageData || {});84 } catch {85 // Ignore template error then fallback to use `error.stack`.86 }87 }88 89 // Use the stacktrace if it's an error object.90 if (typeof error.stack === "string") {91 return error.stack;92 }93 94 // Otherwise, dump the object.95 return util.format("%o", error);96}97 98/**99 * Tracks error messages that are shown to the user so we only ever show the100 * same message once.101 * @type {Set<string>}102 */103const displayedErrors = new Set();104 105/**106 * Tracks whether an unexpected error was caught107 * @type {boolean}108 */109let hadFatalError = false;110 111/**112 * Catch and report unexpected error.113 * @param {any} error The thrown error object.114 * @returns {void}115 */116function onFatalError(error) {117 process.exitCode = 2;118 hadFatalError = true;119 120 const { version } = require("../package.json");121 const message = `122Oops! Something went wrong! :(123 124ESLint: ${version}125 126${getErrorMessage(error)}`;127 128 if (!displayedErrors.has(message)) {129 console.error(message);130 displayedErrors.add(message);131 }132}133 134//------------------------------------------------------------------------------135// Execution136//------------------------------------------------------------------------------137 138(async function main() {139 process.on("uncaughtException", onFatalError);140 process.on("unhandledRejection", onFatalError);141 142 // Call the config initializer if `--init` is present.143 if (process.argv.includes("--init")) {144 // `eslint --init` has been moved to `@eslint/create-config`145 console.warn(146 "You can also run this command directly using 'npm init @eslint/config@latest'.",147 );148 149 const spawn = require("cross-spawn");150 151 spawn.sync("npm", ["init", "@eslint/config@latest"], {152 encoding: "utf8",153 stdio: "inherit",154 });155 return;156 }157 158 // start the MCP server if `--mcp` is present159 if (process.argv.includes("--mcp")) {160 console.warn(161 "You can also run this command directly using 'npx @eslint/mcp@latest'.",162 );163 164 const spawn = require("cross-spawn");165 166 spawn.sync("npx", ["@eslint/mcp@latest"], {167 encoding: "utf8",168 stdio: "inherit",169 });170 return;171 }172 173 // Otherwise, call the CLI.174 const cli = require("../lib/cli");175 const exitCode = await cli.execute(176 process.argv,177 process.argv.includes("--stdin") ? await readStdin() : null,178 true,179 );180 181 /*182 * If an uncaught exception or unhandled rejection was detected in the meantime,183 * keep the fatal exit code 2 that is already assigned to `process.exitCode`.184 * Without this condition, exit code 2 (unsuccessful execution) could be overwritten with185 * 1 (successful execution, lint problems found) or even 0 (successful execution, no lint problems found).186 * This ensures that unexpected errors that seemingly don't affect the success187 * of the execution will still cause a non-zero exit code, as it's a common188 * practice and the default behavior of Node.js to exit with non-zero189 * in case of an uncaught exception or unhandled rejection.190 *191 * Otherwise, assign the exit code returned from CLI.192 */193 if (!hadFatalError) {194 process.exitCode = exitCode;195 }196})().catch(onFatalError);197 