Fixes#1592.
## What was wrong
A `.h` header whose only C++ construct is a plain derived type —
```cpp
struct Base {};
struct Derived : Base {};
```
— was classified as C. The `.h` language check (`looksLikeCpp`) recognizes `class`, `namespace`, `template`, access sections, `virtual`, `using`, and — since #1159/#1207 — the export-macro form `struct ENGINE_API Derived : Base`. The plain form has none of those signals. Routed through the C extractor, `Derived` vanished from the index and the base clause was read as a K&R-style declaration, minting a phantom `function Base` with `returnType=Derived` (the exact output in the issue).
A second, independent miss the reporter called out: the check only read the first 8192 characters, so a large header with a long C-compatible preamble (include guards, `#define`s, plain typedefs) hid the signal even when it was there.
## What this does
`looksLikeCpp()` now runs two passes:
1. The existing 8 KB sample regex, unchanged.
2. A scan of the **whole file** (comments stripped) for a class/struct **base clause**: `class`/`struct` + tag + optional `final` + `:` + optional `public`/`protected`/`private`/`virtual` + a base name (scoped, optionally templated) followed by the body's `{` or a `,` introducing the next base.
That shape has no valid C reading, so widening it to the whole file can't drag a C header over to C++:
- a bit-field's `:` follows a member *name* inside the body (`unsigned a : 3;`), not the tag;
- a ternary's `:` is separated from the tag by `)` / `*` / a declarator (`sizeof(struct foo) : 0`);
- a label or identifier like `struct_end:` has no whitespace after `struct`;
- comments are removed before the scan, so doc-comment prose (`/* struct timeval: seconds, microseconds */`) can't match; and the `{`/`,` terminator keeps a string literal's prose from matching too.
Detection only — the C++ extractor already handles the header correctly once it's routed there (renaming to `.hpp`, as the issue notes, already worked).
## Tests
`__tests__/extraction.test.ts`:
- plain / `: public Base` / `: ns::Base` / `: Base<int, Foo<T>>` / `final : Base` / multi-base with `{` on the next line / `: virtual Base` → `cpp`;
- a base clause placed **after** 8192 characters of C-compatible preamble → `cpp`;
- controls that must stay `c`: a bit-field struct, `sizeof(struct foo) : 0` + a cast ternary, a `struct_end:` label and `struct_a` identifiers, doc-comment prose shaped like a base clause, and the two pre-existing C controls;
- end-to-end `extractFromSource('src/min.h', …)` on the issue's header: a `struct` node `Derived` (language `cpp`), exactly one `Base` node and it is a `struct` — no phantom function.
Issue repro re-run against this build: `codegraph init` → `query Derived` returns the `cpp` struct; `query Base` returns only the struct; the files table records `src/min.h` as `cpp`.
Full suite: `npm test` → 174 files passed, 3010 tests passed, 179 skipped.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01LxZj6W6Y1SHXwvpT3uwJpK