feat: native gbrain code-surface orchestrator + ensureSourceRegistered helper

Replaces gbrain import (markdown only) with gbrain sources add + sync
--strategy code (or reindex-code on --full). Adds lib/gbrain-sources.ts
exporting ensureSourceRegistered/probeSource/sourcePageCount, plus lock
file + tmp-rename atomicity + dry-run write skip in the orchestrator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-05-03 20:42:28 -07:00
parent bf65487162
commit fed5b91e4e
5 changed files with 780 additions and 75 deletions

View File

@@ -183,7 +183,10 @@ describe("V1 /gbrain-sync orchestrator E2E", () => {
const r = runBun(SYNC, ["--dry-run"], env);
expect(r.exitCode).toBe(0);
expect(r.stdout).toContain("would: gbrain import");
// Code stage uses native gbrain code surfaces (sources add + sync --strategy code)
// post-codex review; NOT `gbrain import` (markdown-only path).
expect(r.stdout).toContain("would: gbrain sources add");
expect(r.stdout).toContain("gbrain sync --strategy code");
expect(r.stdout).toContain("would: gstack-memory-ingest");
expect(r.stdout).toContain("would: gstack-brain-sync");