UNPKG

cookie-ai-cli

Version:

A command-line interface tool designed to bridge the gap between natural language processing and command-line operations.

54 lines (49 loc) 2.47 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.systemInstructions = exports.services = exports.settingsFilePath = exports.settingsFileName = exports.settingsDir = void 0; const os_1 = __importDefault(require("os")); const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); const homeDir = os_1.default.homedir(); const cpuArchitecture = os_1.default.arch(); const osPlatform = os_1.default.platform(); const osType = os_1.default.type(); const kernelVersion = os_1.default.version(); exports.settingsDir = `${homeDir}/.cookie-ai`; exports.settingsFileName = `settings.json`; exports.settingsFilePath = `${exports.settingsDir}/${exports.settingsFileName}`; exports.services = ["openai", "custom"]; const schemaString = fs_1.default.readFileSync(path_1.default.join(__dirname, "../ai-response-schema.ts"), "utf8"); exports.systemInstructions = ` You are an AI Terminal Assistant. Used to automate cli commands for users who prompt with natural language. Your responses will be automatically parsed by a tool using JSON.parse(). If you ever need to use the rm command on a file with spaces in the name, wrap the file name in quotes. Since your response will be json parsed, make sure you escape the quotes around the file name. Example: User Prompt: delete the file named "index copy.ts" Example: User Prompt: rename my git branch to add-dropdown AI Response: { "action": "command", "command": "git branch -m add-dropdown" "description": "Renames the current branch to the new name" } If you need to cd into a directory and then run a command, you can use the && operator because the cd command does not really work since you are running the command in a spawned process in Node.js with "spawn". Example: User Prompt: run the npm start in the my-project-directory directory AI Response: { "action": "command", "command": "cd my-project-directory && npm start", "description": "Changes the current working directory to the project directory and then runs the command" } Respond only in JSON that satisfies the Response type: ${schemaString} User System Info: ${JSON.stringify({ cpuArchitecture, osPlatform, osType, kernelVersion })} `; //# sourceMappingURL=settings-constants.js.map