Skip to content
Draft
Show file tree
Hide file tree
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
190 changes: 190 additions & 0 deletions .ai/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
# RedisInsight AI Development Rules

This directory contains the **single source of truth** for AI-assisted development rules and workflows in RedisInsight. These rules are used by multiple AI coding assistants:

- **Cursor** (via symlinks: `.cursor/rules/` and `.cursor/commands/`)
- **Augment** (via symlink: `.augment/`)
- **Windsurf** (via symlink: `.windsurfrules`)
- **GitHub Copilot** (via file: `.github/copilot-instructions.md`)

## MCP (Model Context Protocol) Setup

AI tools can access external services (JIRA, Confluence, GitHub) via MCP configuration.

### Initial Setup

1. **Copy the example configuration:**

```bash
cp env.mcp.example .env.mcp
```

2. **Get your Atlassian API token:**

- Go to: https://id.atlassian.com/manage-profile/security/api-tokens
- Create a classic token by pressing the first "Create Token" button
- Copy the token

3. **Edit `.env.mcp` with your credentials:**

```bash
ATLASSIAN_DOMAIN=your-domain.atlassian.net
[email protected]
ATLASSIAN_API_TOKEN=your-api-token-here
ATLASSIAN_JIRA_PROJECT=RI
```

4. **Verify your setup:**

**For Cursor users:**

- Restart Cursor to load the new MCP configuration
- Ask the AI: "Can you list all available MCP tools and test them?"
- The AI should be able to access JIRA, Confluence, GitHub, and other configured services

**For Augment users:**

```bash
npx @augmentcode/auggie --mcp-config mcp.json "go over all my mcp tools and make sure they work as expected"
```

**For GitHub Copilot users:**

- Note: GitHub Copilot does not currently support MCP integration
- MCP services (JIRA, Confluence, etc.) will not be available in Copilot

### Available MCP Services

The `mcp.json` file configures these services:

- **git** - Git operations (status, diff, log, branch management)
- **github** - GitHub integration (issues, PRs, repository operations)
- **memory** - Persistent context storage across sessions
- **sequential-thinking** - Enhanced reasoning for complex tasks
- **context-7** - Advanced context management
- **atlassian** - JIRA (RI-XXX tickets) and Confluence integration

**Note**: Never commit `.env.mcp` to version control (it's in `.gitignore`)!

## Structure

```
.ai/
β”œβ”€β”€ README.md # This file
β”œβ”€β”€ rules/ # Development rules and standards
β”‚ β”œβ”€β”€ 01-CODE_QUALITY.md # Linting, formatting, TypeScript
β”‚ β”œβ”€β”€ 02-FRONTEND.md # React, Redux, styled-components, component structure
β”‚ β”œβ”€β”€ 03-BACKEND.md # NestJS, API patterns
β”‚ β”œβ”€β”€ 04-TESTING.md # Testing standards and practices
β”‚ └── 05-WORKFLOW.md # Git workflow, commits, dev process
└── commands/ # AI workflow commands
β”œβ”€β”€ pr/
β”‚ β”œβ”€β”€ review.md # PR review workflow
β”‚ └── plan.md # PR planning workflow
β”œβ”€β”€ commit-message.md # Commit message generation
└── run-ui-tests.md # Custom test runner usage
```

## Project Overview

**RedisInsight** is a desktop application for Redis database management built with:

- **Frontend**: React 18, TypeScript, Redux Toolkit, Elastic UI, Monaco Editor, Vite
- **Backend**: NestJS, TypeScript, Node.js
- **Desktop**: Electron for cross-platform distribution
- **Testing**: Jest, Testing Library, Playwright

**Architecture**:

```
redisinsight/
β”œβ”€β”€ ui/ # React frontend (Vite + TypeScript)
β”œβ”€β”€ api/ # NestJS backend (TypeScript)
β”œβ”€β”€ desktop/ # Electron main process
└── tests/ # E2E tests (Playwright)
```

## Quick Reference

### Essential Commands

```bash
# Development
yarn dev:ui # Start UI dev server
yarn dev:api # Start API dev server
yarn dev:desktop # Start full Electron app

# Testing
yarn test # Run UI tests
yarn test:api # Run API tests
yarn test:cov # Run tests with coverage

# Code Quality
yarn lint # Lint all code
yarn type-check:ui # TypeScript type checking
yarn prettier:fix # Fix formatting on the changed files
```

### Before Every Commit
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add "on the changed files" to avoid running on the entire codebase


1. βœ… Run linter: `yarn lint`
2. βœ… Run tests: `yarn test && yarn test:api`
3. βœ… Check types: `yarn type-check:ui`
4. βœ… Fix formatting: `yarn prettier:fix`

### Key Principles

- **Quality over speed** - Write maintainable, testable code
- **Always run linter** after changes
- **No semicolons** in TypeScript files
- **Use styled-components** for styling (migrating from SCSS modules)
- **Use faker** for test data generation
- **Never use fixed timeouts** in tests
- **Test coverage** must meet thresholds (80% statements/lines)

## Module Aliases

- `uiSrc/*` β†’ `redisinsight/ui/src/*`
- `apiSrc/*` β†’ `redisinsight/api/src/*`
- `desktopSrc/*` β†’ `redisinsight/desktop/src/*`

## Redis-Specific Context

- Support all Redis data types: String, Hash, List, Set, Sorted Set, Vector Set, Stream, JSON
- Handle Redis modules: RedisJSON, RediSearch, RedisTimeSeries, RedisGraph
- Connection types: Standalone, Cluster, Sentinel
- Features: Workbench, Data Browser, Profiler, SlowLog, Pub/Sub

## For AI Assistants

When helping with RedisInsight development:

### DO:

- βœ… Follow established patterns in the codebase
- βœ… Run linter and tests before suggesting code is complete
- βœ… Use proper TypeScript types (avoid `any`)
- βœ… Write tests for all new features
- βœ… Consider performance and accessibility
- βœ… Handle errors properly
- βœ… Reference relevant existing code

### DON'T:

- ❌ Use `console.log`
- ❌ Add unnecessary comments
- ❌ Ignore linting errors
- ❌ Skip tests
- ❌ Use deprecated APIs
- ❌ Mutate Redux state directly
- ❌ Use magic numbers or unclear names

## Updating These Rules

To update AI rules:

1. **Edit files in `.ai/` only** (never edit symlinked files directly)
2. Changes automatically propagate to all AI tools
3. Commit changes to version control

**Remember**: These rules exist to maintain code quality and consistency. Follow them, but also use good judgment.
Loading
Loading