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

Function gpf_deploys

tests/test_grammar_probe_f.c:1805–1830  ·  view source on GitHub ↗

Every DEPLOYS edge as "source -> target (via)", sorted, one per line: a * function by name, top-level code as "@ "; a File or Kustomization by * its path, a Chart by name ("(ext)": the external one). NULL on failure; * the caller frees. */

Source from the content-addressed store, hash-verified

1803 * its path, a Chart by name ("(ext)": the external one). NULL on failure;
1804 * the caller frees. */
1805static char *gpf_deploys(const GpfFile *files, int nfiles) {
1806 GpfProj lp;
1807 cbm_store_t *store = gpf_index_files(&lp, files, nfiles);
1808 char *out = NULL;
1809 if (store) {
1810 sqlite3_stmt *st = NULL;
1811 const char *sql =
1812 "SELECT coalesce(group_concat(x, char(10)), '') FROM (SELECT "
1813 "CASE WHEN s.label IN ('Module','File') THEN '@' || s.file_path ELSE s.name END "
1814 "|| ' -> ' || CASE WHEN t.label='Chart' THEN 'chart:' || t.name || "
1815 "CASE WHEN json_extract(t.properties,'$.external') THEN '(ext)' ELSE '' END "
1816 "ELSE t.label || ':' || t.file_path END "
1817 "|| ' (' || json_extract(e.properties,'$.via') || ')' AS x "
1818 "FROM edges e JOIN nodes s ON s.id=e.source_id JOIN nodes t ON t.id=e.target_id "
1819 "WHERE e.project=?1 AND e.type='DEPLOYS' ORDER BY x)";
1820 if (sqlite3_prepare_v2(cbm_store_get_db(store), sql, -1, &st, NULL) == SQLITE_OK) {
1821 sqlite3_bind_text(st, 1, lp.project, -1, SQLITE_STATIC);
1822 if (sqlite3_step(st) == SQLITE_ROW) {
1823 out = strdup((const char *)sqlite3_column_text(st, 0));
1824 }
1825 }
1826 sqlite3_finalize(st);
1827 }
1828 gpf_cleanup(&lp, store);
1829 return out;
1830}
1831
1832#define GPF_ASSERT_DEPLOYS(files, n, want) \
1833 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