Skip to content

Added initial repo cursor rules and other docs for AI #1783

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 2 commits into from
Mar 11, 2025

Conversation

ericallam
Copy link
Member

@ericallam ericallam commented Mar 10, 2025

Summary by CodeRabbit

  • Documentation

    • Introduced new guidelines for executing commands throughout the monorepo with clear usage examples.
    • Expanded documentation covering repository structure and the configuration of the main web application.
    • Added detailed instructions and best practices for writing and running tests.
    • Provided comprehensive reference material outlining repository components and testing procedures.
  • Chores

    • Updated ignore settings to streamline tracking by excluding specific directories and files.

Copy link

changeset-bot bot commented Mar 10, 2025

⚠️ No Changeset found

Latest commit: 5db9958

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

coderabbitai bot commented Mar 10, 2025

Walkthrough

Several new documentation and configuration files have been added to the monorepo. Guidelines now cover how to execute commands using pnpm run, explain the repository structure, configure the web application, and provide best practices for writing tests. A new .cursorignore file specifies directories and files to be excluded from tracking. Additionally, two reference markdown documents detail the overall repository layout and the testing framework using Vitest. These changes establish clear instructions and consistency across various aspects of the project.

Changes

Files Summary
.cursor/rules/executing-commands.mdc,
.cursor/rules/repo.mdc,
.cursor/rules/webapp.mdc,
.cursor/rules/writing-tests.mdc
New guideline and configuration files covering command execution, monorepo structure, webapp configuration, and writing tests.
.cursorignore Specifies directories and files to be ignored by the cursor, streamlining tracking.
ai/references/repo.md,
ai/references/tests.md
Documentation files providing an overview of the repository structure and detailing testing practices with Vitest.

Poem

I'm Bunny, hopping through the code,
With docs and guidelines lighting my road,
Commands and tests now clear as day,
Monorepo paths lead the bunny way,
A carrot-filled journey with each new file,
Code and carrots make my hops worthwhile!


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
🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

Copy link
Contributor

@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: 1

🧹 Nitpick comments (11)
.cursorignore (1)

1-7: Well-structured ignore configuration

The .cursorignore file correctly lists directories and files to be excluded from cursor tracking, which helps improve performance and focus. The configuration includes specific app directories and common configuration files.

However, consider adding a brief comment at the top of the file explaining its purpose for future contributors.

+# Directories and files to be ignored by cursor
 apps/docker-provider/
 apps/kubernetes-provider/
 apps/proxy/
 apps/coordinator/
 packages/rsc/
 .changeset
 .zed
.cursor/rules/writing-tests.mdc (1)

1-6: Clear and concise test guidelines reference

This rule effectively directs users to the detailed test documentation while providing the basic context. The use of the mdc: link format ensures proper navigation within the monorepo's documentation system.

For enhanced usability, consider adding a brief overview of the key testing principles before referring to the detailed guide.

 ---
 description: How to write tests in the monorepo
 globs: 
 alwaysApply: true
 ---
+We use Vitest as our testing framework and prefer real integrations over mocks.
+
 Follow our [tests.md](mdc:ai/references/tests.md) guide for how to write tests in the monorepo.
.cursor/rules/repo.mdc (1)

1-6: Effective monorepo structure documentation link

The rule correctly points users to the detailed documentation about the repository structure. The alwaysApply: true setting ensures all users will benefit from this knowledge.

To improve immediate usefulness, consider adding a brief overview of the repo's main components directly in this file.

 ---
 description: understanding the structure of the monorepo
 globs: 
 alwaysApply: true
 ---
+Our monorepo contains:
+- Apps: webapp (Remix), supervisor
+- Public packages: trigger-sdk, cli-v3, core, etc.
+- Internal packages: database, run-engine, redis-worker, etc.
+
 We've documented the structure of our monorepo here: [repo.md](mdc:ai/references/repo.md)
.cursor/rules/webapp.mdc (1)

24-26: Informative historical context for the Run Engine

The explanation of the legacy run engine versus Run Engine 2.0 provides valuable context for developers. However, there's a minor grammatical error in the first sentence.

 ## Legacy run engine vs Run Engine 2.0

-We originally the Trigger.dev "Run Engine" not as a single system, but just spread out all over the codebase, with no real separate or encapsulation. And we didn't even call it a "Run Engine". With Run Engine 2.0, we've completely rewritten big parts of the way the system works, and moved it over to an internal package called `@internal/run-engine`. So we've retroactively named the previous run engine "Legacy run engine". We're focused almost exclusively now on moving to Run Engine 2.0 and will be deprecating and removing the legacy run engine code eventually.
+We originally implemented the Trigger.dev "Run Engine" not as a single system, but just spread out all over the codebase, with no real separation or encapsulation. And we didn't even call it a "Run Engine". With Run Engine 2.0, we've completely rewritten big parts of the way the system works, and moved it over to an internal package called `@internal/run-engine`. So we've retroactively named the previous run engine "Legacy run engine". We're focused almost exclusively now on moving to Run Engine 2.0 and will be deprecating and removing the legacy run engine code eventually.
ai/references/tests.md (3)

