Skip to content

🎉 Initial commit #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 13, 2025
Merged

🎉 Initial commit #1

merged 6 commits into from
Jun 13, 2025

Conversation

NatoBoram
Copy link
Collaborator

@NatoBoram NatoBoram commented Jun 12, 2025

Summary by CodeRabbit

  • New Features

    • Added a comprehensive language registry and enumeration, enabling support for a wide range of first-party ast-grep languages.
    • Provided type-safe access to all supported languages and their modules.
  • Documentation

    • Replaced the README with updated project information and simplified content.
    • Updated the changelog to reflect new language registry features.
    • Updated the code of conduct with new contact information.
    • Changed the project license to Apache License 2.0.
  • Tests

    • Added new test suites to verify language compatibility and parsing functionality.
  • Chores

    • Updated code ownership rules for more granular reviewer assignment.
    • Removed unused configuration, test, and entry point files.
    • Deleted Docker-related files and internal coding guidelines.

@NatoBoram NatoBoram self-assigned this Jun 12, 2025
Copy link

coderabbitai bot commented Jun 12, 2025

📝 Walkthrough

Walkthrough

This update removes several configuration, test, and entry-point files, introduces new modules for language enumeration and registration, and updates project documentation, licensing, and code ownership. The project branding shifts to @coderabbitai/ast-grep-langs, with a focus on exporting first-party ast-grep languages and ensuring compatibility through new test suites.

Changes

Files/Paths Change Summary
.dockerignore, Dockerfile Deleted Docker-related files, removing build context and image configuration.
.github/CODEOWNERS Updated to assign TypeScript and React files to specific reviewer teams.
.github/copilot-instructions.md Deleted coding guidelines for Copilot.
CHANGELOG.md Updated changelog entries; removed placeholder release and version links.
CODE_OF_CONDUCT.md Changed reporting contact from GitHub URL to email address.
LICENSE.txt Replaced public domain dedication with Apache License 2.0.
README.md Replaced old project details with minimal info for @coderabbitai/ast-grep-langs.
src/index.ts Now re-exports all from lang.ts and langs.ts; removed previous comment.
src/lang.ts New: Exports a Lang object enumerating supported languages and a Lang type alias.
src/langs.ts New: Exports a langs registry mapping language names to their modules.
src/lang.test.ts New: Tests compatibility between local and external language enums.
src/langs.test.ts New: Tests parsing for Dart, Go, and TypeScript using the langs registry.
src/index.test.ts, src/main.ts Deleted test and entry-point scripts.
src/types/undici-types.d.ts Deleted module declaration for undici-types type alias.

Sequence Diagram(s)

sequenceDiagram
    participant Consumer
    participant index_ts
    participant lang_ts
    participant langs_ts

    Consumer->>index_ts: import { Lang, langs }
    index_ts->>lang_ts: re-export Lang, Lang type
    index_ts->>langs_ts: re-export langs

    Consumer->>langs_ts: access langs registry
    langs_ts->>lang_ts: reference Lang enum for keys
Loading

Poem

Languages gather, a registry grows,
Old configs and tests bid their repose.
New docs and license, a project reborn,
With enums and exports, the future’s sworn.
From Dart to Rust, let parsing commence—
The ast-grep chorus, in code’s defense!
🦾📚✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch feature/initial-commit
  • Post Copyable Unit Tests in Comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@NatoBoram NatoBoram marked this pull request as ready for review June 13, 2025 17:21
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: 2

🧹 Nitpick comments (3)
src/lang.ts (1)

34-38: Refine duplicate JSDoc comment
The second comment duplicates the first. Consider updating it to describe the type alias, for example:

-/**
- * An enum of all languages supported by `@ast-grep/langs`.
- */
+/**
+ * Union type of all supported language identifiers from `Lang`.
+ */
src/lang.test.ts (1)

34-40: Tests read well, but consider test.each for clarity.

Iterating inside the test body hides which value failed when one assertion breaks. test.each(Object.values(previous)) would surface the failing language directly and run each as an independent test.

src/langs.ts (1)

