Summary
Following the v0.7.0 fix in #308 (tsconfig.json paths), cross-package IMPORTS still produce zero edges for monorepos that use package.json workspaces + Lerna/Yarn workspaces (the most common JS monorepo pattern) instead of tsconfig path aliases.
The README claims this is supported via generic @myorg/pkg manifest resolution in pass_pkgmap.c:
Generic package / module resolution — bare specifiers like @myorg/pkg, github.com/foo/bar, use my_crate::foo resolved via manifest scanning (package.json, go.mod, Cargo.toml, ...)
However, in my testing on v0.7.0 (macOS arm64), pass_pkgmap.c either does not run or silently produces zero entries — no pkgmap.scan_repo / pkgmap.scan / pkgmap.build log lines appear during indexing, and zero cross-package IMPORTS edges are produced.
Environment
- codebase-memory-mcp: 0.7.0 (verified
--version)
- OS: macOS 24.6.0 (Darwin arm64)
- Install method: official
install.sh (ui variant)
Minimal reproduction
mkdir -p cbm-test/pkg-a/src cbm-test/pkg-b/src
cat > cbm-test/pkg-a/package.json <<EOF
{"name": "@test/pkg-a", "main": "src/index.js"}
EOF
cat > cbm-test/pkg-b/package.json <<EOF
{"name": "@test/pkg-b", "main": "src/index.js"}
EOF
cat > cbm-test/pkg-a/src/index.js <<EOF
import { foo } from '@test/pkg-b';
export const a = () => foo();
EOF
cat > cbm-test/pkg-b/src/index.js <<EOF
export const foo = () => 42;
EOF
codebase-memory-mcp cli index_repository '{"repo_path":"/tmp/cbm-test"}' 2>&1 | grep -iE "pkgmap"
# → no output (expected: pkgmap.scan_repo / pkgmap.build log lines)
codebase-memory-mcp cli query_graph '{"project":"tmp-cbm-test","query":"MATCH (a)-[r:IMPORTS]->(b) RETURN a.file_path, b.file_path"}'
# → 0 rows
Expected: an IMPORTS edge from pkg-a/src/index.js to pkg-b/src/index.js because the pkgmap should resolve @test/pkg-b via the package.json "name" field.
Actual: 0 IMPORTS edges, no pkgmap log lines.
Real-world impact
I'm indexing a 13-repo monorepo workspace (~140K nodes, ~214K edges, 13K files). All repos are Lerna+Yarn workspaces publishing internal packages under @pandora/ / @commerce-exp/. Cross-repo imports use the published package name. Expected behavior: graph treats them as a single fleet with normal IMPORTS edges. Actual: every cross-repo import is dropped.
Workaround attempted: synthesize a root tsconfig.json at the workspace level with paths mapping every internal @pandora/foo → <repo>/packages/foo/src/index.ts. This did trigger path_alias.c (saw path_alias.files.cap_hit kept=256_of_more warn) but still produced zero cross-repo edges because:
CBM_PATH_ALIAS_MAX_ENTRIES = 256 per single tsconfig (we have 328+ packages → 70+ silently dropped)
CBM_PATH_ALIAS_MAX_FILES = 256 total tsconfigs per repo walk (we have 352 → root tsconfig may not be among the 256 selected)
cbm_path_alias_find_for_file picks the nearest ancestor scope, so every source file inside an inner package picks up its own local tsconfig.json rather than the workspace-root one we wrote, never seeing our cross-repo paths
Suggested improvements
- Diagnose
pass_pkgmap.c silent failure on JS/TS workspaces (no log emission at all suggests it isn't being invoked or returns NULL before logging). The walker logic in pkgmap_walk_dir looks correct from the source. Add an info log even when 0 entries are produced.
- Honor
package.json workspaces arrays so a root manifest with "workspaces": ["packages/*"] (or globs across child repos) gives a scope to bare-specifier resolution that spans them.
- Aggregate tsconfig path aliases from ancestors rather than nearest-only — or, when a file matches no nearer alias, fall back to ancestors instead of stopping at the first tsconfig found.
- Raise (or make configurable) the
CBM_PATH_ALIAS_MAX_ENTRIES = 256 and CBM_PATH_ALIAS_MAX_FILES = 256 caps. Real monorepos easily exceed both.
- Document the limitation in the README under "Cross-repo intelligence" — specifically that
@myorg/pkg resolution currently does not bridge across package.json-workspaces sibling repos, even though the README example "@myorg/pkg" implies it does.
Happy to test fixes against a public 13-repo repro if helpful.
Summary
Following the v0.7.0 fix in #308 (tsconfig.json
paths), cross-package IMPORTS still produce zero edges for monorepos that usepackage.jsonworkspaces+ Lerna/Yarn workspaces (the most common JS monorepo pattern) instead of tsconfig path aliases.The README claims this is supported via generic
@myorg/pkgmanifest resolution inpass_pkgmap.c:However, in my testing on v0.7.0 (macOS arm64),
pass_pkgmap.ceither does not run or silently produces zero entries — nopkgmap.scan_repo/pkgmap.scan/pkgmap.buildlog lines appear during indexing, and zero cross-package IMPORTS edges are produced.Environment
--version)install.sh(ui variant)Minimal reproduction
Expected: an IMPORTS edge from
pkg-a/src/index.jstopkg-b/src/index.jsbecause the pkgmap should resolve@test/pkg-bvia thepackage.json"name"field.Actual: 0 IMPORTS edges, no pkgmap log lines.
Real-world impact
I'm indexing a 13-repo monorepo workspace (~140K nodes, ~214K edges, 13K files). All repos are Lerna+Yarn workspaces publishing internal packages under
@pandora//@commerce-exp/. Cross-repo imports use the published package name. Expected behavior: graph treats them as a single fleet with normal IMPORTS edges. Actual: every cross-repo import is dropped.Workaround attempted: synthesize a root
tsconfig.jsonat the workspace level with paths mapping every internal@pandora/foo→<repo>/packages/foo/src/index.ts. This did trigger path_alias.c (sawpath_alias.files.cap_hit kept=256_of_morewarn) but still produced zero cross-repo edges because:CBM_PATH_ALIAS_MAX_ENTRIES = 256per single tsconfig (we have 328+ packages → 70+ silently dropped)CBM_PATH_ALIAS_MAX_FILES = 256total tsconfigs per repo walk (we have 352 → root tsconfig may not be among the 256 selected)cbm_path_alias_find_for_filepicks the nearest ancestor scope, so every source file inside an inner package picks up its own localtsconfig.jsonrather than the workspace-root one we wrote, never seeing our cross-repo pathsSuggested improvements
pass_pkgmap.csilent failure on JS/TS workspaces (no log emission at all suggests it isn't being invoked or returns NULL before logging). The walker logic inpkgmap_walk_dirlooks correct from the source. Add aninfolog even when 0 entries are produced.package.jsonworkspacesarrays so a root manifest with"workspaces": ["packages/*"](or globs across child repos) gives a scope to bare-specifier resolution that spans them.CBM_PATH_ALIAS_MAX_ENTRIES = 256andCBM_PATH_ALIAS_MAX_FILES = 256caps. Real monorepos easily exceed both.@myorg/pkgresolution currently does not bridge acrosspackage.json-workspaces sibling repos, even though the README example "@myorg/pkg" implies it does.Happy to test fixes against a public 13-repo repro if helpful.