Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(ui): warn on stderr when --ui requested without embedded UI (#350)

Martin Vogel6657044026bb
diff --git a/src/main.c b/src/main.c
index 5a1c61735..d413d9dd7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -302,11 +302,14 @@ static int handle_subcommand(int argc, char **argv) {
}
/* Parse --ui= and --port= flags. Returns true if config was modified. */
-static bool parse_ui_flags(int argc, char **argv, cbm_ui_config_t *cfg) {
+static bool parse_ui_flags(int argc, char **argv, cbm_ui_config_t *cfg, bool *explicit_enable) {
bool changed = false;
for (int i = SKIP_ONE; i < argc; i++) {
if (strncmp(argv[i], "--ui=", SLEN("--ui=")) == 0) {
cfg->ui_enabled = (strcmp(argv[i] + MAIN_FLAG_OFF, "true") == 0);
+ if (explicit_enable && cfg->ui_enabled) {
+ *explicit_enable = true;
+ }
changed = true;
}
if (strncmp(argv[i], "--port=", SLEN("--port=")) == 0) {
@@ -355,9 +358,22 @@ int main(int argc, char **argv) {
/* Parse --ui and --port flags (persisted config) */
cbm_ui_config_t ui_cfg;
cbm_ui_config_load(&ui_cfg);
- if (parse_ui_flags(argc, argv, &ui_cfg)) {
+ bool explicit_ui_enable = false;
+ if (parse_ui_flags(argc, argv, &ui_cfg, &explicit_ui_enable)) {
cbm_ui_config_save(&ui_cfg);
}
+ /* If the user explicitly asked for the UI but this binary has no embedded
+ * frontend, the HTTP server can never start (see below). The warning that
+ * covers this goes to the log sink, which a user running `--ui=true` on a
+ * terminal won't see — so tell them plainly on stderr why nothing happens
+ * and which build to use (#350). */
+ if (explicit_ui_enable && CBM_EMBEDDED_FILE_COUNT == 0) {
+ (void)fprintf(stderr,
+ "codebase-memory-mcp: --ui requested, but this binary was built without the "
+ "embedded UI, so the HTTP server will not start.\n"
+ "Use the UI release asset (codebase-memory-mcp-ui) or rebuild with: "
+ "make -f Makefile.cbm cbm-with-ui\n");
+ }
setup_signal_handlers();