MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / gpf_spawns

Function gpf_spawns

tests/test_grammar_probe_f.c:1845–1868  ·  view source on GitHub ↗

Every SPAWNS edge a script or recipe draws (api=shell) as "source -> * program", sorted, one per line; top-level code as "@ ". */

Source from the content-addressed store, hash-verified

1843/* Every SPAWNS edge a script or recipe draws (api=shell) as "source ->
1844 * program", sorted, one per line; top-level code as "@<file>". */
1845static char *gpf_spawns(const GpfFile *files, int nfiles) {
1846 GpfProj lp;
1847 cbm_store_t *store = gpf_index_files(&lp, files, nfiles);
1848 char *out = NULL;
1849 if (store) {
1850 sqlite3_stmt *st = NULL;
1851 const char *sql =
1852 "SELECT coalesce(group_concat(x, char(10)), '') FROM (SELECT DISTINCT "
1853 "CASE WHEN s.label IN ('Module','File') THEN '@' || s.file_path ELSE s.name END "
1854 "|| ' -> ' || t.name AS x "
1855 "FROM edges e JOIN nodes s ON s.id=e.source_id JOIN nodes t ON t.id=e.target_id "
1856 "WHERE e.project=?1 AND e.type='SPAWNS' AND t.label='Process' "
1857 "AND json_extract(e.properties,'$.api')='shell' ORDER BY x)";
1858 if (sqlite3_prepare_v2(cbm_store_get_db(store), sql, -1, &st, NULL) == SQLITE_OK) {
1859 sqlite3_bind_text(st, 1, lp.project, -1, SQLITE_STATIC);
1860 if (sqlite3_step(st) == SQLITE_ROW) {
1861 out = strdup((const char *)sqlite3_column_text(st, 0));
1862 }
1863 }
1864 sqlite3_finalize(st);
1865 }
1866 gpf_cleanup(&lp, store);
1867 return out;
1868}
1869
1870#define GPF_ASSERT_SPAWNS(files, n, want) \
1871 do { \

Callers

nothing calls this directly

Calls 3

gpf_index_filesFunction · 0.85
cbm_store_get_dbFunction · 0.85
gpf_cleanupFunction · 0.85

Tested by

no test coverage detected