Skip to content

Feature Request: Support .astro and .css file indexing for Astro projects #768

@xingwangzhe

Description

@xingwangzhe

Problem

CodeGraph currently only indexes .ts, .js, .mjs, and .yml files. It does not index .astro or .css files, which makes it nearly unusable for Astro projects.

Reproduction

Take the stalux project as an example — a typical Astro blog theme:

File Type Actual Files Indexed by CodeGraph
.astro 55 0
.css 35 0
.ts 14 14 ✅
.js / .mjs 2 2 ✅
.yml 2 2 ✅

~80% of the project's source code is invisible to CodeGraph.

Concrete examples

Functions in .astro frontmatter are not found:

# This function is defined in src/components/stalux/layout/navs.astro (frontmatter)
codegraph search getIconNode   # ❌ No results found

# But .ts functions work fine:
codegraph search toTimestamp   # ✅ Returns 4 results correctly

CSS module class usage cannot be analyzed:

# No way to check which CSS classes are dead code
# postRight.module.css had 200+ lines of unused classes
# that could not be detected through codegraph

Why this matters

Astro is a rapidly growing framework (40k+ GitHub stars). Many projects using CodeGraph are built with Astro. Without .astro indexing:

  • codegraph_explore cannot answer questions about component architecture
  • codegraph_callers/codegraph_callees cannot trace cross-component dependencies
  • codegraph_impact cannot assess refactoring risk
  • Dead CSS detection is impossible

Proposed solution

  1. Parse .astro files and index:
    • The frontmatter TypeScript/JavaScript block (--- sections) — functions, imports, variables
    • Component-level symbols for cross-file reference tracking
  2. Parse .css/.module.css files and index class selectors for dead-code analysis

Thank you for the great tool!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions