Skip to content

Commit 05dede6

Browse files
committed
chore: cursor rules
1 parent 1e29e39 commit 05dede6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
description: Bootstraps a new CLI command
3+
globs:
4+
alwaysApply: false
5+
---
6+
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.
7+
8+
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
9+
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()`.
10+
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()`.
11+
12+
Example class for a command called `wow`:
13+
14+
```ts
15+
export class WowCommand extends ApifyCommand<typeof WowCommand> {
16+
static override name = 'wow' as const;
17+
18+
async run() {
19+
// Command logic here
20+
}
21+
}
22+
```
23+
24+
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`.
25+
26+
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.

0 commit comments

Comments
 (0)