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.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
Fix Windows file URI path parsing in watcher
Martin Vogelf7574a3622ea
diff --git a/internal/tools/tools.go b/internal/tools/tools.goindex eeaf9a80c..6fe6c535f 100644--- a/internal/tools/tools.go+++ b/internal/tools/tools.go@@ -9,6 +9,7 @@ import ("net/http""net/url""os"+ "path/filepath""sort""strconv""strings"@@ -24,7 +25,7 @@ import ()// Version is the current release version, referenced by MCP handshake and update checker.-const Version = "0.4.0"+const Version = "0.4.3"// releaseURL is the GitHub API endpoint for latest release. Package-level var for test injection.var releaseURL = "https://api.github.com/repos/DeusData/codebase-memory-mcp/releases/latest"@@ -180,7 +181,12 @@ func parseFileURI(uri string) (string, bool) {if err != nil || u.Scheme != "file" {return "", false}- return u.Path, true+ path := u.Path+ // On Windows, file:///C:/path parses to /C:/path — strip leading / before drive letter+ if len(path) >= 3 && path[0] == '/' && path[2] == ':' {+ path = path[1:]+ }+ return filepath.FromSlash(path), true}// startAutoIndex triggers background indexing for the session project.diff --git a/internal/tools/tools_test.go b/internal/tools/tools_test.gonew file mode 100644index 000000000..b9e1a3aa9--- /dev/null+++ b/internal/tools/tools_test.go@@ -0,0 +1,65 @@+package tools++import (+ "runtime"+ "testing"+)++func TestParseFileURI(t *testing.T) {+ tests := []struct {+ uri string+ wantPath string+ wantOK bool+ }{+ // Unix paths+ {"file:///home/user/project", "/home/user/project", true},+ {"file:///tmp/test", "/tmp/test", true},++ // Windows paths — url.Parse returns /C:/path, must strip leading /+ {"file:///C:/Users/project", "C:/Users/project", true},+ {"file:///D:/Projects/myapp", "D:/Projects/myapp", true},++ // Non-file schemes+ {"https://example.com", "", false},+ {"", "", false},++ // Edge cases+ {"file:///", "/", true},+ }++ for _, tt := range tests {+ t.Run(tt.uri, func(t *testing.T) {+ got, ok := parseFileURI(tt.uri)+ if ok != tt.wantOK {+ t.Fatalf("parseFileURI(%q) ok=%v, want %v", tt.uri, ok, tt.wantOK)+ }+ if !ok {+ return+ }++ want := tt.wantPath+ // On Windows, filepath.FromSlash converts / to \+ if runtime.GOOS == "windows" {+ // paths will use backslashes+ want = windowsPath(want)+ }++ if got != want {+ t.Errorf("parseFileURI(%q) = %q, want %q", tt.uri, got, want)+ }+ })+ }+}++// windowsPath converts forward slashes to backslashes for Windows comparison.+func windowsPath(p string) string {+ result := make([]byte, len(p))+ for i := 0; i < len(p); i++ {+ if p[i] == '/' {+ result[i] = '\\'+ } else {+ result[i] = p[i]+ }+ }+ return string(result)+}