|
| 1 | +# RedisInsight AI Development Rules |
| 2 | + |
| 3 | +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: |
| 4 | + |
| 5 | +- **Cursor** (via symlinks: `.cursor/rules/` and `.cursor/commands/`) |
| 6 | +- **Augment** (via symlink: `.augment/`) |
| 7 | +- **Windsurf** (via symlink: `.windsurfrules`) |
| 8 | +- **GitHub Copilot** (via file: `.github/copilot-instructions.md`) |
| 9 | + |
| 10 | +## MCP (Model Context Protocol) Setup |
| 11 | + |
| 12 | +AI tools can access external services (JIRA, Confluence, GitHub) via MCP configuration. |
| 13 | + |
| 14 | +### Initial Setup |
| 15 | + |
| 16 | +1. **Copy the example configuration:** |
| 17 | + |
| 18 | + ```bash |
| 19 | + cp env.mcp.example .env.mcp |
| 20 | + ``` |
| 21 | + |
| 22 | +2. **Get your Atlassian API token:** |
| 23 | + |
| 24 | + - Go to: https://id.atlassian.com/manage-profile/security/api-tokens |
| 25 | + - Create a classic token by pressing the first "Create Token" button |
| 26 | + - Copy the token |
| 27 | + |
| 28 | +3. **Edit `.env.mcp` with your credentials:** |
| 29 | + |
| 30 | + ```bash |
| 31 | + ATLASSIAN_DOMAIN=your-domain.atlassian.net |
| 32 | + |
| 33 | + ATLASSIAN_API_TOKEN=your-api-token-here |
| 34 | + ATLASSIAN_JIRA_PROJECT=RI |
| 35 | + ``` |
| 36 | + |
| 37 | +4. **Verify your setup:** |
| 38 | + ```bash |
| 39 | + # For Augment users: |
| 40 | + auggie --mcp-config mcp.json "go over all my mcp tools and make sure they work as expected" |
| 41 | + ``` |
| 42 | + |
| 43 | +### Available MCP Services |
| 44 | + |
| 45 | +The `mcp.json` file configures these services: |
| 46 | + |
| 47 | +- **git** - Git operations (status, diff, log, branch management) |
| 48 | +- **github** - GitHub integration (issues, PRs, repository operations) |
| 49 | +- **memory** - Persistent context storage across sessions |
| 50 | +- **sequential-thinking** - Enhanced reasoning for complex tasks |
| 51 | +- **context-7** - Advanced context management |
| 52 | +- **atlassian** - JIRA (RI-XXX tickets) and Confluence integration |
| 53 | + |
| 54 | +**Note**: Never commit `.env.mcp` to version control (it's in `.gitignore`)! |
| 55 | + |
| 56 | +## Structure |
| 57 | + |
| 58 | +``` |
| 59 | +.ai/ |
| 60 | +├── README.md # This file |
| 61 | +├── rules/ # Development rules and standards |
| 62 | +│ ├── 01-CODE_QUALITY.md # Linting, formatting, TypeScript |
| 63 | +│ ├── 02-FRONTEND.md # React, Redux, styled-components, component structure |
| 64 | +│ ├── 03-BACKEND.md # NestJS, API patterns |
| 65 | +│ ├── 04-TESTING.md # Testing standards and practices |
| 66 | +│ └── 05-WORKFLOW.md # Git workflow, commits, dev process |
| 67 | +└── commands/ # AI workflow commands |
| 68 | + ├── pr/ |
| 69 | + │ ├── review.md # PR review workflow |
| 70 | + │ └── plan.md # PR planning workflow |
| 71 | + ├── commit-message.md # Commit message generation |
| 72 | + └── run-ui-tests.md # Custom test runner usage |
| 73 | +``` |
| 74 | + |
| 75 | +## Project Overview |
| 76 | + |
| 77 | +**RedisInsight** is a desktop application for Redis database management built with: |
| 78 | + |
| 79 | +- **Frontend**: React 18, TypeScript, Redux Toolkit, Elastic UI, Monaco Editor, Vite |
| 80 | +- **Backend**: NestJS, TypeScript, Node.js |
| 81 | +- **Desktop**: Electron for cross-platform distribution |
| 82 | +- **Testing**: Jest, Testing Library, Playwright |
| 83 | + |
| 84 | +**Architecture**: |
| 85 | + |
| 86 | +``` |
| 87 | +redisinsight/ |
| 88 | +├── ui/ # React frontend (Vite + TypeScript) |
| 89 | +├── api/ # NestJS backend (TypeScript) |
| 90 | +├── desktop/ # Electron main process |
| 91 | +└── tests/ # E2E tests (Playwright) |
| 92 | +``` |
| 93 | + |
| 94 | +## Quick Reference |
| 95 | + |
| 96 | +### Essential Commands |
| 97 | + |
| 98 | +```bash |
| 99 | +# Development |
| 100 | +yarn dev:ui # Start UI dev server |
| 101 | +yarn dev:api # Start API dev server |
| 102 | +yarn dev:desktop # Start full Electron app |
| 103 | + |
| 104 | +# Testing |
| 105 | +yarn test # Run UI tests |
| 106 | +yarn test:api # Run API tests |
| 107 | +yarn test:cov # Run tests with coverage |
| 108 | + |
| 109 | +# Code Quality |
| 110 | +yarn lint # Lint all code |
| 111 | +yarn type-check:ui # TypeScript type checking |
| 112 | +yarn prettier:fix # Fix formatting |
| 113 | +``` |
| 114 | + |
| 115 | +### Before Every Commit |
| 116 | + |
| 117 | +1. ✅ Run linter: `yarn lint` |
| 118 | +2. ✅ Run tests: `yarn test && yarn test:api` |
| 119 | +3. ✅ Check types: `yarn type-check:ui` |
| 120 | +4. ✅ Fix formatting: `yarn prettier:fix` |
| 121 | + |
| 122 | +### Key Principles |
| 123 | + |
| 124 | +- **Quality over speed** - Write maintainable, testable code |
| 125 | +- **Always run linter** after changes |
| 126 | +- **No semicolons** in TypeScript files |
| 127 | +- **Use styled-components** for styling (migrating from SCSS modules) |
| 128 | +- **Use faker** for test data generation |
| 129 | +- **Never use fixed timeouts** in tests |
| 130 | +- **Test coverage** must meet thresholds (80% statements/lines) |
| 131 | + |
| 132 | +## Module Aliases |
| 133 | + |
| 134 | +- `uiSrc/*` → `redisinsight/ui/src/*` |
| 135 | +- `apiSrc/*` → `redisinsight/api/src/*` |
| 136 | +- `desktopSrc/*` → `redisinsight/desktop/src/*` |
| 137 | + |
| 138 | +## Redis-Specific Context |
| 139 | + |
| 140 | +- Support all Redis data types: String, Hash, List, Set, Sorted Set, Stream, JSON |
| 141 | +- Handle Redis modules: RedisJSON, RediSearch, RedisTimeSeries, RedisGraph |
| 142 | +- Connection types: Standalone, Cluster, Sentinel |
| 143 | +- Features: Workbench, Data Browser, Profiler, SlowLog, Pub/Sub |
| 144 | + |
| 145 | +## For AI Assistants |
| 146 | + |
| 147 | +When helping with RedisInsight development: |
| 148 | + |
| 149 | +### DO: |
| 150 | + |
| 151 | +- ✅ Follow established patterns in the codebase |
| 152 | +- ✅ Run linter and tests before suggesting code is complete |
| 153 | +- ✅ Use proper TypeScript types (avoid `any`) |
| 154 | +- ✅ Write tests for all new features |
| 155 | +- ✅ Consider performance and accessibility |
| 156 | +- ✅ Handle errors properly |
| 157 | +- ✅ Reference relevant existing code |
| 158 | + |
| 159 | +### DON'T: |
| 160 | + |
| 161 | +- ❌ Use `console.log` (use proper logging) |
| 162 | +- ❌ Add unnecessary comments |
| 163 | +- ❌ Ignore linting errors |
| 164 | +- ❌ Skip tests |
| 165 | +- ❌ Use deprecated APIs |
| 166 | +- ❌ Mutate Redux state directly |
| 167 | +- ❌ Use magic numbers or unclear names |
| 168 | + |
| 169 | +## Updating These Rules |
| 170 | + |
| 171 | +To update AI rules: |
| 172 | + |
| 173 | +1. **Edit files in `.ai/` only** (never edit symlinked files directly) |
| 174 | +2. Changes automatically propagate to all AI tools |
| 175 | +3. Commit changes to version control |
| 176 | + |
| 177 | +**Remember**: These rules exist to maintain code quality and consistency. Follow them, but also use good judgment. |
0 commit comments