Skip to content

chore: cursor rules #829

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
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
26 changes: 26 additions & 0 deletions .cursor/rules/command-bootstrap.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
description: Bootstraps a new CLI command
globs:
alwaysApply: false
---
Always prompt for a name if one is not given to you. The name must be lowercased, and use dashes for separators, NOT spaces, NOT underscores.

Our base class for a command is in [apify-command.ts](mdc:src/lib/command-framework/apify-command.ts), import the `ApifyCommand` class, NOT the `BuiltApifyCommand` class
Arguments are imported from [args.ts](mdc:src/lib/command-framework/args.ts), by importing the `Args` constant. Always use the variables from there, example: `Args.string()`.
Flags are imported from [flags.ts](mdc:src/lib/command-framework/flags.ts), by importing the `Flags` constant. Always use the variables from there, example: `Flags.string()`.

Example class for a command called `wow`:

```ts
export class WowCommand extends ApifyCommand<typeof WowCommand> {
static override name = 'wow' as const;

async run() {
// Command logic here
}
}
```

Look at [validate-schema.ts](mdc:src/commands/validate-schema.ts), [upgrade.ts](mdc:src/commands/upgrade.ts) for how to define other properties in a command. Always mark the properties as `static override`.

Once a command is created, always add it to the end of the `apifyCommands` variable in [_register.ts](mdc:src/commands/_register.ts). If the user requests an `actor` command instead, update the `actorCommands` variable instead. If unsure, prompt the user for the type.
Loading