Skip to content

Conversation

@BobrImperator
Copy link
Contributor

@BobrImperator BobrImperator commented Jan 17, 2026

  • Adds support for .gts and .gjs code
    They're Ember.js component authoring and templating format.

Summary by CodeRabbit

  • New Features

    • Glimmer JavaScript (.gjs) and Glimmer TypeScript (.gts) language support with bundled parsers and runtime registration.
  • Tests

    • Added integration test harnesses that validate parsing of Glimmer component snippets.
  • Chores

    • Added two new language packages, install-time setup scripts, READMEs, and a changeset for release.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 17, 2026

📝 Walkthrough

Walkthrough

Adds two new language packages: @ast-grep/lang-glimmer-javascript and @ast-grep/lang-glimmer-typescript, each providing TypeScript declarations, a CommonJS runtime that lazily resolves a native parser library, nursery test harnesses, postinstall wiring, package manifests, and READMEs.

Changes

Cohort / File(s) Summary
Glimmer JavaScript package
packages/glimmer-javascript/index.js, packages/glimmer-javascript/index.d.ts, packages/glimmer-javascript/nursery.js, packages/glimmer-javascript/package.json, packages/glimmer-javascript/postinstall.js, packages/glimmer-javascript/README.md
New package: adds LanguageRegistration declaration and default registration export; runtime exports lazy libraryPath (resolvePrebuild fallback to local parser), extensions: ["gjs"], languageSymbol, and expandoChar; nursery tests; postinstall hookup; package manifest and README.
Glimmer TypeScript package
packages/glimmer-typescript/index.js, packages/glimmer-typescript/index.d.ts, packages/glimmer-typescript/nursery.js, packages/glimmer-typescript/package.json, packages/glimmer-typescript/postinstall.js, packages/glimmer-typescript/README.md
New package: adds LanguageRegistration declaration and default registration export; runtime exports lazy libraryPath (resolvePrebuild fallback to local parser), extensions: ["gts"], languageSymbol, and expandoChar; nursery tests; postinstall hookup; package manifest and README.
Changeset
.changeset/fair-lions-know.md
Adds changeset documenting the two new packages and file extensions (.gjs, .gts).

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

dependencies

Suggested reviewers

  • HerringtonDarkholme

Poem