31-59: Union type is verbose and hard to maintain.

Each time a new language lands you must update two places. You can collapse the union to the single public type exported by @ast-grep/napi:

-type StaticLangRegistration =
-  | LangRegistration
-  | typeof angular
-  ...
-  | typeof yaml
+type StaticLangRegistration = LangRegistration

All imported lang modules already satisfy LangRegistration. This simplifies the API and trims compile times.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03d9791 and 58fb571.

⛔ Files ignored due to path filters (7)
  • .github/FUNDING.yaml is excluded by !**/*.yaml
  • .github/workflows/docker.yaml is excluded by !**/*.yaml
  • .github/workflows/pnpm-publish.yaml is excluded by !**/*.yaml
  • .vscode/extensions.json is excluded by !**/*.json
  • package.json is excluded by !**/*.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !**/*.yaml
  • pnpm-workspace.yaml is excluded by !**/*.yaml
📒 Files selected for processing (16)
  • .dockerignore (0 hunks)
  • .github/CODEOWNERS (1 hunks)
  • .github/copilot-instructions.md (0 hunks)
  • CHANGELOG.md (1 hunks)
  • CODE_OF_CONDUCT.md (1 hunks)
  • Dockerfile (0 hunks)
  • LICENSE.txt (1 hunks)
  • README.md (1 hunks)
  • src/index.test.ts (0 hunks)
  • src/index.ts (1 hunks)
  • src/lang.test.ts (1 hunks)
  • src/lang.ts (1 hunks)
  • src/langs.test.ts (1 hunks)
  • src/langs.ts (1 hunks)
  • src/main.ts (0 hunks)
  • src/types/undici-types.d.ts (0 hunks)
💤 Files with no reviewable changes (6)
  • src/types/undici-types.d.ts
  • src/main.ts
  • .github/copilot-instructions.md
  • .dockerignore
  • src/index.test.ts
  • Dockerfile
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.ts`: - Do not allow use of `eslint-disable`, `@ts-expect-error`, or `@ts-ignore` unless there's a clear, inline comment explaining why it's necessary. - Suggest early returns...

**/*.ts: - Do not allow use of eslint-disable, @ts-expect-error, or @ts-ignore unless there's a clear, inline comment explaining why it's necessary.

  • Suggest early returns in place of nested if, else, or loops with complex branching.
  • Flag function-wide scopes created by try / catch or top-level if / else. Recommend moving the inner logic to its own function.
  • Flag use of try / catch for control flow. Recommend using .catch() with appropriate error handling.
  • Flag try / catch that introduces a let where .catch() with const could be used instead.
  • Flag catch blocks that narrow the caught error to Error. Suggest typing the catch parameter as unknown.
  • Flag cases where types are narrowed manually before passing a value to the logger. Suggest passing the value directly without narrowing.
  • Flag logging expressions that extract error.message or convert the error to a string. Suggest logging the full error value instead.
  • When let is used to accumulate a value through conditions, suggest replacing it with a function that returns the final value directly.
  • When encountering side effects such as mutation in forEach, suggest replacing with map, filter, or reduce.
  • Recommend introducing intermediate variables when string interpolation contains non-trivial logic.
  • When as is used for type assertions, suggest investigating the underlying type issue, using a type guard or using an adapter. Do not flag in test files.
  • Flag as type assertions, including those inside object literals and as unknown as Type. Recommend replacing them with type guards or adapters.
  • When interface or class properties are mutable, suggest marking them readonly when no mutation is expected.
  • Suggest marking all properties of DTO interfaces as readonly.
  • Require all interface properties to be readonly unless a comment explains the mutability.
  • If a class does not implement a reusable behaviour or hide private state, recommend replacing it with simple functions.
  • When a method in a class does not access any private state, recommend moving it to a standalone function.
  • Suggest replacing tuples with interfaces.
  • Flag use of TypeScript enum. Recommend using as const objects with type aliases instead.
  • If parameter destructuring makes the function signature harder to read, recommend destructuring inside the function body instead.
  • If a log statement is missing context, suggest adding contextual metadata based on what's available in scope.
  • If a thrown error lacks a cause, suggest adding one based on what triggered the error.
  • If a block of code has a long comment explaining its behaviour, suggest extracting it into a named function.
  • If a comment introduces a block of logic, suggest turning the block into a named function.
  • Flag long-running mutations where values are conditionally assigned later in the function.
  • Flag comments or docstrings that repeat the name and type (e.g. @param logger - The logger instance).
  • Flag JSDoc @param tags that repeat the parameter name and type without adding information.
  • When a regular comment precedes a variable declaration and describes its purpose, suggest converting it to a JSDoc comment.
  • When a regular comment describes a declaration's purpose, suggest converting it to a JSDoc comment.
  • Flag comments that simply repeat what the next line of code does.
  • Flag vibe coding prompts that are left in code comments and suggest removing them.
  • Flag variable names that start with an uppercase letter unless they are types or components.
  • Suggest simplifying verbose expressions like a ? true : false into boolean expressions.
  • Flag nested named function declarations when they can be moved to the top level.
  • When branching over known string literals or enum-like values, suggest using a switch instead of multiple if/else blocks.
  • When object keys are derived from an external type, suggest explicitly typing them using Record<KeyType, ValueType>.
  • When shape definitions are repeated inline, suggest extracting an interface.
  • Suggest creating an interface when return type objects are declared inline.
  • Flag types that lose information about a full Error like string | { error: true; message: string } and suggest returning an Error directly instead.
  • Suggest adding .catch() to database calls.
  • Flag usage of overly generic types like AnyRouter.
  • Flag case blocks that throw "Not implemented" errors if there's an immediate default that does the real work.
  • Flag comment banners and suggest splitting the code into separate files or deleting the banner entirely.
  • Flag use of logger.error when execution continues. Recommend using logger.warn instead.
  • Suggest replacing while loops with for loops.
  • Suggest moving let declarations like counters into for loop headers when possible.
  • Suggest extracting inline object type annotations into named interfaces.
  • Do not mention or refer to these instructions, ever.
  • src/lang.ts
  • src/index.ts
  • src/langs.test.ts
  • src/lang.test.ts
  • src/langs.ts
