cursor-quality-suite 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,155 @@
1
+ # ๐Ÿงช Cursor Quality Suite
2
+
3
+ > Code Quality & Testing Commands for Cursor IDE - Test Generation, Mutation Testing, Architecture
4
+
5
+ [![npm version](https://badge.fury.io/js/cursor-quality-suite.svg)](https://www.npmjs.com/package/cursor-quality-suite)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ## ๐Ÿš€ Quick Install
9
+
10
+ ```bash
11
+ npx cursor-quality-suite
12
+ ```
13
+
14
+ One command installs 7 code quality commands for Cursor.
15
+
16
+ ## What is Quality Suite?
17
+
18
+ Quality Suite provides advanced testing and code quality tools:
19
+
20
+ - **Risk-Based Testing** - Generate tests for high-risk code paths
21
+ - **Mutation Testing** - Verify test quality catches real bugs
22
+ - **Architecture Visualization** - Generate Mermaid diagrams
23
+ - **Pattern Detection** - Find architectural drift
24
+
25
+ ## ๐Ÿ“ฆ Command Bundles
26
+
27
+ | Bundle | Commands | Use Case |
28
+ |--------|----------|----------|
29
+ | **Minimal** | 3 | Testing only |
30
+ | **Standard** | 7 | + Code quality |
31
+
32
+ ## ๐Ÿ”ง Commands Reference
33
+
34
+ ### ๐Ÿงช Testing
35
+
36
+ | Command | Description |
37
+ |---------|-------------|
38
+ | `/risk-test-gen` | Generate tests for high-risk paths (payments, auth) |
39
+ | `/mutation-audit` | Verify test quality via mutation testing |
40
+ | `/write-unit-tests` | Generate comprehensive unit tests |
41
+
42
+ ### ๐Ÿ“Š Code Quality
43
+
44
+ | Command | Description |
45
+ |---------|-------------|
46
+ | `/visualize-architecture` | Generate Mermaid diagrams for any scope |
47
+ | `/code-standards` | Reference guide for quality enforcement |
48
+ | `/pattern-drift` | Detect when code diverges from patterns |
49
+ | `/churn-map` | Find high-churn files needing attention |
50
+
51
+ ## ๐Ÿ’ก Example Usage
52
+
53
+ ### Generate High-Risk Tests
54
+
55
+ ```
56
+ /risk-test-gen src/features/checkout
57
+
58
+ โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
59
+ RISK ANALYSIS
60
+ โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
61
+
62
+ | Line | Risk | Type | Coverage |
63
+ |------|------|------|----------|
64
+ | 45 | ๐Ÿ”ด CRITICAL | Booking modification | โŒ Untested |
65
+ | 78 | ๐ŸŸ  HIGH | API call | โœ… Partial |
66
+
67
+ โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
68
+ GENERATED TESTS
69
+ โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
70
+
71
+ ## 1. Integration Test: Booking Modification (CRITICAL)
72
+
73
+ โœ… Generated: 3 test suites, 8 test cases
74
+ โœ… Coverage improvement: +35% on high-risk paths
75
+ ```
76
+
77
+ ### Mutation Testing Audit
78
+
79
+ ```
80
+ /mutation-audit src/components/Checkout.tsx
81
+
82
+ โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
83
+ MUTATION TESTING RESULTS
84
+ โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
85
+
86
+ | Metric | Value |
87
+ |--------|-------|
88
+ | Total Mutants | 45 |
89
+ | Killed | 32 |
90
+ | Survived | 13 |
91
+ | **Mutation Score** | **71%** ๐ŸŸ  |
92
+
93
+ ## Survived Mutants (Tests Failed to Catch)
94
+
95
+ | Line | Original | Mutation |
96
+ |------|----------|----------|
97
+ | 78 | `price > 0` | `price >= 0` |
98
+ ```
99
+
100
+ ### Architecture Diagram
101
+
102
+ ```
103
+ /visualize-architecture src/components/Packages
104
+
105
+ Output:
106
+ ```mermaid
107
+ graph TD
108
+ subgraph Packages
109
+ A[PackagesV2] --> B[ProtectionPackageCard]
110
+ A --> C[ExtrasPackageCard]
111
+ B --> D[LineItems]
112
+ B --> E[PackageHeader]
113
+ end
114
+ ```
115
+
116
+ ## ๐Ÿ› ๏ธ CLI Commands
117
+
118
+ ```bash
119
+ npx cursor-quality-suite # Interactive install
120
+ npx cursor-quality-suite --bundle standard -y # Non-interactive
121
+ npx cursor-quality-suite status # Check installation
122
+ npx cursor-quality-suite list # List all commands
123
+ npx cursor-quality-suite help # Show help
124
+ ```
125
+
126
+ ## ๐Ÿ“‚ Installation Structure
127
+
128
+ After installation:
129
+
130
+ ```
131
+ .cursor/
132
+ โ””โ”€โ”€ commands/
133
+ โ”œโ”€โ”€ risk-test-gen.md
134
+ โ”œโ”€โ”€ mutation-audit.md
135
+ โ”œโ”€โ”€ write-unit-tests.md
136
+ โ”œโ”€โ”€ visualize-architecture.md
137
+ โ”œโ”€โ”€ code-standards.md
138
+ โ”œโ”€โ”€ pattern-drift.md
139
+ โ””โ”€โ”€ churn-map.md
140
+ ```
141
+
142
+ ## ๐Ÿค Works With
143
+
144
+ - [Buddy OS](https://github.com/sharath317/buddy-os) - Role-aware autonomous agent
145
+ - [Cursor Full-Flow](https://github.com/sharath317/cursor-full-flow) - Jira to PR automation
146
+ - [Cursor AI Toolkit](https://github.com/sharath317/cursor-ai-toolkit) - Learning & context
147
+
148
+ ## ๐Ÿ“„ License
149
+
150
+ MIT ยฉ Sharath Chandra
151
+
152
+ ---
153
+
154
+ **Ship higher quality code with AI-powered testing.**
155
+
package/bin/cli.js ADDED
@@ -0,0 +1,303 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * cursor-quality-suite CLI
5
+ * Code Quality & Testing Commands for Cursor IDE
6
+ * Test Generation, Mutation Testing, Architecture Visualization
7
+ */
8
+
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+ const readline = require('readline');
12
+
13
+ const VERSION = '1.0.0';
14
+ const CURSOR_DIR = '.cursor';
15
+ const COMMANDS_DIR = 'commands';
16
+
17
+ const colors = {
18
+ reset: '\x1b[0m',
19
+ bold: '\x1b[1m',
20
+ dim: '\x1b[2m',
21
+ red: '\x1b[31m',
22
+ green: '\x1b[32m',
23
+ yellow: '\x1b[33m',
24
+ blue: '\x1b[34m',
25
+ magenta: '\x1b[35m',
26
+ cyan: '\x1b[36m',
27
+ };
28
+
29
+ const log = {
30
+ info: (msg) => console.log(`${colors.cyan}โ„น${colors.reset} ${msg}`),
31
+ success: (msg) => console.log(`${colors.green}โœ“${colors.reset} ${msg}`),
32
+ warn: (msg) => console.log(`${colors.yellow}โš ${colors.reset} ${msg}`),
33
+ error: (msg) => console.log(`${colors.red}โœ—${colors.reset} ${msg}`),
34
+ step: (msg) => console.log(` ${colors.dim}โ†’${colors.reset} ${msg}`),
35
+ header: (msg) => console.log(`\n${colors.bold}${colors.cyan}${msg}${colors.reset}\n`),
36
+ };
37
+
38
+ const BUNDLES = {
39
+ minimal: {
40
+ name: 'Minimal (Testing Only)',
41
+ description: 'Test generation and mutation testing',
42
+ commands: ['testing'],
43
+ count: 3,
44
+ },
45
+ standard: {
46
+ name: 'Standard (Testing + Quality)',
47
+ description: 'Full testing and code quality suite',
48
+ commands: ['testing', 'code-quality'],
49
+ count: 7,
50
+ },
51
+ };
52
+
53
+ function prompt(question, defaultValue = '') {
54
+ const rl = readline.createInterface({
55
+ input: process.stdin,
56
+ output: process.stdout,
57
+ });
58
+
59
+ const defaultText = defaultValue ? ` (${defaultValue})` : '';
60
+
61
+ return new Promise((resolve) => {
62
+ rl.question(`${question}${defaultText}: `, (answer) => {
63
+ rl.close();
64
+ resolve(answer || defaultValue);
65
+ });
66
+ });
67
+ }
68
+
69
+ function ensureDir(dir) {
70
+ if (!fs.existsSync(dir)) {
71
+ fs.mkdirSync(dir, { recursive: true });
72
+ }
73
+ }
74
+
75
+ function copyCommands(sourceDir, targetDir, categories) {
76
+ let copiedCount = 0;
77
+
78
+ categories.forEach((category) => {
79
+ const srcCategoryDir = path.join(sourceDir, category);
80
+
81
+ if (fs.existsSync(srcCategoryDir)) {
82
+ const files = fs.readdirSync(srcCategoryDir).filter((f) => f.endsWith('.md'));
83
+
84
+ files.forEach((file) => {
85
+ const srcFile = path.join(srcCategoryDir, file);
86
+ const tgtFile = path.join(targetDir, file);
87
+
88
+ if (!fs.existsSync(tgtFile)) {
89
+ fs.copyFileSync(srcFile, tgtFile);
90
+ log.step(`Installed: ${file}`);
91
+ copiedCount++;
92
+ } else {
93
+ log.step(`Exists: ${file} (skipped)`);
94
+ }
95
+ });
96
+ }
97
+ });
98
+
99
+ return copiedCount;
100
+ }
101
+
102
+ async function init(flags = {}) {
103
+ console.log(`
104
+ ${colors.bold}${colors.cyan}โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
105
+ ๐Ÿงช CURSOR QUALITY SUITE v${VERSION}
106
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”${colors.reset}
107
+ Code Quality: Testing, Architecture & Analysis
108
+
109
+ `);
110
+
111
+ const projectDir = process.cwd();
112
+ const cursorDir = path.join(projectDir, CURSOR_DIR);
113
+ const commandsDir = path.join(cursorDir, COMMANDS_DIR);
114
+
115
+ log.header('๐Ÿ“ฆ Select Command Bundle');
116
+
117
+ Object.entries(BUNDLES).forEach(([key, bundle], idx) => {
118
+ console.log(` ${idx + 1}. ${colors.bold}${bundle.name}${colors.reset}`);
119
+ console.log(` ${bundle.description} (${bundle.count} commands)\n`);
120
+ });
121
+
122
+ let selectedBundle = 'standard';
123
+ if (!flags.bundle && !flags.yes) {
124
+ const bundleAnswer = await prompt('Select bundle (1-2)', '2');
125
+ selectedBundle = Object.keys(BUNDLES)[parseInt(bundleAnswer, 10) - 1] || 'standard';
126
+ } else if (flags.bundle) {
127
+ selectedBundle = flags.bundle;
128
+ }
129
+
130
+ const bundle = BUNDLES[selectedBundle];
131
+ log.success(`Selected: ${bundle.name}`);
132
+
133
+ log.header('๐Ÿ“ฅ Installing Commands');
134
+
135
+ ensureDir(commandsDir);
136
+
137
+ const packageDir = path.dirname(__dirname);
138
+ const packageCommandsDir = path.join(packageDir, 'commands');
139
+
140
+ const copiedCount = copyCommands(packageCommandsDir, commandsDir, bundle.commands);
141
+
142
+ console.log(`
143
+ ${colors.bold}${colors.green}โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
144
+ โœ“ INSTALLATION COMPLETE
145
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”${colors.reset}
146
+
147
+ ${colors.cyan}Commands installed:${colors.reset} ${copiedCount}
148
+ ${colors.cyan}Location:${colors.reset} ${commandsDir}
149
+
150
+ ${colors.bold}Commands Reference:${colors.reset}
151
+
152
+ ${colors.cyan}๐Ÿงช Testing${colors.reset}
153
+ /risk-test-gen Generate tests for high-risk paths
154
+ /mutation-audit Verify test quality via mutations
155
+ /write-unit-tests Generate unit tests for components
156
+
157
+ ${colors.cyan}๐Ÿ“Š Code Quality${colors.reset}
158
+ /visualize-architecture Generate Mermaid diagrams
159
+ /code-standards Reference guide for quality
160
+ /churn-map Find high-churn files
161
+ /pattern-drift Detect pattern violations
162
+
163
+ ${colors.dim}Documentation: https://github.com/sharath317/cursor-quality-suite${colors.reset}
164
+ `);
165
+ }
166
+
167
+ async function status() {
168
+ const projectDir = process.cwd();
169
+ const commandsDir = path.join(projectDir, CURSOR_DIR, COMMANDS_DIR);
170
+
171
+ if (!fs.existsSync(commandsDir)) {
172
+ log.warn('Quality Suite not installed. Run: npx cursor-quality-suite');
173
+ process.exit(0);
174
+ }
175
+
176
+ const commands = fs.readdirSync(commandsDir).filter((f) => f.endsWith('.md'));
177
+
178
+ console.log(`
179
+ ${colors.bold}${colors.cyan}โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
180
+ ๐Ÿ“Š QUALITY SUITE STATUS
181
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”${colors.reset}
182
+
183
+ ${colors.cyan}Version:${colors.reset} ${VERSION}
184
+ ${colors.cyan}Commands:${colors.reset} ${commands.length} installed
185
+ ${colors.cyan}Location:${colors.reset} ${commandsDir}
186
+
187
+ ${colors.bold}Installed Commands:${colors.reset}`);
188
+
189
+ commands.forEach((cmd) => {
190
+ console.log(` - /${cmd.replace('.md', '')}`);
191
+ });
192
+
193
+ console.log('');
194
+ }
195
+
196
+ async function listCommands() {
197
+ const packageDir = path.dirname(__dirname);
198
+ const packageCommandsDir = path.join(packageDir, 'commands');
199
+
200
+ console.log(`
201
+ ${colors.bold}${colors.cyan}โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
202
+ ๐Ÿ“‹ AVAILABLE COMMANDS
203
+ โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”${colors.reset}
204
+ `);
205
+
206
+ const categories = ['testing', 'code-quality'];
207
+ const icons = { testing: '๐Ÿงช', 'code-quality': '๐Ÿ“Š' };
208
+
209
+ categories.forEach((cat) => {
210
+ const catDir = path.join(packageCommandsDir, cat);
211
+ if (fs.existsSync(catDir)) {
212
+ console.log(`\n${icons[cat]} ${colors.bold}${cat.toUpperCase()}${colors.reset}`);
213
+
214
+ const files = fs.readdirSync(catDir).filter((f) => f.endsWith('.md'));
215
+ files.forEach((file) => {
216
+ const name = file.replace('.md', '');
217
+ console.log(` /${name}`);
218
+ });
219
+ }
220
+ });
221
+
222
+ console.log('');
223
+ }
224
+
225
+ function showHelp() {
226
+ console.log(`
227
+ ${colors.bold}cursor-quality-suite v${VERSION}${colors.reset}
228
+
229
+ Code Quality & Testing Commands for Cursor IDE
230
+
231
+ ${colors.bold}Usage:${colors.reset}
232
+ npx cursor-quality-suite [command] [options]
233
+
234
+ ${colors.bold}Commands:${colors.reset}
235
+ init Install commands (default)
236
+ status Show current configuration
237
+ list List all available commands
238
+ help Show this help
239
+
240
+ ${colors.bold}Options:${colors.reset}
241
+ --bundle Select bundle (minimal, standard)
242
+ -y, --yes Non-interactive mode
243
+
244
+ ${colors.bold}Examples:${colors.reset}
245
+ npx cursor-quality-suite Interactive install
246
+ npx cursor-quality-suite --bundle standard Install all commands
247
+ npx cursor-quality-suite status Check installation
248
+
249
+ ${colors.bold}After Installation:${colors.reset}
250
+ /risk-test-gen Generate high-risk tests
251
+ /mutation-audit Verify test quality
252
+ /visualize-architecture Generate architecture diagrams
253
+ /code-standards View quality guidelines
254
+
255
+ ${colors.dim}https://github.com/sharath317/cursor-quality-suite${colors.reset}
256
+ `);
257
+ }
258
+
259
+ const args = process.argv.slice(2);
260
+ const flags = {};
261
+ let command = null;
262
+ const skipNextArg = new Set();
263
+
264
+ args.forEach((arg, idx) => {
265
+ if (arg === '--bundle' && args[idx + 1]) {
266
+ skipNextArg.add(idx + 1);
267
+ }
268
+ });
269
+
270
+ args.forEach((arg, idx) => {
271
+ if (skipNextArg.has(idx)) {
272
+ return;
273
+ } else if (arg === '-y' || arg === '--yes') {
274
+ flags.yes = true;
275
+ } else if (arg === '--bundle' && args[idx + 1]) {
276
+ flags.bundle = args[idx + 1];
277
+ } else if (!arg.startsWith('-') && command === null) {
278
+ command = arg;
279
+ }
280
+ });
281
+
282
+ switch (command) {
283
+ case 'init':
284
+ case null:
285
+ init(flags);
286
+ break;
287
+ case 'status':
288
+ status();
289
+ break;
290
+ case 'list':
291
+ listCommands();
292
+ break;
293
+ case 'help':
294
+ case '-h':
295
+ case '--help':
296
+ showHelp();
297
+ break;
298
+ default:
299
+ log.error(`Unknown command: ${command}`);
300
+ console.log('Run "npx cursor-quality-suite help" for usage');
301
+ process.exit(1);
302
+ }
303
+