Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
13 changes: 13 additions & 0 deletions packages/cli/assets/agents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Cursor AI i18n Rules

The following rules and guidelines should be followed to ensure proper internationalization (i18n) support in Cursor AI agents:

1. **Use translation keys**: All user-facing strings must use translation keys instead of hardcoded text. Reference the appropriate key from your locale files.
2. **Locale files**: Store translations in locale-specific files (e.g., `en.json`, `fr.json`). Ensure all supported languages are kept in sync.
3. **Fallback language**: Always provide a fallback language (usually English) for missing translations.
4. **Pluralization and formatting**: Use i18n libraries that support pluralization, date, and number formatting according to the user's locale.
5. **No concatenation**: Avoid string concatenation for translatable text. Use interpolation features provided by your i18n library.
6. **Contextual translations**: Provide context for translators where necessary, especially for ambiguous terms.
7. **Testing**: Test agents in multiple locales to ensure all strings are translated and formatting is correct.

_For more details, refer to the Cursor AI i18n documentation or contact the localization team._
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);
58 changes: 58 additions & 0 deletions packages/cli/src/cli/cmd/init/cursor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
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 file agents.md not found. Please reinstall the package.");
return process.exit(1);
}
// Check for existing .cursorrules
const exists = fs.existsSync(CURSORRULES);
let shouldWrite;
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.",
);
} catch (err) {
spinner.fail(`Failed to write .cursorrules: ${err}`);
process.exit(1);
}
});
Loading