26-26: Improve Wording for Clarity on Mock Statement.
The phrase “almost NEVER mock anything” may sound overly emphatic and wordy. Consider replacing it with a more concise alternative such as “rarely mock anything” or “avoid using mocks.”

🧰 Tools
🪛 LanguageTool

[style] ~26-~26: ‘almost NEVER’ might be wordy. Consider a shorter alternative.
Context: ...ng Tests We use vitest for testing. We almost NEVER mock anything. Start with a top-level "...

(EN_WORDINESS_PREMIUM_ALMOST_NEVER)


73-78: Reduce Repetitive List Wording.
The bullet list items all start with “Do not …”, which makes the section feel repetitive. Consider combining these points into a single, consolidated statement (for example, “Avoid using mocks, spies, stubs, fakes, or sinon in tests”) to improve readability.

🧰 Tools
🪛 LanguageTool

[style] ~75-~75: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...nything. - Do not use mocks in tests. - Do not use spies in tests. - Do not use st...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~76-~76: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...n tests. - Do not use spies in tests. - Do not use stubs in tests. - Do not use fa...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~77-~77: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...n tests. - Do not use stubs in tests. - Do not use fakes in tests. - Do not use si...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~78-~78: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...n tests. - Do not use fakes in tests. - Do not use sinon in tests. - Structure eac...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


80-80: Rephrase Informal Language.
The phrase “Feel free to write long test names” can be reworded to a more formal suggestion, such as “Consider using descriptive test names to improve clarity.”

🧰 Tools
🪛 LanguageTool

[style] ~80-~80: The phrase ‘feel free to’ is used quite frequently. Consider using a less frequent alternative to set your writing apart from others and make it sound more professional.
Context: ...a setup, action, and assertion style. - Feel free to write long test names. - If there is an...

(FEEL_FREE_TO_STYLE_ME)

ai/references/repo.md (4)

16-16: Add Comma for Clarity.
In the sentence describing the react-hooks package, consider adding a comma after “react hooks” to improve clarity. For example:

