GritQL

Dev tools

code rewriting and migration

SHOW HN2024

280points
54comments
#232of 3,515 in 2024
Top 7%of 2024 by points

How HN took it

LovedMost comments that take a side are positive

11 positive, 14 neutral or asking, 2 mixed, 2 critical, out of 29 comments about the project. Thread score +0.34.

Idea: 2 for, 1 againstExecution: 2 for, 0 againstDesign: 1 for, 0 againstPricing: 1 for, 0 againstDocs: 1 for, 0 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Saves time on complex migrations, e.g. OpenAI SDK 1.0 and mobx to hooks

    From 2 comments
    • ++ congratulations to the team! We've tackled some pretty gnarly migrations with GritQL and it has saved us a lot of time. We have used ts-morph in the past for similar types of…
      psalv on HN
    • this definitly helped a tonne to migrate from openai <1.0 to 1.0
      jxnlco on HN
  • Good design for composing simple patterns into complex migrations

    From 1 comment
    • ast-grep is great too, we've learned a lot from it. If you like yaml, you should definitely try ast-grep. The main area GritQL shines is in taking simpler transformation patterns…
      morgante on HN
  • Maker team is responsive and helpful

    From 2 comments
    • Congrats to the launch! Managing tech debt is and will be an important issue in the world of AI software. I'm glad there's a company solving this. Additionally, this is something…
      mlejva on HN
    • Very happy Grit customer here. Wish I'd had this instead of jscodeshift et al back when I was doing oodles of migrations at Stripe, but glad I have it now, and very excited to…
      rattray on HN

Objections

  • Lacks semantic type information, so type-dependent rewrites are hard

    From 2 comments
    • Sounds like a cool tool. The ability to write rewrites as regular code fragments with metavariables feels like some ideas I've had in the past. However, it seems to me that your…
      jcranmer on HN
    • Are either of these exposed conveniently to build on? One scenario I dealt with recently was replacing a pattern that required rudimentary type resolution to apply properly.…
      setr on HN
  • Documentation is hard to understand without complex examples

    From 1 comment
    • Consider linking this and other complex examples in your readme, with before/after blocks to demonstrate the power of your software. I've spent the last 6 months building a…
      ryanjshaw on HN
  • Written in a repo where C is 96.5 percent of the code by GitHub stats

    From 2 comments
    • "a Rust CLI" - "C 96.5% Rust 1.4%" Not that I'm complaining ;) Is it a new way to market a C tool?
      practicalrs on HN
    • The C is all generated parsers, all our actual coding is done in Rust.
      morgante on HN

Requests

  • Support for HTML and other embedded languages

    From 2 comments
    • This looks great! Thank you for building it. I'm looking forward to learning to use it. I'm just starting to learn about tree-sitter but my understanding is that it can also…
      snthpy on HN
    • Yes, Grit does support embedded languages. Right now we support Vue syntax:…
      morgante on HN
  • Dynamic loading of custom tree-sitter grammars

    From 2 comments
    • I have the same question. I'm particularly interested in the SQL dialects case. Does the rewrite code also have to be syntactically correct or is that a simple text replacement…
      snthpy on HN
    • > Does the rewrite code also have to be syntactically correct or is that a simple text replacement because that's what I see as the main impediment; if I'm using the sqlite…
      morgante on HN
  • Semantic analysis and type information

    From 2 comments
    • apologies if this should be a discussion/issue/whatever but: Do you envision going up against CodeQL and/or <https://www.jetbrains.com/help/qodana/about-qodana.html> by making…
      mdaniel on HN
    • Sounds like a cool tool. The ability to write rewrites as regular code fragments with metavariables feels like some ideas I've had in the past. However, it seems to me that your…
      jcranmer on HN

Questions

  • How does it compare to ast-grep

    From 2 comments
    • Congrats from ast-grep team! Nice job Morgante! GritQL shares a lot of common ground with ast-grep, which is also a code rewriter based on tree-sitter. Interested folks may…
      herrington_d on HN
    • This looks great, thanks for building and sharing it. Interested folks may also want to check out ast-grep: https://github.com/ast-grep/ast-grep
      anotherpaulg on HN
  • Can it translate between programming languages

    From 2 comments
    • Can I use this to translate one language to another?
      MichaelMug on HN
    • In theory, you could write a full transpiler in GritQL. In practice, it's not really the ideal tool for translating between languages. It does work well for cases where the…
      morgante on HN
  • Can it handle SQL dialect conversion

    From 2 comments
    • I have the same question. I'm particularly interested in the SQL dialects case. Does the rewrite code also have to be syntactically correct or is that a simple text replacement…
      snthpy on HN
    • In theory, you could write a full transpiler in GritQL. In practice, it's not really the ideal tool for translating between languages. It does work well for cases where the…
      morgante on HN

Alternatives named

  • ast-grep

    From 2 comments
    • Congrats from ast-grep team! Nice job Morgante! GritQL shares a lot of common ground with ast-grep, which is also a code rewriter based on tree-sitter. Interested folks may…
      herrington_d on HN
    • This looks great, thanks for building and sharing it. Interested folks may also want to check out ast-grep: https://github.com/ast-grep/ast-grep
      anotherpaulg on HN
  • comby

    From 1 comment
    • The first tool like this I saw was [comby](https://comby.dev/). I remember it being a bit annoying to use for small-to-medium refactors. Next time I'll try `grit` and see how it…
      lightandlight on HN
  • jscodeshift

    From 1 comment
  • CodeQL

    From 1 comment
    • apologies if this should be a discussion/issue/whatever but: Do you envision going up against CodeQL and/or <https://www.jetbrains.com/help/qodana/about-qodana.html> by making…
      mdaniel on HN
  • Qodana

    From 1 comment
    • apologies if this should be a discussion/issue/whatever but: Do you envision going up against CodeQL and/or <https://www.jetbrains.com/help/qodana/about-qodana.html> by making…
      mdaniel on HN
  • ts-morph

    From 1 comment
    • ++ congratulations to the team! We've tackled some pretty gnarly migrations with GritQL and it has saved us a lot of time. We have used ts-morph in the past for similar types of…
      psalv on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/39770908)