-
Notifications
You must be signed in to change notification settings - Fork 0
🎉 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
Conversation
📝 WalkthroughWalkthroughThis 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 Changes
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
Poem
✨ Finishing Touches
🧪 Generate Unit Tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 considertest.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 = LangRegistrationAll 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
⛔ 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 ofeslint-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-levelif
/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 alet
where.catch()
withconst
could be used instead.- Flag
catch
blocks that narrow the caughterror
toError
. Suggest typing thecatch
parameter asunknown
.- 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 withmap
,filter
, orreduce
.- 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 andas 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 usingas 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 multipleif/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
likestring | { error: true; message: string }
and suggest returning anError
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 immediatedefault
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 usinglogger.warn
instead.- Suggest replacing
while
loops withfor
loops.- Suggest moving
let
declarations like counters intofor
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)
[
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 withsupport@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
: Useas const
object for language enumeration
You provided a runtime constant and avoided TypeScriptenum
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.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 forindex.ts
.src/langs.ts (1)
97-125
: LGTM on the actual mapping.
All languages are wired correctly and alphabetically match theLang
enum.
There was a problem hiding this 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
Thepnpm
command covers the core dependencies well. Optionally, you could addnpm
oryarn
equivalents to broaden accessibility.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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
🔇 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
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
Summary by CodeRabbit
New Features
Documentation
Tests
Chores