- defines some useful react hooks like our realtime hooks.
+ defines some useful react hooks, like our realtime hooks.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~16-~16: Possible missing comma found.
Context: ...s/react-hooks defines some useful react hooks like our realtime hooks. See our [Realt...

(AI_HYDRA_LEO_MISSING_COMMA)


20-20: Improve Punctuation for Readability.
A comma after “usually” would help the sentence flow better. For example:

- used internally only, not published, and usually they have a tsc build step
+ used internally only, not published, and usually, they have a tsc build step
🧰 Tools
🪛 LanguageTool

[typographical] ~20-~20: Consider adding a comma after ‘usually’ for more clarity.
Context: ...sed internally only, not published, and usually they have a tsc build step and are used...

(RB_LY_COMMA)


22-22: Correct Possessive Form.
Replace “it's lifecycle” with “its lifecycle” to correctly indicate the possessive form. For example:

- handles moving a run all the way through it's lifecycle
+ handles moving a run all the way through its lifecycle
🧰 Tools
🪛 LanguageTool

[uncategorized] ~22-~22: Did you mean “its” (the possessive pronoun)?
Context: ...andles moving a run all the way through it's lifecycle - /internal-packages/re...

(ITS_PREMIUM)


23-23: Fix Typo in "system".
There is a typo in “sytem” which should be corrected to “system” for accuracy. For example:

- implements a custom background job/worker sytem powered by redis
+ implements a custom background job/worker system powered by redis
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6cf86d5 and 5db9958.

📒 Files selected for processing (7)
  • .cursor/rules/executing-commands.mdc (1 hunks)
  • .cursor/rules/repo.mdc (1 hunks)
  • .cursor/rules/webapp.mdc (1 hunks)
  • .cursor/rules/writing-tests.mdc (1 hunks)
  • .cursorignore (1 hunks)
  • ai/references/repo.md (1 hunks)
  • ai/references/tests.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
ai/references/repo.md

[uncategorized] ~16-~16: Possible missing comma found.
Context: ...s/react-hooks defines some useful react hooks like our realtime hooks. See our [Realt...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~20-~20: Consider adding a comma after ‘usually’ for more clarity.
Context: ...sed internally only, not published, and usually they have a tsc build step and are used...

(RB_LY_COMMA)


[uncategorized] ~22-~22: Did you mean “its” (the possessive pronoun)?
Context: ...andles moving a run all the way through it's lifecycle - /internal-packages/re...

(ITS_PREMIUM)

ai/references/tests.md

[style] ~26-~26: ‘almost NEVER’ might be wordy. Consider a shorter alternative.
Context: ...ng Tests We use vitest for testing. We almost NEVER mock anything. Start with a top-level "...

(EN_WORDINESS_PREMIUM_ALMOST_NEVER)


[style] ~75-~75: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...nything. - Do not use mocks in tests. - Do not use spies in tests. - Do not use st...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~76-~76: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...n tests. - Do not use spies in tests. - Do not use stubs in tests. - Do not use fa...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~77-~77: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...n tests. - Do not use stubs in tests. - Do not use fakes in tests. - Do not use si...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~78-~78: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...n tests. - Do not use fakes in tests. - Do not use sinon in tests. - Structure eac...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~80-~80: The phrase ‘feel free to’ is used quite frequently. Consider using a less frequent alternative to set your writing apart from others and make it sound more professional.
Context: ...a setup, action, and assertion style. - Feel free to write long test names. - If there is an...

(FEEL_FREE_TO_STYLE_ME)

⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
  • GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - npm)
  • GitHub Check: units / 🧪 Unit Tests
  • GitHub Check: typecheck / typecheck
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (5)
.cursor/rules/webapp.mdc (4)

1-5: Good configuration setup for webapp rules

The metadata configuration correctly specifies which files this rule applies to with appropriate glob patterns. Setting alwaysApply: false is appropriate since these rules are specific to webapp files only.


6-13: Comprehensive webapp overview with useful subsystem descriptions

This section effectively describes the main webapp architecture and its dependencies. The links to specific schema files and package configurations are particularly valuable.


14-22: Excellent testing guidance with practical examples

This section provides clear guidance on environment variable usage and testing best practices. The service/configuration separation principle is well explained with concrete examples.


28-37: Helpful code location references for common functionality

This section provides valuable pointers to important parts of the codebase. The detailed listings of API endpoints, configuration files, and service locations will help developers navigate the complex webapp structure.

ai/references/repo.md (1)

1-38: Overall Documentation is Clear and Informative.
The repo overview is well-structured and provides comprehensive details on the repository’s structure and components. Nice work on outlining both public and internal packages alongside other key resources.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~16-~16: Possible missing comma found.
Context: ...s/react-hooks defines some useful react hooks like our realtime hooks. See our [Realt...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~20-~20: Consider adding a comma after ‘usually’ for more clarity.
Context: ...sed internally only, not published, and usually they have a tsc build step and are used...

(RB_LY_COMMA)


[uncategorized] ~22-~22: Did you mean “its” (the possessive pronoun)?
Context: ...andles moving a run all the way through it's lifecycle - /internal-packages/re...

(ITS_PREMIUM)

Comment on lines +1 to +24
---
description: how to run commands in the monorepo
globs:
alwaysApply: true
---
Almost all commands in the monorepo should be executed when `pnpm run ...` from the root of the monorepo. For example, running tests for the `@internal/run-engine` internal package:

```
pnpm run dev --filter webapp
```

But often, when running tests, it's better to `cd` into the directory and then run tests:

```
cd apps/webapp
pnpm run test
```

This way you can run for a single file easily:

```
cd internal-packages/run-engine
pnpm run test ./src/engine/tests/ttl.test.ts
```
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Good command execution guidance with minor inconsistency

This documentation effectively explains how to run commands in the monorepo with helpful examples. However, there's an inconsistency in the first example - it mentions running tests for the @internal/run-engine package but the example shows pnpm run dev --filter webapp.

 ---
 description: how to run commands in the monorepo
 globs: 
 alwaysApply: true
 ---
-Almost all commands in the monorepo should be executed when `pnpm run ...` from the root of the monorepo. For example, running tests for the `@internal/run-engine` internal package:
+Almost all commands in the monorepo should be executed using `pnpm run ...` from the root of the monorepo. For example, running the development server for the webapp:

pnpm run dev --filter webapp


+For running tests for a specific package from the root:
+
+```
+pnpm run test --filter @internal/run-engine
+```
+
But often, when running tests, it's better to `cd` into the directory and then run tests:

cd apps/webapp
pnpm run test


This way you can run for a single file easily:

cd internal-packages/run-engine
pnpm run test ./src/engine/tests/ttl.test.ts

📝 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
---
description: how to run commands in the monorepo
globs:
alwaysApply: true
---
Almost all commands in the monorepo should be executed when `pnpm run ...` from the root of the monorepo. For example, running tests for the `@internal/run-engine` internal package:
```
pnpm run dev --filter webapp
```
But often, when running tests, it's better to `cd` into the directory and then run tests:
```
cd apps/webapp
pnpm run test
```
This way you can run for a single file easily:
```
cd internal-packages/run-engine
pnpm run test ./src/engine/tests/ttl.test.ts
```
---
description: how to run commands in the monorepo
globs:
alwaysApply: true
---
Almost all commands in the monorepo should be executed using `pnpm run ...` from the root of the monorepo. For example, running the development server for the webapp:

@ericallam ericallam merged commit de4ee19 into main Mar 11, 2025
12 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Mar 25, 2025
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