Skip to content

Commit 8143a53

Browse files
authored
improve rules (#20)
1 parent 86c0707 commit 8143a53

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
globs: *.vue
3+
alwaysApply: false
4+
---
5+
6+
# Components
7+
8+
1. Use Primevue components for all UI components.
9+
2. Use `<script setup lang="ts">` for all components.
10+
11+
## Structure
12+
13+
Use the following layout for every component to keep imports and growth consistent:
14+
15+
```text
16+
ComponentName/
17+
├─ index.ts # Re-export (single public entry)
18+
├─ Container.vue # Main component implementation
19+
├─ useForm.ts # Optional: composable when logic grows (e.g. forms)
20+
└─ DependentComponent.vue
21+
```
22+
23+
ComponentName/index.ts
24+
```ts
25+
export { default as ComponentName } from "./Container.vue";
26+
```
27+
28+
When a child piece becomes complex or needs its own hook, use the same pattern as the parent:
29+
30+
```text
31+
ComponentName/
32+
└─ DependentComponent/
33+
├─ index.ts
34+
└─ Container.vue
35+
```
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
description: Caido SDK API Validation
3+
globs:
4+
alwaysApply: true
5+
---
6+
7+
# Caido SDK API Validation
8+
9+
## Valid API Usage
10+
11+
Always use documented Caido SDK APIs directly without runtime checks or validation.
12+
13+
- Good
14+
```typescript
15+
sdk.window.showToast("Message", { variant: "error" });
16+
sdk.backend.myFunction();
17+
sdk.commands.register("my-command", { name: "Command", run: () => {} });
18+
```
19+
20+
- Bad (NEVER do this)
21+
```typescript
22+
if ("showToast" in sdk.window && typeof sdk.window.showToast === "function") {
23+
sdk.window.showToast("Message");
24+
}
25+
```
26+
27+
## Rules
28+
29+
1. Never use runtime API existence checks (`typeof`, `in` operator)
30+
2. Never assume undocumented SDK methods exist
31+
3. If unsure about an API, ask for clarification rather than guessing
32+
33+
The SDK is typed and guaranteed to have the documented methods available.

templates/shared/cursor-rules/style.mdc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ alwaysApply: false
2020

2121
- Often use PrimeVue `Splitter` and `SplitterPanel` for vertical or horizontal layout.
2222
- Prefer to use `Card` PrimeVue components a lot, if needed add `h-full` to them via `pt` params.
23+
- Remember to use `<template #content>` and other named slots (like `#header`, `#footer`) in Card and other PrimeVue components that support them.
24+
2325

2426
Example:
2527

@@ -31,6 +33,10 @@ Example:
3133
content: { class: 'h-full flex flex-col' },
3234
}"
3335
>
36+
<template #content>
37+
...
38+
</template #content>
39+
</Card>
3440
```
3541

3642
### Enviroment

0 commit comments

Comments
 (0)