MCPcopy Index your code
hub / github.com/garrytan/gstack / gbrainAvailable

Function gbrainAvailable

bin/gstack-memory-ingest.ts:811–827  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

809
810let _gbrainAvailability: boolean | null = null;
811function gbrainAvailable(): boolean {
812 if (_gbrainAvailability !== null) return _gbrainAvailability;
813 try {
814 // Probe `--help` for the `import` subcommand. gbrain v0.20.0+ ships
815 // `import <dir>` (batch markdown import via path-authoritative slugs).
816 // If absent, we surface a single clean error here rather than failing
817 // the whole stage with a confusing usage message from gbrain itself.
818 // `gbrain --help` probes only CLI availability, not DB connectivity, so
819 // it doesn't strictly need DATABASE_URL. But routing through the helper
820 // keeps the invariant test from chasing exceptions per call site.
821 const help = execGbrainText(["--help"], { timeout: 5000 });
822 _gbrainAvailability = /^\s+import\s/m.test(help);
823 } catch {
824 _gbrainAvailability = false;
825 }
826 return _gbrainAvailability;
827}
828
829/**
830 * Build the markdown body with YAML frontmatter (title/type/tags) injected.

Callers 1

ingestPassFunction · 0.70

Calls 1

execGbrainTextFunction · 0.90

Tested by

no test coverage detected