Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ pnpm test # vitest
pnpm lint # eslint
pnpm typecheck # tsc --noEmit
pnpm build # production build
pnpm verify:cli-real # default real-repo CLI matrix
pnpm verify:cli-real:heavy # large /home/ubuntu repo matrix
pnpm verify:cli-real # default real-repo CLI matrix (this repository)
pnpm verify:cli-real:heavy # large-repo matrix; set CBI_REAL_HOME or CBI_REAL_TARGETS
```

## License
Expand Down
2 changes: 1 addition & 1 deletion llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ Gate modes: all, new-only. Returns pass/warn/fail verdict, findings with advisor
- **Default scanner excludes**: `.git`, `node_modules`, `.codebase-intelligence`, legacy `.code-visualizer`, `.next`, `dist`, `coverage`, `.turbo`, `.cache`, `.worktrees`, and `.claude/worktrees`.
- **Monorepo imports**: Root tsconfig path aliases and local package.json package names resolve to source files before graph construction.
- **Large repo mode**: Above 1500 TypeScript files, use AST-only extraction to avoid TypeScript program OOM. Override with `CBI_FULL_PROGRAM_FILE_LIMIT`.
- **Real-repo verification**: `pnpm verify:cli-real` runs the default matrix. `pnpm verify:cli-real:heavy` sets `CBI_REAL_PROFILE=heavy` and verifies large `/home/ubuntu` repos with minimum file/dependency thresholds.
- **Real-repo verification**: `pnpm verify:cli-real` runs the default matrix against this repository. `pnpm verify:cli-real:heavy` sets `CBI_REAL_PROFILE=heavy` and applies large-repo file/dependency thresholds to additional trees supplied via `CBI_REAL_HOME`, `CBI_REAL_TARGETS`, or `CBI_REAL_MATRIX` (or the `--home`, `--targets`, and `--matrix` flags). Discovery never uses a hard-coded machine path.
- **Progress**: All progress messages go to stderr. Results go to stdout.
- **JSON mode**: `--json` outputs stable JSON schema to stdout.
- **Exit codes**: 0 = success, 1 = runtime error, 2 = bad args/usage.
Expand Down
4 changes: 2 additions & 2 deletions specs/active/2026-02-19-group-metrics-legend.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ EC3. Very long group names: truncated in legend

| Assumption | Evidence For | Evidence Against | Verdict |
|------------|-------------|-----------------|---------|
| `cloudGroup()` is the right grouping for metrics | Works well for the-forge (5 clear groups) | Might oversimplify monorepos with packages/ | VALID — handles `packages/` in SOURCE_DIRS |
| `cloudGroup()` is the right grouping for metrics | Works well for a mid-size fixture repo (5 clear groups) | Might oversimplify monorepos with packages/ | VALID — handles `packages/` in SOURCE_DIRS |
| Groups should be sorted by importance (PageRank) | Matches what user asked for ("top groups") | Could sort by LOC or coupling instead | VALID — importance is most intuitive |
| Legend should only show when clouds are visible | Avoids clutter when user doesn't want clouds | Could always show groups regardless | VALID — user already has a toggle |

Expand All @@ -156,7 +156,7 @@ EC3. Very long group names: truncated in legend
1. **[Performance]** Computing groups on every `analyzeGraph()` call adds work. Unlikely to matter (grouping is O(n) over files), but worth noting.
Why it matters: Could slow startup for huge codebases (10k+ files).

2. **[UX]** Legend might have too many entries for projects with many top-level dirs. the-forge has 5, but a monorepo could have 15+.
2. **[UX]** Legend might have too many entries for projects with many top-level dirs. a mid-size fixture repo has 5, but a monorepo could have 15+.
Why it matters: Legend would overflow screen. → Cap at top 8 groups by importance.

### Failure Hypotheses
Expand Down
4 changes: 2 additions & 2 deletions specs/active/2026-03-01-symbol-level-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ EC3. Click symbol from different view: no-op until user switches to symbol view

| Assumption | Evidence For | Evidence Against | Verdict |
|------------|-------------|------------------|---------|
| ForceGraph3D handles symbol-level node count (1000+ nodes) | Library docs claim 100k+ nodes; file-level already renders 549 nodes | Symbol count could be 5-10x file count; WebGL has real limits | RISKY — benchmark on the-forge fixture (603 symbols) before scaling claims |
| ForceGraph3D handles symbol-level node count (1000+ nodes) | Library docs claim 100k+ nodes; file-level already renders 549 nodes | Symbol count could be 5-10x file count; WebGL has real limits | RISKY — benchmark on a large fixture repo (603 symbols) before scaling claims |
| Lazy loading prevents initial page slowdown | SWR supports conditional fetching; existing pattern fetches 4 endpoints | User will click "Symbols" and wait; perceived latency shifts not eliminates | VALID — lazy is strictly better than eager for optional data |
| Color-by-type is the best visual encoding | Standard convention in IDE symbol explorers | Could also color by module (consistency with file views) or by pageRank (heatmap) | VALID — type coloring is most intuitive; module coloring available as future option |

Expand Down Expand Up @@ -214,7 +214,7 @@ Confirmed — spec solves the right problem. The pipeline computes symbol data t

- [improvement] Add symbol search to search bar → defer to future spec
- [improvement] Add confidence visual on call edges (solid vs dashed) → defer, explore during 7B
- [risk] Benchmark symbol graph render on the-forge (603 symbols) during 7B → explore during ship
- [risk] Benchmark symbol graph render on a large fixture repo (603 symbols) during 7B → explore during ship
- [question] Should "Types" be a separate view tab or a filter toggle within Symbols view? → ship as separate tab, simpler UX

## Notes
Expand Down
2 changes: 1 addition & 1 deletion specs/active/2026-03-02-group-spatial-clustering.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ EC3. Zero cluster strength: Equivalent to current behavior — no grouping force
- [x] Error states handled (jitter prevention via distanceMin=5)
- [x] No hardcoded secrets or credentials
- [x] Cloud cleanup/disposal still works (no memory leaks from new geometry)
- [x] Visual verification on both small (codebase-intelligence, 19 files) and large (the-forge, 500+ files) projects
- [x] Visual verification on both small (codebase-intelligence, 19 files) and large (a 500+ file fixture repo) projects

### Advisory

Expand Down
134 changes: 78 additions & 56 deletions tools/verify-cli-real-codebases.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { spawnSync } from "node:child_process";
const root = process.cwd();
const cli = path.join(root, "dist", "cli.js");
const expectedVersion = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf-8")).version;
const profile = process.env.CBI_REAL_PROFILE ?? "default";
const cliArgs = parseCliArgs(process.argv.slice(2));
const profile = cliArgs.profile ?? process.env.CBI_REAL_PROFILE ?? "default";
const timeoutMs = Number.parseInt(
process.env.CBI_REAL_TIMEOUT_MS ?? (profile === "heavy" ? "180000" : "60000"),
10,
Expand All @@ -28,71 +29,29 @@ const bannedPathSegments = new Set([
]);

const defaultTargets = [
{ name: "codebase-intelligence", path: root, file: "src/install/index.ts", symbol: "upsertManagedBlock" },
{
name: "create-vllnt-app-cli",
path: "/home/ubuntu/vllnt-toolbox/create-vllnt-app/cli",
file: "src/core/doctor.ts",
symbol: "runDoctor",
},
{
name: "create-vllnt-app-www",
path: "/home/ubuntu/vllnt-toolbox/create-vllnt-app/www",
file: "app/[locale]/(marketing)/layout.tsx",
symbol: "default",
},
{ name: "self", path: root, file: "src/install/index.ts", symbol: "upsertManagedBlock" },
];

const heavyProfileTargets = [
{
name: "heavy-harness",
path: "/home/ubuntu/harness",
file: "harnesses/cli/src/cli-args/list-models.ts",
symbol: "listModels",
minFiles: 800,
minDependencies: 500,
},
{
name: "heavy-ui",
path: "/home/ubuntu/ui",
file: "",
symbol: "",
minFiles: 1500,
minDependencies: 1000,
},
{
name: "heavy-songtrivia",
path: "/home/ubuntu/anthm/songtrivia",
file: "",
symbol: "",
minFiles: 2500,
minDependencies: 2500,
},
];

const extraTargets = (process.env.CBI_REAL_TARGETS ?? "")
.split(",")
.map((value) => value.trim())
.filter(Boolean)
.map((targetPath, index) => ({
name: `external-${index + 1}`,
path: targetPath,
file: "",
symbol: "",
}));

const profileTargets = profile === "heavy" ? heavyProfileTargets : [];
if (profile !== "default" && profile !== "heavy") {
console.error(`Unknown CBI_REAL_PROFILE=${profile}; expected default or heavy`);
process.exit(2);
}

const shouldDiscoverHome = process.env.CBI_REAL_DISCOVER_HOME === "1" || profile === "heavy";
const extraTargets = targetsFromSpec(
[...(process.env.CBI_REAL_TARGETS ?? "").split(","), ...cliArgs.targets],
"external",
);
const matrixTargets = loadMatrixFile(cliArgs.matrixFile ?? process.env.CBI_REAL_MATRIX);

const homeDir = cliArgs.home ?? process.env.CBI_REAL_HOME;
const shouldDiscoverHome =
cliArgs.discover || process.env.CBI_REAL_DISCOVER_HOME === "1" || Boolean(homeDir);
const discoveredTargets = shouldDiscoverHome
? discoverHomeTargets(process.env.CBI_REAL_HOME ?? "/home/ubuntu", profile === "heavy" ? largeRepoFileThreshold : 1)
? discoverHomeTargets(homeDir ?? os.homedir(), profile === "heavy" ? largeRepoFileThreshold : 1)
: [];

const targets = uniqueTargets([...defaultTargets, ...profileTargets, ...extraTargets, ...discoveredTargets]);
const targets = uniqueTargets([...defaultTargets, ...matrixTargets, ...extraTargets, ...discoveredTargets]);
applyHeavyThresholds(targets, profile, root);

let pass = 0;
let fail = 0;
Expand Down Expand Up @@ -138,6 +97,69 @@ function arrayAt(value, keys) {
return [];
}


function parseCliArgs(argv) {
const parsed = { targets: [], home: undefined, profile: undefined, discover: false, matrixFile: undefined };
for (let i = 0; i < argv.length; i += 1) {
const arg = argv[i];
const next = argv[i + 1];
if (arg === "--profile" && next) {
parsed.profile = next;
i += 1;
} else if ((arg === "--targets" || arg === "--target") && next) {
parsed.targets.push(...next.split(","));
i += 1;
} else if (arg === "--home" && next) {
parsed.home = next;
i += 1;
} else if (arg === "--discover-home") {
parsed.discover = true;
} else if ((arg === "--matrix" || arg === "--matrix-file") && next) {
parsed.matrixFile = next;
i += 1;
}
}
return parsed;
}

function targetsFromSpec(values, namePrefix) {
return values
.map((value) => value.trim())
.filter(Boolean)
.map((targetPath, index) => ({
name: `${namePrefix}-${index + 1}`,
path: targetPath,
file: "",
symbol: "",
}));
}

function loadMatrixFile(filePath) {
if (!filePath) return [];
const raw = JSON.parse(fs.readFileSync(filePath, "utf-8"));
const entries = Array.isArray(raw) ? raw : raw.targets;
if (!Array.isArray(entries)) return [];
return entries.map((entry, index) => ({
name: String(entry.name ?? `matrix-${index + 1}`),
path: String(entry.path ?? ""),
file: String(entry.file ?? ""),
symbol: String(entry.symbol ?? ""),
minFiles: typeof entry.minFiles === "number" ? entry.minFiles : undefined,
minDependencies: typeof entry.minDependencies === "number" ? entry.minDependencies : undefined,
})).filter((entry) => entry.path);
}

function applyHeavyThresholds(list, currentProfile, selfRoot) {
if (currentProfile !== "heavy") return;
const minFiles = Number.parseInt(process.env.CBI_REAL_MIN_FILES ?? "300", 10);
const minDependencies = Number.parseInt(process.env.CBI_REAL_MIN_DEPS ?? "0", 10);
for (const target of list) {
if (path.resolve(target.path) === path.resolve(selfRoot)) continue;
if (target.minFiles == null) target.minFiles = minFiles;
if (minDependencies > 0 && target.minDependencies == null) target.minDependencies = minDependencies;
}
}

function uniqueTargets(candidates) {
const seen = new Set();
const targets = [];
Expand Down
Loading