UNPKG

organ-ai-zer

Version:

AI-powered file organizer CLI tool

258 lines 9.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OrganizationContext = void 0; const conversation_context_1 = require("./conversation-context"); class OrganizationContext extends conversation_context_1.ConversationContext { /** * Constructs an instance of the OrganizationContext service. * * @param subject - The subject or topic of the organization context. * @param files - An array of file information objects to be processed. * @param baseDirectory - The base directory path where files are located. * @param intent - The intent or purpose of the organization context. * @param config - Optional partial configuration for the conversation context. */ constructor(subject, files, baseDirectory, intent, config = {}) { super(subject, config); this.files = files; this.baseDirectory = baseDirectory; this.intent = intent; this.rejectedSuggestions = []; this.approvedPatterns = []; this.discoveredCategories = {}; this.clarifications = []; this.phase = 'analysis'; this.patternHints = []; } /** * Retrieves the list of files associated with the organization context. * * @returns {FileInfo[]} An array of `FileInfo` objects representing the files. */ getFiles() { return this.files; } /** * Sets the list of files for the organization context. * * @param files - An array of `FileInfo` objects representing the files to be set. */ setFiles(files) { this.files = files; } /** * Retrieves the base directory associated with the organization context. * * @returns {string} The base directory path as a string. */ getBaseDirectory() { return this.baseDirectory; } /** * Sets the base directory for the organization context. * * @param baseDirectory - The path to the base directory to be set. */ setBaseDirectory(baseDirectory) { this.baseDirectory = baseDirectory; } /** * Retrieves the current intent associated with the organization context. * * @returns {string} The intent as a string. */ getIntent() { return this.intent; } /** * Sets the intent for the organization context. * * @param intent - A string representing the intent to be set. */ setIntent(intent) { this.intent = intent; } /** * Retrieves the list of rejected organization suggestions. * * @returns {OrganizationSuggestion[]} An array of rejected suggestions. */ getRejectedSuggestions() { return this.rejectedSuggestions; } /** * Updates the list of rejected organization suggestions. * * @param rejectedSuggestions - An array of `OrganizationSuggestion` objects * representing the suggestions that have been rejected. */ setRejectedSuggestions(rejectedSuggestions) { this.rejectedSuggestions = rejectedSuggestions; } /** * Retrieves the list of approved patterns. * * @returns {string[]} An array of strings representing the approved patterns. */ getApprovedPatterns() { return this.approvedPatterns; } /** * Sets the approved patterns for the organization context. * * @param approvedPatterns - An array of strings representing the approved patterns. */ setApprovedPatterns(approvedPatterns) { this.approvedPatterns = approvedPatterns; } /** * Retrieves the discovered categories and their associated file information. * * @returns A record where the keys are category names (strings) and the values are arrays of `FileInfo` objects. */ getDiscoveredCategories() { return this.discoveredCategories; } /** * Updates the discovered categories with the provided data. * * @param discoveredCategories - An object where the keys represent category names * and the values are arrays of `FileInfo` objects associated with each category. */ setDiscoveredCategories(discoveredCategories) { this.discoveredCategories = discoveredCategories; } /** * Retrieves the list of clarifications associated with the organization context. * * @returns {Clarification[]} An array of clarifications. */ getClarifications() { return this.clarifications; } /** * Updates the clarifications for the organization context. * * @param clarifications - An array of `Clarification` objects to set as the current clarifications. */ setClarifications(clarifications) { this.clarifications = clarifications; } /** * Retrieves the current batch information, including its name and associated files. * * @returns An object containing the name of the current batch and an array of file information, * or `undefined` if no batch is currently set. */ getCurrentBatch() { return this.currentBatch; } /** * Sets the current batch for the organization context. * * @param currentBatch - The batch to set as the current batch. * It can either be an object containing a `name` and an array of `FileInfo` objects, * or `undefined` to clear the current batch. */ setCurrentBatch(currentBatch) { this.currentBatch = currentBatch; } /** * Retrieves the current phase of the organization context. * * @returns {'analysis' | 'conversation' | 'organization' | 'complete'} * The current phase, which can be one of the following: * - `'analysis'`: Represents the analysis phase. * - `'conversation'`: Represents the conversation phase. * - `'organization'`: Represents the organization phase. * - `'complete'`: Represents the completion phase. */ getPhase() { return this.phase; } /** * Sets the current phase of the organization context. * * @param phase - The phase to set, which must be one of the following: * - `'analysis'`: Represents the analysis phase. * - `'conversation'`: Represents the conversation phase. * - `'organization'`: Represents the organization phase. * - `'complete'`: Represents the completion phase. */ setPhase(phase) { this.phase = phase; } /** * Retrieves the list of pattern hints associated with the organization context. * * @returns {string[]} An array of strings representing the pattern hints. */ getPatternHints() { return this.patternHints; } /** * Sets the pattern hints for the organization context. * * @param patternHints - An array of strings representing the pattern hints to be set. */ setPatternHints(patternHints) { this.patternHints = patternHints; } /** * Adds new files to the existing list of files in the organization context. * * @param newFiles - An array of `FileInfo` objects representing the new files to be added. * These files will be appended to the current list of files. */ addFiles(newFiles) { this.files = [...this.files, ...newFiles]; } /** * Adds a suggestion to the list of rejected suggestions. * * @param suggestion - The organization suggestion to be marked as rejected. */ addRejectedSuggestion(suggestion) { this.rejectedSuggestions.push(suggestion); } /** * Adds a new pattern to the list of approved patterns. * * @param pattern - The pattern to be added to the approved patterns list. */ addApprovedPattern(pattern) { this.approvedPatterns.push(pattern); } /** * Adds a discovered category along with its associated files to the organization context. * If the category does not already exist, it initializes an empty array for it. * Then, it appends the provided files to the category's file list. * * @param category - The name of the category to add or update. * @param files - An array of file information objects to associate with the category. */ addDiscoveredCategory(category, files) { if (!this.discoveredCategories[category]) { this.discoveredCategories[category] = []; } this.discoveredCategories[category].push(...files); } /** * Adds a clarification to the list of clarifications. * * @param clarification - The clarification object to be added. */ addClarification(clarification) { this.clarifications.push(clarification); } /** * Adds a pattern hint to the list of pattern hints. * * @param hint - The pattern hint to be added. */ addPatternHint(hint) { this.patternHints.push(hint); } } exports.OrganizationContext = OrganizationContext; //# sourceMappingURL=organization-context.js.map