Skip to content

Conversation

@SK8-infi
Copy link

Add lingo.dev init cursor Command for .cursorrules Setup

Closes #1101

Summary

Adds a new cursor subcommand to lingo.dev init that automates the creation of a .cursorrules file in the project root by copying the template from agents.md.


Features & Implementation

  • New Command:
    lingo.dev init cursor

    • Generates .cursorrules in your repo root by copying the contents of agents.md (also in the root).
  • File Handling:

    • If .cursorrules already exists:
      • Prompts user for overwrite (unless run with --force, which skips prompt and overwrites directly).
      • Skips and notifies if user declines overwrite.
    • Fails with a clear error if agents.md does not exist.
  • User Feedback:

    • Success and info spinners/messages for all operations.
    • Clear warning/error output for missing templates or write issues.
  • CLI Structure:

    • Refactored init to support subcommands (project for the original logic, cursor as a sibling).
    • All code follows project structure and CLI command registration best practices.

Scenarios Tested

  • .cursorrules creation when file does not exist.
  • Overwriting an existing .cursorrules (prompt and forced mode).
  • Skipping overwrite if user answers "No".
  • Proper handling and messaging if agents.md is missing.
  • Works both interactively and with --force for scripted/non-interactive use.

User Experience

  • Usage:

    lingo.dev init cursor
    # or, for non-interactive scripting:
    lingo.dev init cursor --force
  • Output:

    ✓ Created .cursorrules
    📝 .cursorrules has been created with i18n-specific instructions for Cursor AI.
    

Ready for review!
This PR brings core parity with expected subcommand conventions and ensures proper rules bootstrapping for the Cursor AI developer workflow.

@SK8-infi SK8-infi changed the title Add lingo.dev init cursor Command for .cursorrules Setup feat(cli): lingo.dev init cursor Command for .cursorrules Setup (#1101) Oct 30, 2025
@SK8-infi
Copy link
Author

Hii @sumitsaurabh927
Can you please review the code and give the workflow approval.
Thanks

@SK8-infi
Copy link
Author

Hii @sumitsaurabh927 @The-Best-Codes
Can you please review the code please

Copy link
Contributor

@The-Best-Codes The-Best-Codes left a comment

Choose a reason for hiding this comment

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

Your PR is looking awesome @SK8-infi 🔥

I've left a review of a couple things that need fixed below. Also, some general reminders:

  • Run pnpm run format before committing
  • Run pnpm new to create a changeset (do this once for your PR)

@SK8-infi
Copy link
Author

@The-Best-Codes Thanks for reviewing the code. Resolved all the issues. The code looks much cleaner now. Please also do point if anything else is off.

Copy link
Contributor

@The-Best-Codes The-Best-Codes left a comment

Choose a reason for hiding this comment

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

Just one change I'd recommend making! I haven't tested locally to make sure everything is working fine, but your PR is looking great 😀

I also have two questions:

  • Will this work well on Windows
  • Will this work well in productions builds that are deployed to npm (the file tree is different in prod than in dev)

import updateGitignore from "../utils/update-gitignore";
import initCICD from "../utils/init-ci-cd";
import open from "open";
import cursorInitCmd from "./init/cursor";
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be imported in the packages/cli/src/cli/index.ts file! Basically you should be able to revert the changes in this file and import the cursor command there instead.

Copy link
Author

Choose a reason for hiding this comment

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

Hii @The-Best-Codes
I seem to be a little lost here. Won't adding it in index make it a top level command like "lingo.dev cursor". But we need it to be a subcommand of init like "lingo.dev init cursor".

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh gosh you might be right on that lol. Let me make sure when I get a chance

Copy link
Contributor

Choose a reason for hiding this comment

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

@SK8-infi I was wrong about this!
The current structure of subcommands in the codebase it to give the command a directory, an index.ts with the main command and then subcommands in the directory which are imported into index.ts.

So you might do something like this:

  • Create a init/ directory in cmd/
  • Create the cursor.ts in the init/ directory
  • Create an index.ts in init/ with the current init command logic and import and register the cursor subcommand there
  • Remove init.ts

...at least, that's what I would do. You can ask a maintainer too if you want more clarification!

Copy link
Author

Choose a reason for hiding this comment

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

Seems to be a systematic approach to me too(beneficial for other agent sub commands). But would require directory changes... Maybe I should ask maintainers' views

@sumitsaurabh927 @maxprilutskiy

@SK8-infi
Copy link
Author

Hii @The-Best-Codes
Did some minor tweaks. It will now work for both windows and prod.
For index.ts I left a reply and would appreciate some help
Thanks

@maxprilutskiy maxprilutskiy requested review from Copilot and removed request for The-Best-Codes November 12, 2025 02:37
Copilot finished reviewing on behalf of maxprilutskiy November 12, 2025 02:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new lingo.dev init cursor subcommand that automates the creation of a .cursorrules file by copying a template from the package's assets directory. The command supports interactive prompts for overwriting existing files and a --force flag for non-interactive usage.

Key changes:

  • New cursor subcommand under lingo.dev init for generating .cursorrules files
  • Asset template file (agents.md) added to the CLI package
  • Dependency updates in the monorepo lockfile (@types/node from 24.2.0 to 24.9.2)

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/cli/src/cli/cmd/init/cursor.ts Implements the new cursor subcommand with file copy logic, overwrite prompts, and --force flag support
packages/cli/src/cli/cmd/init.ts Registers the cursor subcommand to the init command; removes extraneous blank line
packages/cli/assets/agents.md Adds template file for .cursorrules content (currently contains placeholder text)
.changeset/nasty-nails-repair.md Documents the feature addition as a minor version bump
pnpm-lock.yaml Updates @types/node from 24.2.0 to 24.9.2 and associated transitive dependencies across the monorepo
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SK8-infi
Copy link
Author

@maxprilutskiy Resolved all the issues pointed by Copilot. Ready for review.

@SK8-infi
Copy link
Author

Hii @sumitsaurabh927
Having some issue in release.yml check. Can you please help in troubleshooting. Thanks
image

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.

Add lingo.dev init cursor command for .cursorrules setup

2 participants