@dollhousemcp/mcp-server
Version:
DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.
148 lines • 4.06 kB
TypeScript
/**
* PortfolioSyncManager - Handles synchronization between local and GitHub portfolios
*
* Features:
* - Download elements from GitHub portfolio
* - Upload elements with consent
* - Version comparison and diff viewing
* - Privacy-first with explicit permissions
* - Conflict resolution strategies
* - Bulk operations with configuration checks
*/
import { ConfigManager } from '../config/ConfigManager.js';
import { PortfolioManager } from './PortfolioManager.js';
import { PortfolioRepoManager } from './PortfolioRepoManager.js';
import { GitHubPortfolioIndexer } from './GitHubPortfolioIndexer.js';
import { TokenManager } from '../security/tokenManager.js';
import { ElementType } from './types.js';
import { IFileOperationsService } from '../services/FileOperationsService.js';
export interface SyncOperation {
operation: 'download' | 'upload' | 'compare' | 'list-remote';
element_name?: string;
element_type?: ElementType;
bulk?: boolean;
version?: string;
show_diff?: boolean;
force?: boolean;
confirm?: boolean;
}
export interface SyncResult {
success: boolean;
message: string;
data?: any;
elements?: SyncElementInfo[];
conflicts?: ConflictInfo[];
}
export interface SyncElementInfo {
name: string;
type: ElementType;
localVersion?: string;
remoteVersion?: string;
status: 'new' | 'updated' | 'conflict' | 'unchanged' | 'local-only';
action?: 'download' | 'upload' | 'skip';
}
export interface ConflictInfo {
element: string;
type: ElementType;
localVersion: string;
remoteVersion: string;
localModified: Date;
remoteModified: Date;
resolution?: 'local' | 'remote' | 'manual';
}
export interface VersionInfo {
version: string;
timestamp: Date;
author: string;
hash: string;
size: number;
source: 'local' | 'remote';
}
export interface ElementDiff {
element: string;
type: ElementType;
changes: {
metadata?: {
field: string;
oldValue: any;
newValue: any;
}[];
content?: {
additions: number;
deletions: number;
diff: string;
};
};
}
export interface PortfolioSyncManagerDependencies {
configManager: ConfigManager;
portfolioManager: PortfolioManager;
portfolioRepoManager: PortfolioRepoManager;
indexer: GitHubPortfolioIndexer;
fileOperations: IFileOperationsService;
tokenManager: TokenManager;
}
export declare class PortfolioSyncManager {
private configManager;
private portfolioManager;
private repoManager;
private indexer;
private fileOperations;
private tokenManager;
constructor(dependencies: PortfolioSyncManagerDependencies);
/**
* Main handler for sync operations
*/
handleSyncOperation(params: SyncOperation): Promise<SyncResult>;
/**
* Check if bulk operation is allowed
*/
private isBulkOperationAllowed;
/**
* List elements available in GitHub portfolio
*/
private listRemoteElements;
/**
* Download a specific element from GitHub
*/
private downloadElement;
/**
* Upload a specific element to GitHub
*/
private uploadElement;
/**
* Compare local and remote versions
*/
private compareVersions;
/**
* Bulk download elements
*/
private bulkDownload;
/**
* Bulk upload elements
*/
private bulkUpload;
/**
* Generate diff between two content versions
*/
private generateDiff;
/**
* Build conflict metadata for UX/logging
*/
private buildConflictInfo;
private extractMetadata;
/**
* Find a fuzzy match for an element name
*/
private findFuzzyMatch;
/**
* Get suggestions for similar element names
*/
private getSuggestions;
/**
* Calculate similarity between two strings
* Returns a score between 0 and 1
*/
private calculateSimilarity;
}
//# sourceMappingURL=PortfolioSyncManager.d.ts.map