Skip to content

BrainAPI is a knowledge graph–powered AI memory layer that transforms unstructured data into structured knowledge, enabling intelligent search, recommendations, and contextual memory for AI agents and applications.

fix(tui): update cmd throwing git errors

Christian3f16bb69f23c
diff --git a/tui/src/commands/update.ts b/tui/src/commands/update.ts
index 081ecae..0377137 100644
--- a/tui/src/commands/update.ts
+++ b/tui/src/commands/update.ts
@@ -51,12 +51,12 @@ export async function runUpdate(): Promise<void> {
const branch = state.branch || "main";
const spinner = p.spinner();
- spinner.start(`git pull origin ${branch} in ${sourcePath()}`);
+ spinner.start(`Updating source from origin/${branch} in ${sourcePath()}`);
try {
await pullRepo(branch);
- spinner.stop("Repository updated");
+ spinner.stop("Source updated");
} catch (err) {
- spinner.stop(pc.red("git pull failed"));
+ spinner.stop(pc.red("Source update failed"));
throw err;
}
diff --git a/tui/src/index.ts b/tui/src/index.ts
index 18d18e3..092313c 100644
--- a/tui/src/index.ts
+++ b/tui/src/index.ts
@@ -103,7 +103,7 @@ function printHelp(): void {
" start [...] Start backing services + API + MCP + celery worker (Ctrl-C to stop all)",
" config Re-run the interactive flow and rewrite .env",
" doctor Check Python, Docker, Ollama, GCP credentials, services",
- " update git pull + reinstall Python dependencies",
+ " update Fetch latest source + reinstall Python dependencies",
" help Show this message",
"",
pc.bold("Options:"),
diff --git a/tui/src/lib/git.ts b/tui/src/lib/git.ts
index e378582..b7f8e1c 100644
--- a/tui/src/lib/git.ts
+++ b/tui/src/lib/git.ts
@@ -38,9 +38,11 @@ export async function cloneRepo(opts: CloneOptions): Promise<void> {
export async function pullRepo(branch: string): Promise<void> {
const git = simpleGit(sourcePath());
+ const remoteRef = `origin/${branch}`;
await git.fetch("origin", branch);
- await git.checkout(branch);
- await git.pull("origin", branch, { "--ff-only": null });
+ await git.clean("f", ["-d", "-e", ".env", "-e", ".venv"]);
+ await git.checkout(["-B", branch, "-f"]);
+ await git.reset(["--hard", remoteRef]);
}
export async function ensureRepo(opts: CloneOptions): Promise<"cloned" | "pulled"> {