mirror of
https://github.com/MODSetter/SurfSense.git
synced 2025-09-01 18:19:08 +00:00
Recurse rules
This commit is contained in:
parent
d98dfd40b5
commit
7cc8cd6127
5 changed files with 107 additions and 0 deletions
1
.recurseml.yaml
Normal file
1
.recurseml.yaml
Normal file
|
@ -0,0 +1 @@
|
|||
rules: .rules/
|
28
.rules/avoid_source_deduplication.mdc
Normal file
28
.rules/avoid_source_deduplication.mdc
Normal file
|
@ -0,0 +1,28 @@
|
|||
```yaml
|
||||
name: avoid-source-deduplication
|
||||
description: Preserve unique source entries in search results to maintain proper citation tracking
|
||||
globs: ['**/connector_service.py', '**/search_service.py']
|
||||
alwaysApply: true
|
||||
```
|
||||
|
||||
Search result processing should preserve all source entries to maintain accurate citation tracking, rather than deduplicating sources.
|
||||
|
||||
❌ Bad - Deduplicating sources:
|
||||
```python
|
||||
mapped_sources = {}
|
||||
for chunk in chunks:
|
||||
source_key = chunk.get('url') or chunk.get('title')
|
||||
if source_key not in mapped_sources:
|
||||
mapped_sources[source_key] = create_source(chunk)
|
||||
sources_list = list(mapped_sources.values())
|
||||
```
|
||||
|
||||
✅ Good - Preserving unique sources:
|
||||
```python
|
||||
sources_list = []
|
||||
for chunk in chunks:
|
||||
source = create_source(chunk)
|
||||
sources_list.append(source)
|
||||
```
|
||||
|
||||
Each chunk should maintain its unique source reference for proper citation tracking.
|
28
.rules/consistent_container_image_sources.mdc
Normal file
28
.rules/consistent_container_image_sources.mdc
Normal file
|
@ -0,0 +1,28 @@
|
|||
```yaml
|
||||
name: consistent-container-image-sources
|
||||
description: Maintain consistent image sources in Docker compose files using authorized registries
|
||||
globs: ['**/docker-compose.yml', '**/docker-compose.*.yml']
|
||||
alwaysApply: true
|
||||
```
|
||||
|
||||
Docker compose files should use consistent image sources from authorized registries rather than local builds in production configurations.
|
||||
|
||||
❌ Bad - Mixing build and image sources:
|
||||
```yaml
|
||||
services:
|
||||
frontend:
|
||||
build: ./frontend
|
||||
backend:
|
||||
image: ghcr.io/org/backend:latest
|
||||
```
|
||||
|
||||
✅ Good - Consistent image sources:
|
||||
```yaml
|
||||
services:
|
||||
frontend:
|
||||
image: ghcr.io/org/frontend:latest
|
||||
backend:
|
||||
image: ghcr.io/org/backend:latest
|
||||
```
|
||||
|
||||
Use build contexts only in development compose files.
|
22
.rules/no_env_files_in_repo.mdc
Normal file
22
.rules/no_env_files_in_repo.mdc
Normal file
|
@ -0,0 +1,22 @@
|
|||
```yaml
|
||||
name: no-env-files-in-repo
|
||||
description: Prevent committing environment and configuration files containing sensitive credentials
|
||||
globs: ['**/.env', '**/.env.*', '**/config/*.yml', '**/config/*.yaml']
|
||||
alwaysApply: true
|
||||
```
|
||||
|
||||
Configuration files like `.env` should never be committed to version control as they often contain sensitive information like API keys, passwords, and tokens.
|
||||
|
||||
❌ Bad - Committing .env files:
|
||||
```
|
||||
POSTGRES_DATABASE_URL=postgresql+psycopg2://user:password@localhost:5432/db
|
||||
API_KEY=sk-1234567890abcdef
|
||||
```
|
||||
|
||||
✅ Good - Use .env.example instead:
|
||||
```
|
||||
POSTGRES_DATABASE_URL=postgresql+psycopg2://user:password@host:5432/dbname
|
||||
API_KEY=your-api-key-here
|
||||
```
|
||||
|
||||
Add `.env` and similar config files to .gitignore and provide example templates instead.
|
28
.rules/require_unique_id_props.mdc
Normal file
28
.rules/require_unique_id_props.mdc
Normal file
|
@ -0,0 +1,28 @@
|
|||
```yaml
|
||||
name: require-unique-id-props
|
||||
description: Ensure unique key props are provided when mapping arrays to React elements
|
||||
globs: ['**/*.tsx', '**/*.jsx']
|
||||
alwaysApply: true
|
||||
```
|
||||
|
||||
When mapping arrays to React elements, each element must have a unique key prop to help React efficiently update the DOM.
|
||||
|
||||
❌ Bad - Missing key prop:
|
||||
```jsx
|
||||
{items.map((item) => (
|
||||
<Link href={`/dashboard/${item.id}`}>
|
||||
<Card>{item.name}</Card>
|
||||
</Link>
|
||||
))}
|
||||
```
|
||||
|
||||
✅ Good - With key prop:
|
||||
```jsx
|
||||
{items.map((item) => (
|
||||
<Link key={item.id} href={`/dashboard/${item.id}`}>
|
||||
<Card>{item.name}</Card>
|
||||
</Link>
|
||||
))}
|
||||
```
|
||||
|
||||
Keys should be stable, predictable, and unique among siblings.
|
Loading…
Add table
Reference in a new issue