sync_push
Push local knowledge graph data to GitHub for remote storage and collaboration, with optional commit messages.
Instructions
로컬 데이터를 GitHub로 푸시합니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commitMessage | No | 커밋 메시지 (선택사항) |
Implementation Reference
- src/index.ts:682-695 (handler)MCP tool handler for 'sync_push'. Extracts optional commitMessage from args, delegates to SyncManager.pushToRemote(), and returns the result wrapped in a text content response.private async handleSyncPush(args: any) { const commitMessage = args.commitMessage || undefined; const result = await this.syncManager.pushToRemote(commitMessage); return { content: [{ type: 'text', text: JSON.stringify({ operation: 'sync_push', ...result, }, null, 2), }], }; }
- src/index.ts:325-337 (registration)Tool registration in ListTools response, including name, description, and inputSchema defining optional 'commitMessage' parameter.{ name: 'sync_push', description: '로컬 데이터를 GitHub로 푸시합니다', inputSchema: { type: 'object', properties: { commitMessage: { type: 'string', description: '커밋 메시지 (선택사항)' } }, }, },
- src/sync-manager.ts:69-117 (helper)Core helper function implementing the push operation: serializes local memory graph, handles empty graph skip, fetches existing SHA for update, calls GitHubClient.putFile with custom or default commit message, updates local metadata.async pushToRemote(commitMessage?: string): Promise<SyncResult> { try { const localData = this.memoryManager.toJSON(); // 빈 그래프는 푸시하지 않음 (초기 상태 방지) if (Object.keys(localData.entities || {}).length === 0 && (!localData.relations || localData.relations.length === 0)) { return { success: true, conflictResolved: false, lastSync: new Date().toISOString(), }; } const content = JSON.stringify(localData, null, 2); // 현재 파일의 SHA 가져오기 (업데이트용) const existingFile = await this.githubClient.getFile(this.MEMORY_FILE_PATH); const defaultMessage = `Update memory graph - ${new Date().toISOString()}`; await this.githubClient.putFile( { path: this.MEMORY_FILE_PATH, content, sha: existingFile?.sha, }, commitMessage || defaultMessage ); // 메타데이터 업데이트 const graph = this.memoryManager.getGraph(); graph.metadata.lastSync = new Date().toISOString(); this.memoryManager.loadGraph(graph); return { success: true, conflictResolved: false, lastSync: new Date().toISOString(), }; } catch (error) { return { success: false, conflictResolved: false, lastSync: new Date().toISOString(), error: error instanceof Error ? error.message : 'Unknown error', }; } }