sync_push
Push local knowledge graph data to GitHub repositories for remote storage and collaboration. This tool synchronizes memory entities, relationships, and observations with version control.
Instructions
로컬 데이터를 GitHub로 푸시합니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commitMessage | No | 커밋 메시지 (선택사항) |
Implementation Reference
- src/index.ts:682-695 (handler)Main handler for 'sync_push' tool: extracts commit message, calls syncManager.pushToRemote, and returns formatted 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 ListToolsRequestSchema handler, including name, description, and input schema.{ name: 'sync_push', description: '로컬 데이터를 GitHub로 푸시합니다', inputSchema: { type: 'object', properties: { commitMessage: { type: 'string', description: '커밋 메시지 (선택사항)' } }, }, },
- src/sync-manager.ts:69-117 (helper)Core implementation of pushing local memory graph to GitHub: serializes data, handles empty graph, fetches existing SHA, calls githubClient.putFile, updates 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', }; } }