Skip to content
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c77b54f
feat: add init cursor command
SK8-infi Oct 30, 2025
85a1a0e
feat: add init cursor command
SK8-infi Oct 30, 2025
d59ed3d
Delete package-lock.json
SK8-infi Oct 30, 2025
2239479
Rename cursor.md to agents.md
SK8-infi Oct 30, 2025
85b681b
feat: add init cursor command
SK8-infi Oct 30, 2025
6746cec
Delete package-lock.json
SK8-infi Oct 30, 2025
89ddbff
Merge branch 'main' into main
SK8-infi Nov 8, 2025
6df021e
feat(cli): lingo.dev init cursor Command for .cursorrules Setup (#110…
SK8-infi Nov 10, 2025
890c58f
Merge branch 'main' of https://github.com/SK8-infi/lingo.dev
SK8-infi Nov 10, 2025
8d30df1
Delete agents.md
SK8-infi Nov 10, 2025
55a079a
feat(cli): lingo.dev init cursor Command for .cursorrules Setup (#110…
SK8-infi Nov 10, 2025
e864fbf
Merge branch 'main' of https://github.com/SK8-infi/lingo.dev
SK8-infi Nov 10, 2025
d657c6d
feat(cli): lingo.dev init cursor Command for .cursorrules Setup (#110…
SK8-infi Nov 10, 2025
44f9963
Merge branch 'main' into main
SK8-infi Nov 11, 2025
a80466e
feat(cli): lingo.dev init cursor Command for .cursorrules Setup (#110…
SK8-infi Nov 11, 2025
5a530f3
Merge branch 'main' of https://github.com/SK8-infi/lingo.dev
SK8-infi Nov 11, 2025
4fe3d16
Update packages/cli/src/cli/cmd/init/cursor.ts
SK8-infi Nov 12, 2025
f361eb9
Update packages/cli/src/cli/cmd/init/cursor.ts
SK8-infi Nov 12, 2025
ebe9d6e
Update packages/cli/assets/agents.md
SK8-infi Nov 12, 2025
13d14a9
Update packages/cli/src/cli/cmd/init/cursor.ts
SK8-infi Nov 12, 2025
00714d9
Update packages/cli/src/cli/cmd/init/cursor.ts
SK8-infi Nov 12, 2025
8e567eb
Merge branch 'main' into main
SK8-infi Nov 12, 2025
a068b0e
Merge branch 'main' into main
SK8-infi Nov 12, 2025
cdcaa90
Merge branch 'main' into main
SK8-infi Nov 12, 2025
6273c63
Merge branch 'main' into main
SK8-infi Nov 17, 2025
bd3f99b
Merge branch 'main' into main
SK8-infi Nov 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nasty-nails-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"lingo.dev": minor
---

feat: add init cursor command for .cursorrules setup
1 change: 1 addition & 0 deletions packages/cli/assets/agents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Test template for Cursor AI rules.
5 changes: 3 additions & 2 deletions packages/cli/src/cli/cmd/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ensurePatterns } from "../utils/ensure-patterns";
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


const openUrl = (path: string) => {
const settings = getSettings(undefined);
Expand Down Expand Up @@ -116,7 +117,6 @@ export default new InteractiveCommand()
throw new Error(`Invalid path: ${p}`);
}
}

return values;
})
.prompt(undefined) // make non-interactive
Expand Down Expand Up @@ -258,4 +258,5 @@ export default new InteractiveCommand()
if (!isInteractive) {
Ora().info("Please see https://lingo.dev/cli");
}
});
})
.addCommand(cursorInitCmd);
61 changes: 61 additions & 0 deletions packages/cli/src/cli/cmd/init/cursor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { InteractiveCommand, InteractiveOption } from "interactive-commander";
import Ora from "ora";
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import { confirm } from "@inquirer/prompts";

// Get the directory of this file (works in both dev and production)
const __dirname = path.dirname(fileURLToPath(import.meta.url));
// Access agents.md from assets directory (bundled with published package)
const AGENTS_MD = path.resolve(__dirname, "../assets/agents.md");
// Create .cursorrules in user's current working directory (their project)
const CURSORRULES = path.resolve(process.cwd(), ".cursorrules");

export default new InteractiveCommand()
.command("cursor")
.description(
"Initialize .cursorrules with i18n-specific instructions for Cursor AI.",
)
.addOption(
new InteractiveOption(
"-f, --force",
"Overwrite .cursorrules without prompt.",
).default(false),
)
.action(async (options) => {
const spinner = Ora();
// Read agents.md
let template: string;
try {
template = fs.readFileSync(AGENTS_MD, "utf-8");
} catch (err) {
spinner.fail(`Template not found: ${AGENTS_MD}`);
return process.exit(1);
}
// Check for existing .cursorrules
const exists = fs.existsSync(CURSORRULES);
let shouldWrite = true;
if (exists && !options.force) {
shouldWrite = await confirm({
message: ".cursorrules already exists. Overwrite?",
});
if (!shouldWrite) {
spinner.info("Skipped: .cursorrules left unchanged.");
return;
}
}
try {
fs.writeFileSync(CURSORRULES, template);
spinner.succeed("✓ Created .cursorrules");
spinner.info(
".cursorrules has been created with i18n-specific instructions for Cursor AI.",
);
if (!fs.existsSync(CURSORRULES)) {
spinner.fail(".cursorrules not found after write");
}
} catch (err) {
spinner.fail(`Failed to write .cursorrules: ${err}`);
process.exit(1);
}
});
Loading
Loading