ki-brain / src /github.h
Arian8888's picture
GitHub als Source of Truth: Pull beim Start + Auto-Commit bei jedem Write
df43f32
Raw History Blame Contribute Delete
901 Bytes
// GitHub-Sync via REST API.
// Speichert Topics und Konversationen in einem GitHub-Repo.
// Token + Repo werden aus Env-Variablen gelesen (GITHUB_TOKEN, GITHUB_REPO).
#pragma once
#include <string>
#include <vector>
namespace gh {
void init(); // liest GITHUB_TOKEN + GITHUB_REPO env
bool enabled(); // true wenn Token + Repo gesetzt
// Datei erstellen/updaten im Repo.
// path: z.B. "topics/quantencomputer.md"
bool put_file(const std::string& path,
const std::string& content,
const std::string& commit_msg);
// Datei-Inhalt holen (leer wenn nicht gefunden).
std::string get_file(const std::string& path);
// Listet rekursiv alle Files+Folders unter "brain/" auf GitHub.
struct RemoteEntry { std::string path; std::string content; int is_dir; };
std::vector<RemoteEntry> pull_brain();
} // namespace gh