UNPKG

ai-code-writer

Version:

An AI code writer application using OpenAI APIs for audio transcription and chat completion.

35 lines (34 loc) 1.85 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const CommandWords_1 = __importDefault(require("../CommandWords")); const FileActionEntity_1 = __importDefault(require("../../FileActionEntity")); const FileActionType_1 = __importDefault(require("../../FileActionType")); class FileMoveCommand { canHandle(command) { return command.startsWith(CommandWords_1.default.FILE_MOVE); } handle(section) { return __awaiter(this, void 0, void 0, function* () { const commandLine = String(section.shift()); const [source, destination] = commandLine.slice(CommandWords_1.default.FILE_MOVE.length).trim().split(/\s+/); const fileAction = new FileActionEntity_1.default(); fileAction.actionType = FileActionType_1.default.MOVE; fileAction.filePath = source; fileAction.targetFilePath = destination; return { comments: [], actions: [fileAction] }; }); } } exports.default = FileMoveCommand;