LearnNewsExamplesServices
Frontmatter
id8424
titleFix SourceParser to resolve fully qualified superclass names
stateClosed
labels
bugai
assigneestobiu
createdAtJan 8, 2026, 2:25 PM
updatedAtJan 8, 2026, 2:27 PM
githubUrlhttps://github.com/neomjs/neo/issues/8424
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 8, 2026, 2:27 PM

Fix SourceParser to resolve fully qualified superclass names

Closed v11.19.0 bugai
tobiu
tobiu commented on Jan 8, 2026, 2:25 PM

The SourceParser currently extracts the local identifier for the parent class (e.g., extends Base), which results in broken links in the class hierarchy map.

Task: Refactor ai/mcp/server/knowledge-base/parser/SourceParser.mjs to:

  1. Capture a map of imports (Local Name -> Import Path).
  2. When a class extends X, look up X in the import map.
  3. Resolve the import path relative to the current file path.
  4. Convert the resolved file path into a fully qualified Neo class name (e.g., src/container/Base.mjs -> Neo.container.Base).

Heuristic:

  • Assume src/ maps to Neo..
  • Assume apps/ maps to App. (or use the app name from the path).
  • Handle relative paths (../, ./) using the path module (requires importing path).

Goal: The extends property in the chunk metadata should be a fully qualified class name (e.g., Neo.container.Base) whenever possible.

tobiu added the bug label on Jan 8, 2026, 2:25 PM
tobiu added the ai label on Jan 8, 2026, 2:25 PM
tobiu assigned to @tobiu on Jan 8, 2026, 2:26 PM
tobiu referenced in commit 3bda6e5 - "fix: Resolve fully qualified superclass name in SourceParser (#8424)" on Jan 8, 2026, 2:26 PM
tobiu
tobiu Jan 8, 2026, 2:26 PM

Input from Gemini 3 Pro:

✦ I have updated SourceParser.mjs to resolve the fully qualified superClass name.

Logic Implemented:

  1. Import Mapping: The parser now scans ImportDeclaration nodes and builds a map of localName -> importPath.
  2. Resolution: When a class extends a local identifier (e.g., extends Container), the parser:
    • Looks up the import path for Container (e.g., ../../container/Base.mjs).
    • Resolves this relative to the current file path (src/tab/header/Toolbar.mjs + ../../container/Base.mjs -> src/container/Base.mjs).
    • Converts the resolved path into a Neo class namespace (Neo.container.Base) using standard conventions.

This ensures the extends metadata in the knowledge base (and thus the ai-class-hierarchy.json) points to valid, unique class keys rather than ambiguous local names.

tobiu closed this issue on Jan 8, 2026, 2:27 PM