diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..d7d7f333e --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,24 @@ + + + + +## Summary + + + + + +## Test Plan + + + +## Docs + + diff --git a/CODEOWNERS b/CODEOWNERS deleted file mode 100644 index cbbbc4741..000000000 --- a/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @getgrit/core diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ea890cb9a..5908d076f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,7 @@ A high-level overview of tools you need to have installed: - Yarn package manager. You'll need [`yarn`](https://classic.yarnpkg.com/en/docs/install) (classic). Install v1.22.19 with `npm install --global yarn`. - Tree-Sitter CLI: provides [`tree-sitter`](https://github.com/tree-sitter/tree-sitter/tree/master/cli) binary for testing grammars. Install v0.22.2 with `npm install --global tree-sitter-cli`. - Terraform CLI. Install [`terraform`](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) with `brew tap hashicorp/tap && brew install hashicorp/tap/terraform`. -- For snapshot testing review, you should install the cargo insta plugin: `curl -LsSf https://insta.rs/install.sh | sh` (https://insta.rs/docs/cli/) +- For snapshot testing review, you should install the cargo insta plugin: `curl -LsSf https://insta.rs/install.sh | sh` () ## Building the Code @@ -63,13 +63,13 @@ After making your changes, run the [./resources/edit_grammars.mjs](./resources/e For example: -``` +```sh node ./resources/edit_grammars.mjs yaml ``` ### Snippet contexts -Snippet contexts help when a snippet is a valid AST subtree, but needs to be in a larger tree to parse. For example, matching on a table name like ` $schema.$table` in SQL is not valid SQL by itself, only when surrounded by something like `SELECT x from $schema.$table` is the snippet valid. +Snippet contexts help when a snippet is a valid AST subtree, but needs to be in a larger tree to parse. For example, matching on a table name like `$schema.$table` in SQL is not valid SQL by itself, only when surrounded by something like `SELECT x from $schema.$table` is the snippet valid. Snippet contexts are defined by implementing the `snippet_context_strings` method in the `Language` trait. This method returns a list of strings that are used to match the snippet in the larger tree. For example, the SQL implementation returns `["SELECT 1 from ", ";"]` to match a table name in a SQL query. @@ -100,9 +100,9 @@ These steps are done in our cloud environment and are not necessary for contribu - grep for an existing language like `Sol` for solidity, and add it to all the `Language` enums you find. - Add the language to `apps/web/src/views/project/details.tsx`, so repos with this language don’t get an “unsupported language” warning. (5 minutes) - - LSP target languages list: https://github.com/getgrit/rewriter/pull/7734/files#diff-f9d4f097b08d33241c5c8d15a2fbde0e37086c265ce0eba8decac20d5cd989c6R23 - - VS Code client list: https://github.com/getgrit/rewriter/blob/f992490394a4807789504f1cea6a04b934ad3b24/apps/poolish/src/lsp-client.ts - - VS Code command palette triggers: https://github.com/getgrit/rewriter/pull/7734/files#diff-b38f1d6304993a250903310722206e6c89c58c52c2d1bd4b6fdd8f7218810570R103 + - LSP target languages list: + - VS Code client list: + - VS Code command palette triggers: - There are also `exhaustive` runtime checks that error if a switch case doesn’t handle a language, like `makeSingleLineComment`. Search for `exhaustive(lang` and fill those out too. - Regenerate both DB/prisma types to add it to the DB schema and GraphQL types. - Add the language to `language-selector.tsx`. Pick an icon from [https://react-icons.github.io](https://react-icons.github.io/), usually from the Simple Icons category. diff --git a/LICENSE b/LICENSE index 677d9e2f4..98c348276 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ MIT License -Copyright (c) 2024 Iuvo AI, Inc. +Copyright (c) 2024-2025 Iuvo AI, Inc. +Copyright (c) 2025-present Biome Developers and Contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 89ab543cf..90b9095ef 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Read the [documentation](https://docs.grit.io/language/overview), [interactive t Install the Grit CLI: -``` +```sh curl -fsSL https://docs.grit.io/install | bash ``` @@ -45,19 +45,19 @@ curl -fsSL https://docs.grit.io/install | bash Search for all your `console.log` calls by putting the desired pattern in backticks: -``` +```sh grit apply '`console.log($_)`' ``` Replace `console.log` with `winston.log`, using `=>` to create rewrites: -``` +```sh grit apply '`console.log($msg)` => `winston.log($msg)`' ``` Save the pattern to a [`grit.yaml`](https://docs.grit.io/guides/config) file and exclude test cases in a where clause: -``` +```sh cat << 'EOF' > .grit/grit.yaml patterns: - name: use_winston @@ -72,7 +72,7 @@ grit apply use_winston Run `grit check` to enforce your patterns as [custom lints](https://docs.grit.io/guides/ci). -``` +```sh grit check ``` @@ -107,6 +107,7 @@ GritQL comes from our experiences with conducting large scale refactors and migr Usually, migrations start with exploratory work to figure out the scope of the problem—often using simple grep searches. These are easy to start with, but most migrations end up accumulating additional requirements like ensuring the right packages are imported and excluding cases which don’t have a viable migration path. Eventually, any complex migration ends up being a full codemod program written with a tool like [jscodeshift](https://github.com/facebook/jscodeshift). This comes with its own problems: + - Most of the exploratory work has to be abandoned as you figure out how to represent your original regex search as an AST. - Reading/writing a codemod requires mentally translating from AST names back to what source code actually looks like. - Most frameworks are not composable, so you’re stuck copying patterns back and forth. @@ -114,6 +115,7 @@ Eventually, any complex migration ends up being a full codemod program written w - Codemod frameworks are language-specific, so if you’re hopping between multiple languages—or trying to migrate a shared API—you have to learn different frameworks. GritQL is our attempt to develop a powerful middle ground: + - Exploratory analysis is easy: just put a code snippet in backticks and use `$metavariables` for holes you want to represent. - Incrementally add complexity by introducing side conditions with where clauses. - Reuse named patterns to avoid rebuilding queries, and use shared patterns from our [standard library](https://github.com/getgrit/stdlib) for common tasks like ensuring modules are imported.