cursor-kit-cli 1.0.3
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 +162 -0
- package/dist/cli.cjs +709 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +686 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +227 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +159 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -0
- package/templates/commands/debug.md +52 -0
- package/templates/commands/explain.md +33 -0
- package/templates/commands/fix.md +143 -0
- package/templates/commands/implementation.md +40 -0
- package/templates/commands/refactor.md +80 -0
- package/templates/commands/review.md +49 -0
- package/templates/commands/test.md +57 -0
- package/templates/rules/coding-style.mdc +11 -0
- package/templates/rules/frontend-design-skills.mdc +44 -0
- package/templates/rules/git.mdc +53 -0
- package/templates/rules/performance.mdc +54 -0
- package/templates/rules/react.mdc +58 -0
- package/templates/rules/security.mdc +50 -0
- package/templates/rules/testing.mdc +54 -0
- package/templates/rules/typescript.mdc +36 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: React component patterns and best practices
|
|
3
|
+
globs: ["**/*.tsx", "**/*.jsx"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# React Guidelines
|
|
8
|
+
|
|
9
|
+
## Component Design
|
|
10
|
+
- Prefer functional components with hooks
|
|
11
|
+
- Keep components small and focused
|
|
12
|
+
- Use composition over inheritance
|
|
13
|
+
- Design components as compound components when appropriate
|
|
14
|
+
|
|
15
|
+
## Props & State
|
|
16
|
+
- Destructure props in function signature
|
|
17
|
+
- Use TypeScript interfaces for prop types
|
|
18
|
+
- Keep state as close to where it's used as possible
|
|
19
|
+
- Lift state only when necessary for sharing
|
|
20
|
+
|
|
21
|
+
## Hooks
|
|
22
|
+
- Follow the Rules of Hooks
|
|
23
|
+
- Extract reusable logic into custom hooks
|
|
24
|
+
- Use `useMemo` and `useCallback` judiciously (profile first)
|
|
25
|
+
- Prefer `useReducer` for complex state logic
|
|
26
|
+
|
|
27
|
+
## Event Handlers
|
|
28
|
+
- Prefix with "handle" (e.g., `handleClick`, `handleChange`)
|
|
29
|
+
- Define handlers outside of JSX for readability
|
|
30
|
+
- Use proper TypeScript event types
|
|
31
|
+
|
|
32
|
+
## Performance
|
|
33
|
+
- Avoid inline object/array creation in JSX
|
|
34
|
+
- Use React.memo only when proven necessary
|
|
35
|
+
- Implement proper key props in lists
|
|
36
|
+
- Consider code-splitting for large components
|
|
37
|
+
|
|
38
|
+
## Patterns to Follow
|
|
39
|
+
```tsx
|
|
40
|
+
// Good: Compound component pattern
|
|
41
|
+
<Select>
|
|
42
|
+
<Select.Option value="a">Option A</Select.Option>
|
|
43
|
+
<Select.Option value="b">Option B</Select.Option>
|
|
44
|
+
</Select>
|
|
45
|
+
|
|
46
|
+
// Good: Custom hook for logic
|
|
47
|
+
function useToggle(initial = false) {
|
|
48
|
+
const [state, setState] = useState(initial);
|
|
49
|
+
const toggle = useCallback(() => setState(s => !s), []);
|
|
50
|
+
return [state, toggle] as const;
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Avoid
|
|
55
|
+
- Prop drilling more than 2 levels (use Context or state management)
|
|
56
|
+
- Business logic in components (extract to hooks/utils)
|
|
57
|
+
- Inline styles (use CSS-in-JS or CSS modules)
|
|
58
|
+
- Index as key in dynamic lists
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Security best practices
|
|
3
|
+
globs:
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Security Guidelines
|
|
8
|
+
|
|
9
|
+
## Input Validation
|
|
10
|
+
- Validate all user inputs on both client and server
|
|
11
|
+
- Sanitize inputs before use in queries or rendering
|
|
12
|
+
- Use allowlists over denylists when possible
|
|
13
|
+
- Validate file uploads (type, size, content)
|
|
14
|
+
|
|
15
|
+
## Authentication
|
|
16
|
+
- Never store passwords in plain text
|
|
17
|
+
- Use strong hashing algorithms (bcrypt, argon2)
|
|
18
|
+
- Implement proper session management
|
|
19
|
+
- Use secure, httpOnly, sameSite cookies
|
|
20
|
+
|
|
21
|
+
## Authorization
|
|
22
|
+
- Check permissions on every protected operation
|
|
23
|
+
- Implement principle of least privilege
|
|
24
|
+
- Validate user access at API level, not just UI
|
|
25
|
+
- Use role-based or attribute-based access control
|
|
26
|
+
|
|
27
|
+
## Data Protection
|
|
28
|
+
- Encrypt sensitive data at rest and in transit
|
|
29
|
+
- Use HTTPS everywhere
|
|
30
|
+
- Don't log sensitive information
|
|
31
|
+
- Implement proper key management
|
|
32
|
+
|
|
33
|
+
## Common Vulnerabilities to Prevent
|
|
34
|
+
- **XSS**: Escape output, use Content Security Policy
|
|
35
|
+
- **CSRF**: Use anti-CSRF tokens
|
|
36
|
+
- **SQL Injection**: Use parameterized queries
|
|
37
|
+
- **Path Traversal**: Validate and sanitize file paths
|
|
38
|
+
|
|
39
|
+
## API Security
|
|
40
|
+
- Use rate limiting
|
|
41
|
+
- Implement proper CORS configuration
|
|
42
|
+
- Validate and sanitize all API inputs
|
|
43
|
+
- Use API keys and tokens appropriately
|
|
44
|
+
- Don't expose stack traces or internal errors
|
|
45
|
+
|
|
46
|
+
## Dependencies
|
|
47
|
+
- Keep dependencies updated
|
|
48
|
+
- Audit for known vulnerabilities regularly
|
|
49
|
+
- Use lockfiles for reproducible builds
|
|
50
|
+
- Review new dependencies before adding
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Testing standards and patterns
|
|
3
|
+
globs: ["**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Testing Guidelines
|
|
8
|
+
|
|
9
|
+
## Test Structure
|
|
10
|
+
- Follow AAA pattern: Arrange, Act, Assert
|
|
11
|
+
- One assertion per test when practical
|
|
12
|
+
- Use descriptive test names that explain the expected behavior
|
|
13
|
+
- Group related tests with `describe` blocks
|
|
14
|
+
|
|
15
|
+
## Naming Convention
|
|
16
|
+
```typescript
|
|
17
|
+
describe('ComponentName', () => {
|
|
18
|
+
describe('methodName', () => {
|
|
19
|
+
it('should [expected behavior] when [condition]', () => {
|
|
20
|
+
// test
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## What to Test
|
|
27
|
+
- Public interfaces and APIs
|
|
28
|
+
- Edge cases and boundary conditions
|
|
29
|
+
- Error handling paths
|
|
30
|
+
- User interactions (for UI)
|
|
31
|
+
- Integration points
|
|
32
|
+
|
|
33
|
+
## What NOT to Test
|
|
34
|
+
- Implementation details
|
|
35
|
+
- Third-party libraries
|
|
36
|
+
- Simple getters/setters
|
|
37
|
+
- Private methods directly
|
|
38
|
+
|
|
39
|
+
## Mocking
|
|
40
|
+
- Mock external dependencies (APIs, databases)
|
|
41
|
+
- Use dependency injection for easier mocking
|
|
42
|
+
- Prefer spies over stubs when possible
|
|
43
|
+
- Reset mocks between tests
|
|
44
|
+
|
|
45
|
+
## Test Quality
|
|
46
|
+
- Tests should be independent (no shared state)
|
|
47
|
+
- Tests should be deterministic (same result every time)
|
|
48
|
+
- Tests should be fast
|
|
49
|
+
- Tests should be readable (tests are documentation)
|
|
50
|
+
|
|
51
|
+
## Coverage Goals
|
|
52
|
+
- Aim for high coverage on critical business logic
|
|
53
|
+
- Don't chase 100% coverage blindly
|
|
54
|
+
- Focus on meaningful tests over line coverage
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: TypeScript best practices and code style
|
|
3
|
+
globs: ["**/*.ts", "**/*.tsx"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# TypeScript Guidelines
|
|
8
|
+
|
|
9
|
+
## Type Safety
|
|
10
|
+
- Prefer explicit types on public functions, props, and return values
|
|
11
|
+
- Avoid `any` and implicit `any` - use `unknown` when type is truly unknown
|
|
12
|
+
- Use strict TypeScript configuration
|
|
13
|
+
- Leverage type inference for local variables
|
|
14
|
+
|
|
15
|
+
## Code Style
|
|
16
|
+
- Use guard clauses over nested conditionals
|
|
17
|
+
- Keep functions small and focused (single responsibility)
|
|
18
|
+
- Use descriptive variable and function names
|
|
19
|
+
- Event handlers should use "handle" prefix (e.g., `handleClick`, `handleSubmit`)
|
|
20
|
+
|
|
21
|
+
## Naming Conventions
|
|
22
|
+
- `camelCase` for variables, functions, and methods
|
|
23
|
+
- `PascalCase` for classes, interfaces, types, and React components
|
|
24
|
+
- `UPPER_SNAKE_CASE` for constants
|
|
25
|
+
- Prefix interfaces with `I` only when necessary to distinguish from classes
|
|
26
|
+
|
|
27
|
+
## Organization
|
|
28
|
+
- Group related code in logical modules
|
|
29
|
+
- Keep imports organized (external, internal, relative)
|
|
30
|
+
- Co-locate related files (component + styles + tests)
|
|
31
|
+
|
|
32
|
+
## Avoid
|
|
33
|
+
- Magic numbers and strings (use named constants)
|
|
34
|
+
- Deep nesting (max 2-3 levels)
|
|
35
|
+
- Premature optimization
|
|
36
|
+
- Unnecessary comments that restate the obvious
|