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.

Merge origin/main into fix/221-windows-cli-detection

Martin Vogelfaa0a2fcb2ad
diff --cc src/cli/cli.c
index d8e91e7a0,1ebe1687e..7d3e7c925
--- a/src/cli/cli.c
+++ b/src/cli/cli.c
@@@ -22,8 -23,8 +23,9 @@@
#include "foundation/platform.h"
#include "foundation/constants.h"
#include "foundation/log.h"
+#include "foundation/mem_core.h"
#include "foundation/sha256.h"
+ #include "foundation/str_util.h"
#include "cli/client_adapter.h"
#include "mcp/mcp.h" // cbm_mcp_tool_input_schema — CLI flag parser + per-tool --help
#include "mcp/index_supervisor.h"
diff --cc src/foundation/platform.h
index 52e01dc46,806e49a09..aa3536b96
--- a/src/foundation/platform.h
+++ b/src/foundation/platform.h
@@@ -138,19 -138,15 +138,28 @@@ int cbm_default_worker_count(bool initi
* Returns NULL when the variable is unset and fallback is NULL. */
const char *cbm_safe_getenv(const char *name, char *buf, size_t buf_sz, const char *fallback);
+ /* Startup-only installation of an immutable settings resolver. A true return
+ * means handled, including a NULL value that deliberately masks a presence
+ * flag. This does not mutate the process environment or child inheritance. */
+ typedef bool (*cbm_environment_resolver_t)(const char *name, const char **value);
+ void cbm_set_environment_resolver(cbm_environment_resolver_t resolver);
+ const char *cbm_runtime_getenv(const char *name);
+ /* Explicit inherited environment access for bootstrap/settings provenance. */
+ const char *cbm_native_getenv(const char *name, char *buf, size_t buf_sz, const char *fallback);
+
+/* Allocating sibling of cbm_safe_getenv, for a value that must not be capped at
+ * a caller-chosen size. A Windows PATH routinely runs past the 4096-byte buffer
+ * cbm_safe_getenv's callers pass, and the copy helper REPORTS that as failure
+ * rather than truncating -- so the whole PATH was skipped and every directory
+ * past the cut became invisible (#221).
+ *
+ * Returns a UTF-8 copy owned by the memory core: release it with
+ * cbm_free(CBM_MEM_CLASS_OTHER, ptr), never free(). NULL when the variable is
+ * unset or cannot be read; a variable that exists but is empty yields "".
+ * On Windows the value is read with the wide API and converted, the same route
+ * cbm_safe_getenv takes, so a non-ASCII value survives intact. */
+char *cbm_env_dup(const char *name);
+
/* Read an environment variable as a whole number.
*
* Answers true only when the variable is set, is not empty, and reads cleanly