Language request: Astro (.astro)
- Dominant language
- C++
- Stars
- 2.1k
- Forks
- 125
- Avg merge
- 5h 28m
- Merged PRs (30d)
- 163
Description
Filed the way the README asks for a language request: naming the grammar and the repo I would run it on.
## Grammar
[`virchau13/tree-sitter-astro`](https://github.com/virchau13/tree-sitter-astro) — MIT. It is what `nvim-treesitter` ships: pinned at revision `213f6e6973d9b456c6e50e86f19f66877e7ef0ee`, maintainer `@virchau13`, tier 2.
Two things worth stating up front, because both bear on the cost:
- **That pinned revision is from 2025-04-19**, and it is still the head the ecosystem uses. [`PRRPCHT/tree-sitter-astro-next`](https://github.com/PRRPCHT/tree-sitter-astro-next) (Apache-2.0, pushed 2026-02-13) is more recent but has no adoption to speak of. I have run neither against ripwire's query pipeline.
- **The grammar is not self-contained.** `nvim-treesitter` declares `requires = { 'html', 'html_tags' }` — the template half of an `.astro` file parses through HTML injection. ripwire currently treats HTML as a *document*, not a grammar, so adopting the full grammar means bringing in an HTML parser too.
That second point is the main argument for the reduced scope below.
## The repo I would run it on
Public: [`withastro/docs`](https://github.com/withastro/docs).
Locally: a private Astro + TypeScript monorepo — 1453 files indexed, 13648 symbols, 154 `.astro` files unindexed.
## What it would buy
Astro splits a project the same way every time: the pages are `.astro`, the logic is `.ts`. The frontmatter of an `.astro` file — the block between `---` fences — is TypeScript, and it is where the page calls into services.
Without the grammar the call graph is missing its entire top layer. Measured on the repo above: **114 of 172 exported service functions have callers only in `.astro` files**, so `--callers` answers `count="0"` for two thirds of that app's service surface. `--for` still ranks the right symbols, and `--callers` is exact within the `.tsx` half — the gap is specifically the page layer.
## Scope note
An `.astro` file is frontmatter (TypeScript) plus a template with JSX-like expressions. If the full grammar is more than it is worth, extracting **only the frontmatter as TypeScript** would already recover most call edges: the template mostly interpolates values the frontmatter computed. That would be a smaller change than a new language round, and it is where the calls are.
## Related
The silent `count="0"` this gap produces today is filed separately as #66 — that one stands on its own regardless of whether Astro is ever added, since it also reproduces with Kotlin.
## Disclosure
Investigated and written with AI assistance (Claude Code). The counts above come from real runs of the 0.5.0 release binary.
Contributor guide
Research direction
Start with ripwire's grammar integration and query pipeline, especially how HTML is currently treated and how --callers handles parsed files. Compare adopting the full Astro grammar with extracting only the TypeScript frontmatter. Validate the chosen scope against withastro/docs or the cited private repository, checking that .astro callers appear instead of count="0".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100