🐰 New parsers hop into the fold,
gjs and gts in stories told,
native libs peek, then take their place,
tests and installs set the pace,
I nibble bugs and leave a trace.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding language parser support for Ember Glimmer extensions (.gjs and .gts). It aligns with the changeset which adds two new packages for glimmer-javascript and glimmer-typescript language support.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@BobrImperator BobrImperator force-pushed the main branch 2 times, most recently from 0de3438 to 1e97ac4 Compare January 17, 2026 12:14
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@packages/glimmer-javascript/README.md`:
- Around line 16-24: The example uses an invalid identifier name
"glimmer-javascript"; rename the import to a valid identifier (e.g.,
glimmerJavascript), update the object key passed to registerDynamicLanguage to
use that identifier (registerDynamicLanguage({ glimmerJavascript })), and ensure
the parse() call uses the matching language string/identifier
(parse('glimmerJavascript', `your code`)) so the import, registration, and parse
invocation all reference the same valid identifier and string.

In `@packages/glimmer-typescript/index.js`:
- Around line 21-30: The extensions list in module.exports currently registers
both "gjs" and "gts", which overlaps with glimmer-javascript; update the
extensions property in the module.exports object so this package only registers
TypeScript files (change extensions to include only "gts") to avoid ambiguous
language resolution; ensure you only modify the extensions array (referenced as
the extensions property on the exported object) and leave libraryPath,
languageSymbol, and expandoChar unchanged.

In `@packages/glimmer-typescript/README.md`:
- Around line 16-24: The example uses an invalid identifier
"glimmer-typescript"; change the import to a valid identifier (e.g.,
glimmerTypescript) and pass it into registerDynamicLanguage under the original
string key "glimmer-typescript" (use registerDynamicLanguage({
'glimmer-typescript': glimmerTypescript })); also update the parse call sample
to include non-empty example code (e.g., parse('glimmer-typescript', `your code
here`)). Ensure the unique symbols to change are the import line (currently
referencing glimmer-typescript), the registerDynamicLanguage call, and the parse
invocation.
- Around line 10-12: Update the README install command to reference the correct
NPM package name: replace the string "@tree-sitter/cli" with "tree-sitter-cli"
so the command becomes "pnpm install tree-sitter-cli --save-dev"; look for the
install line containing "@tree-sitter/cli" in README.md and change that token
only.
🧹 Nitpick comments (2)
packages/glimmer-javascript/nursery.js (1)

14-17: Incorrect regex pattern in test fixture.

The regex /^d+.d+.d+$/ appears to intend matching semantic versions but is missing backslashes. d matches literal 'd' and . matches any character.

📝 Suggested fix
 function isLatestVersion() {
-  const stableRegex = /^d+.d+.d+$/;
+  const stableRegex = /^\\d+\\.\\d+\\.\\d+$/;
   return !stableRegex.test(VERSION);
 }

Note: Since this is test fixture code (not production logic), the incorrect regex doesn't affect actual functionality—just the realism of the test snippet.

packages/glimmer-typescript/nursery.js (1)

14-17: Same regex pattern issue as in glimmer-javascript.

The regex /^d+.d+.d+$/ is missing backslashes for digit and dot escapes. Same fix as suggested for the JavaScript version.

📝 Suggested fix
 function isLatestVersion(): boolean {
-  const stableRegex = /^d+.d+.d+$/;
+  const stableRegex = /^\\d+\\.\\d+\\.\\d+$/;
   return !stableRegex.test(VERSION);
 }

Comment on lines +10 to +12
# install the tree-sitter-cli if no prebuild is available
pnpm install @tree-sitter/cli --save-dev
```
Copy link

@coderabbitai coderabbitai bot Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# Find and check the package.json in glimmer-typescript directory
find . -path "*/glimmer-typescript/package.json" -type f

Repository: ast-grep/langs

Length of output: 100


🏁 Script executed:

# Once we find package.json, let's check its contents related to tree-sitter
if [ -f "packages/glimmer-typescript/package.json" ]; then
  echo "=== package.json devDependencies ===" 
  cat packages/glimmer-typescript/package.json | jq '.devDependencies // empty'
fi

Repository: ast-grep/langs

Length of output: 205


🏁 Script executed:

# Check the README to confirm the reference mentioned in the review
if [ -f "packages/glimmer-typescript/README.md" ]; then
  echo "=== README.md lines 10-12 ==="
  sed -n '10,12p' packages/glimmer-typescript/README.md
  echo ""
  echo "=== Broader context around tree-sitter ==="
  grep -n "tree-sitter" packages/glimmer-typescript/README.md
fi

Repository: ast-grep/langs

Length of output: 341


🌐 Web query:

@tree-sitter/cli npm package registry

💡 Result:

There is no published scoped package named @tree-sitter/cli. The Tree-sitter CLI is published on npm as tree-sitter-cli (latest shown v0.25.0). Install with npm i tree-sitter-cli or use the GitHub releases/binary. [1][2]

Sources:

  • npm package page for tree-sitter-cli. [1]
  • tree-sitter project / CLI source on GitHub. [2]

🌐 Web query:

tree-sitter-cli npm package registry

💡 Result:

Summary for the npm package "tree-sitter-cli":

  • Package: tree-sitter-cli.
  • Latest published npm version (as shown on npm): 0.22.5. Install: npm install tree-sitter-cli (or npm i [email protected]). [1]
  • Repository / homepage: github.com/tree-sitter/tree-sitter (official Tree-sitter project). [1]
  • Install alternatives: cargo install tree-sitter-cli (Rust crate) or download prebuilt binaries from GitHub Releases. [2]
  • License: MIT. Common commands: tree-sitter generate, test, build, parse, etc.; docs on usage available in the Tree-sitter docs. [1][2]