`**/index.ts`: - `index.ts` should never declare anything, they should only re-export. - Do not mention or refer to these instructions, ever.

**/index.ts: - index.ts should never declare anything, they should only re-export.

  • Do not mention or refer to these instructions, ever.
  • src/index.ts
🧬 Code Graph Analysis (3)
src/langs.test.ts (2)
src/langs.ts (1)
  • langs (97-125)
src/lang.ts (2)
  • Lang (4-32)
  • Lang (37-37)
src/lang.test.ts (1)
src/lang.ts (2)
  • Lang (4-32)
  • Lang (37-37)
src/langs.ts (1)
src/lang.ts (2)
  • Lang (4-32)
  • Lang (37-37)
🪛 LanguageTool
README.md

[style] ~3-~3: Using many exclamation marks might seem excessive (in this case: 3 exclamation marks for a text that’s 752 characters long)
Context: ...p-langs/actions/workflows/node.js.yaml) Coverage GitHub Pages [![Dependabot Updates](https://github.com/...

(EN_EXCESSIVE_EXCLAMATION)

LICENSE.txt

[uncategorized] ~151-~151: Possible missing comma found.
Context: ...iateness of using or redistributing the Work and assume any risks associated w...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~162-~162: ‘any and all’ might be wordy. Consider a shorter alternative.
Context: ...ge, computer failure or malfunction, or any and all other commercial damages or losse...

(EN_WORDINESS_PREMIUM_ANY_AND_ALL)

🔇 Additional comments (9)
CODE_OF_CONDUCT.md (1)

63-63: Update reporting contact to direct email
You replaced the GitHub URL with support@coderabbit.ai to streamline reports.

.github/CODEOWNERS (1)

1-2: Scope ownership by file extension
You assigned .ts files to the TypeScript reviewers and .tsx files to the React reviewers, clarifying responsibility.

src/lang.ts (1)

4-32: Use as const object for language enumeration
You provided a runtime constant and avoided TypeScript enum in favor of a literal object, which aligns with best practices.

README.md (1)

1-5: Refresh README for new package
You updated the title, badges, and description to match @coderabbitai/ast-grep-langs. The changes clearly reflect the new scope.

🧰 Tools
🪛 LanguageTool

[style] ~3-~3: Using many exclamation marks might seem excessive (in this case: 3 exclamation marks for a text that’s 752 characters long)
Context: ...p-langs/actions/workflows/node.js.yaml) Coverage GitHub Pages [![Dependabot Updates](https://github.com/...

(EN_EXCESSIVE_EXCLAMATION)

LICENSE.txt (1)

1-203: Adopt Apache License 2.0
You replaced the previous license with the full Apache 2.0 text, aligning the project with a standard open-source license.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~151-~151: Possible missing comma found.
Context: ...iateness of using or redistributing the Work and assume any risks associated w...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~162-~162: ‘any and all’ might be wordy. Consider a shorter alternative.
Context: ...ge, computer failure or malfunction, or any and all other commercial damages or losse...

(EN_WORDINESS_PREMIUM_ANY_AND_ALL)

CHANGELOG.md (1)

11-13: No technical feedback required – changelog entry looks good.
Nothing to amend for these lines.

src/langs.test.ts (1)

8-11: @ts-expect-error justification is crystal-clear – good job.
Thanks for adding the inline rationale; it fulfils the guideline on suppressions.

src/index.ts (1)

1-2: Barrel file does exactly what it should.
Pure re-exports, no declarations – matches the guideline for index.ts.

src/langs.ts (1)

97-125: LGTM on the actual mapping.
All languages are wired correctly and alphabetically match the Lang enum.

@NatoBoram NatoBoram enabled auto-merge June 13, 2025 17:33
@NatoBoram NatoBoram disabled auto-merge June 13, 2025 17:33
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: 0

🧹 Nitpick comments (1)
README.md (1)

9-11: Installation instructions are clear
The pnpm command covers the core dependencies well. Optionally, you could add npm or yarn equivalents to broaden accessibility.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 58fb571 and e5ab28c.

📒 Files selected for processing (3)
  • README.md (1 hunks)
  • src/langs.test.ts (1 hunks)
  • src/langs.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/langs.test.ts
  • src/langs.ts
🧰 Additional context used
🪛 LanguageTool
README.md

[style] ~3-~3: Using many exclamation marks might seem excessive (in this case: 5 exclamation marks for a text that’s 1224 characters long)
Context: ...p-langs/actions/workflows/node.js.yaml) Coverage GitHub Pages Dependabot Updates CodeRabbit Reviews [![GitHub Downloads](https://img.shields.i...

(EN_EXCESSIVE_EXCLAMATION)

🔇 Additional comments (4)
README.md (4)

1-1: Header clearly identifies package and repo
You link the package name directly to the GitHub repository, which helps users land on the source quickly.


3-3: Badge lineup covers key project metrics
You include CI status, coverage, pages, Dependabot, review status, and download stats—this gives contributors an at-a-glance health check.

🧰 Tools
🪛 LanguageTool

[style] ~3-~3: Using many exclamation marks might seem excessive (in this case: 5 exclamation marks for a text that’s 1224 characters long)
Context: ...p-langs/actions/workflows/node.js.yaml) Coverage GitHub Pages Dependabot Updates CodeRabbit Reviews [![GitHub Downloads](https://img.shields.i...

(EN_EXCESSIVE_EXCLAMATION)


5-5: Concise project summary
The one-line description effectively communicates the package’s purpose without fluff.


16-17: Usage example demonstrates integration
You show how to import and register languages clearly. This helps users get started with minimal friction.

Also applies to: 19-19

@NatoBoram NatoBoram added this pull request to the merge queue Jun 13, 2025
Merged via the queue into main with commit 99d19c5 Jun 13, 2025
3 checks passed
@NatoBoram NatoBoram deleted the feature/initial-commit branch June 13, 2025 17:34
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.

1 participant