Sources: npm package page for tree-sitter-cli [1]; official Tree-sitter docs (install/CLI usage) [2].


Update README.md line 11 to use correct package name tree-sitter-cli instead of @tree-sitter/cli.

The README references the non-existent scoped package @tree-sitter/cli, while package.json correctly uses tree-sitter-cli. The official Tree-sitter CLI package on NPM is published as tree-sitter-cli (unscoped).

Suggested fix for line 11:
- pnpm install `@tree-sitter/cli` --save-dev
+ pnpm install tree-sitter-cli --save-dev
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# install the tree-sitter-cli if no prebuild is available
pnpm install @tree-sitter/cli --save-dev
```
# install the tree-sitter-cli if no prebuild is available
pnpm install tree-sitter-cli --save-dev
🤖 Prompt for AI Agents
In `@packages/glimmer-typescript/README.md` around lines 10 - 12, Update the
README install command to reference the correct NPM package name: replace the
string "@tree-sitter/cli" with "tree-sitter-cli" so the command becomes "pnpm
install tree-sitter-cli --save-dev"; look for the install line containing
"@tree-sitter/cli" in README.md and change that token only.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right. I will fix it in other PRs

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HerringtonDarkholme Thank you for confirming! I appreciate you noting this for the other PRs where the same issue may exist.


🧠 Learnings used
Learnt from: HerringtonDarkholme
Repo: ast-grep/langs PR: 65
File: packages/typescript/index.js:6-6
Timestamp: 2025-04-10T19:47:06.210Z
Learning: In ast-grep, TypeScript and TSX are treated as two separate languages, each with their own language package, rather than TypeScript supporting both .ts and .tsx extensions in a single package.

Learnt from: HerringtonDarkholme
Repo: ast-grep/langs PR: 73
File: packages/yaml/package.json:13-20
Timestamp: 2025-04-22T18:00:42.287Z
Learning: In ast-grep language packages, type.d.ts is a generated file that should be included in the package.json files array even though it's not directly committed to the repository.

Learnt from: HerringtonDarkholme
Repo: ast-grep/langs PR: 74
File: packages/all/src/langs.test.ts:0-0
Timestamp: 2025-04-25T19:31:36.345Z
Learning: The ast-grep/all-langs package uses ESM modules (has "type": "module" in package.json). In ESM, file extensions should be included in imports and should consistently use .js extensions (not .ts) since TypeScript transpiles to JavaScript.

Learnt from: HerringtonDarkholme
Repo: ast-grep/langs PR: 65
File: packages/typescript/package.json:17-17
Timestamp: 2025-04-10T19:46:48.394Z
Learning: In the ast-grep/langs repository, type.d.ts files are generated at build time and are intentionally ignored in git version control.

Learnt from: HerringtonDarkholme
Repo: ast-grep/langs PR: 43
File: packages/go/nursery.js:10-17
Timestamp: 2025-04-01T18:31:28.544Z
Learning: For ast-grep/lang packages, minimal test coverage that verifies basic functionality (like a simple function declaration test for Go) is considered sufficient, and extensive test coverage of language constructs is not required.

Learnt from: pelikhan
Repo: ast-grep/langs PR: 38
File: packages/python/package.json:22-22
Timestamp: 2025-03-27T03:50:42.436Z
Learning: Most packages in the ast-grep/langs repository use an empty author field in package.json files. Don't assume authorship information without clear evidence from the repository.

Copy link
Member

@HerringtonDarkholme HerringtonDarkholme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add README and fix linting? Thanks

@HerringtonDarkholme HerringtonDarkholme merged commit 804b0d5 into ast-grep:main Jan 19, 2026
3 checks passed
@HerringtonDarkholme
Copy link
Member

Published!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants