ginskill-init 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 +77 -0
- package/agents/developer.md +56 -0
- package/agents/frontend-design.md +69 -0
- package/agents/mobile-reviewer.md +36 -0
- package/agents/review-code.md +49 -0
- package/agents/security-scanner.md +50 -0
- package/agents/tester.md +72 -0
- package/bin/cli.js +226 -0
- package/package.json +20 -0
- package/skills/ai-asset-generator/SKILL.md +255 -0
- package/skills/ai-asset-generator/docs/gen-image.md +274 -0
- package/skills/ai-asset-generator/docs/genvideo.md +341 -0
- package/skills/ai-asset-generator/docs/remove-background.md +19 -0
- package/skills/ai-asset-generator/generate-credit-assets.mjs +180 -0
- package/skills/ai-asset-generator/generate-ginbrowser-assets.mjs +242 -0
- package/skills/ai-asset-generator/generate-sty-icon.mjs +149 -0
- package/skills/ai-asset-generator/lib/bg-remove.mjs +34 -0
- package/skills/ai-asset-generator/lib/env.mjs +38 -0
- package/skills/ai-asset-generator/lib/kie-client.mjs +88 -0
- package/skills/ai-asset-generator/scripts/scaffold-generator.mjs +203 -0
- package/skills/ai-build-ai/SKILL.md +124 -0
- package/skills/ai-build-ai/docs/agent-teams.md +293 -0
- package/skills/ai-build-ai/docs/checkpointing.md +161 -0
- package/skills/ai-build-ai/docs/create-agent.md +399 -0
- package/skills/ai-build-ai/docs/create-mcp.md +395 -0
- package/skills/ai-build-ai/docs/create-skill.md +299 -0
- package/skills/ai-build-ai/docs/headless-mode.md +614 -0
- package/skills/ai-build-ai/docs/hooks.md +578 -0
- package/skills/ai-build-ai/docs/memory-claude-md.md +375 -0
- package/skills/ai-build-ai/docs/output-styles.md +208 -0
- package/skills/ai-build-ai/docs/overview.md +162 -0
- package/skills/ai-build-ai/docs/permissions.md +391 -0
- package/skills/ai-build-ai/docs/plugins.md +396 -0
- package/skills/ai-build-ai/docs/sandbox.md +262 -0
- package/skills/ai-build-ai/scripts/load-tutorial.sh +54 -0
- package/skills/icon-generator/SKILL.md +270 -0
- package/skills/mobile-app-review/SKILL.md +321 -0
- package/skills/mobile-app-review/references/apple-review.md +132 -0
- package/skills/mobile-app-review/references/google-play-review.md +203 -0
- package/skills/mongodb/SKILL.md +667 -0
- package/skills/mongodb/references/mongoose-patterns.md +368 -0
- package/skills/nestjs-architecture/SKILL.md +1086 -0
- package/skills/nestjs-architecture/references/advanced-patterns.md +590 -0
- package/skills/performance/SKILL.md +509 -0
- package/skills/react-fsd-architecture/SKILL.md +693 -0
- package/skills/react-fsd-architecture/references/fsd-patterns.md +747 -0
- package/skills/react-query/SKILL.md +685 -0
- package/skills/react-query/references/query-patterns.md +365 -0
- package/skills/review-code/SKILL.md +321 -0
- package/skills/review-code/references/clean-code-principles.md +395 -0
- package/skills/review-code/references/frontend-patterns.md +136 -0
- package/skills/review-code/references/nestjs-patterns.md +184 -0
- package/skills/review-code/scripts/check-module.sh +201 -0
- package/skills/review-code/scripts/deep-scan.sh +604 -0
- package/skills/review-code/scripts/dep-check.sh +522 -0
- package/skills/review-code/scripts/detect-duplicates.sh +466 -0
- package/skills/review-code/scripts/format-check.sh +577 -0
- package/skills/review-code/scripts/run-review.sh +167 -0
- package/skills/review-code/scripts/scan-codebase.sh +152 -0
- package/skills/security-scanner/SKILL.md +327 -0
- package/skills/security-scanner/references/nestjs-security.md +260 -0
- package/skills/security-scanner/references/nextjs-security.md +201 -0
- package/skills/security-scanner/references/react-native-security.md +199 -0
- package/skills/security-scanner/scripts/security-scan.sh +478 -0
- package/skills/ui-ux-pro-max/SKILL.md +377 -0
- package/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/skills/ui-ux-pro-max/scripts/search.py +114 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# NestJS Patterns — Backend Review Reference
|
|
2
|
+
|
|
3
|
+
Quick reference for reviewing NestJS backend code.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
1. [Module Structure](#module-structure)
|
|
7
|
+
2. [Controller Conventions](#controller-conventions)
|
|
8
|
+
3. [Service Patterns](#service-patterns)
|
|
9
|
+
4. [Schema / Entity Patterns](#schema--entity-patterns)
|
|
10
|
+
5. [DTO Validation](#dto-validation)
|
|
11
|
+
6. [Error Handling](#error-handling)
|
|
12
|
+
7. [Auth & Guards](#auth--guards)
|
|
13
|
+
8. [AI Agent Patterns](#ai-agent-patterns)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Module Structure
|
|
18
|
+
|
|
19
|
+
Every feature module follows this layout:
|
|
20
|
+
```
|
|
21
|
+
features/<name>/
|
|
22
|
+
├── <name>.module.ts # @Module declaration
|
|
23
|
+
├── <name>.controller.ts # HTTP routes
|
|
24
|
+
├── <name>.service.ts # Business logic
|
|
25
|
+
├── dto/ # class-validator DTOs
|
|
26
|
+
├── entities/ # Mongoose schemas
|
|
27
|
+
├── interfaces/ # TypeScript interfaces
|
|
28
|
+
└── __tests__/ # Jest tests (when they exist)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Module registration in `app.module.ts` — all feature modules are imported at the root level.
|
|
32
|
+
|
|
33
|
+
## Controller Conventions
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
@Controller('items')
|
|
37
|
+
@ApiTags('Items')
|
|
38
|
+
@UseGuards(JwtAuthGuard) // Protect all routes
|
|
39
|
+
export class ItemController {
|
|
40
|
+
constructor(private readonly itemService: ItemService) {}
|
|
41
|
+
|
|
42
|
+
@Post()
|
|
43
|
+
@ApiOperation({ summary: 'Create item' })
|
|
44
|
+
create(@Body() dto: CreateItemDto, @CurrentUser() user: User) {
|
|
45
|
+
return this.itemService.create(dto, user);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Review checklist:
|
|
51
|
+
- Controllers should be thin — validate input, delegate to service, return response (SRP)
|
|
52
|
+
- No business logic, DB calls, or side effects in controllers (separation of concerns)
|
|
53
|
+
- Use `@ApiTags` and `@ApiOperation` for Swagger docs
|
|
54
|
+
- Use `@UseGuards(JwtAuthGuard)` for protected routes
|
|
55
|
+
- Use `@CurrentUser()` decorator (from shared) to get authenticated user
|
|
56
|
+
- Use proper HTTP methods and status codes
|
|
57
|
+
- Controller methods should be <15 lines — if longer, logic belongs in the service
|
|
58
|
+
- Avoid catch blocks in controllers — let exception filters handle errors
|
|
59
|
+
|
|
60
|
+
## Service Patterns
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
@Injectable()
|
|
64
|
+
export class ItemService {
|
|
65
|
+
constructor(
|
|
66
|
+
@InjectModel(Item.name) private itemModel: Model<ItemDocument>,
|
|
67
|
+
private readonly mediaService: MediaService,
|
|
68
|
+
) {}
|
|
69
|
+
|
|
70
|
+
async create(dto: CreateItemDto, user: User): Promise<Item> {
|
|
71
|
+
// Business logic here
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Review checklist:
|
|
77
|
+
- Services own business logic, not controllers (SRP)
|
|
78
|
+
- Inject dependencies through constructor (DIP) — never use `new` for services or `moduleRef.get()`
|
|
79
|
+
- Use proper Mongoose model injection
|
|
80
|
+
- Return typed responses — avoid `any`, use explicit return types on public methods
|
|
81
|
+
- Handle errors with NestJS exceptions (`NotFoundException`, `BadRequestException`, etc.)
|
|
82
|
+
- Keep services focused: <200 lines, <10 public methods. Split if growing beyond this (SRP)
|
|
83
|
+
- Use early returns / guard clauses instead of deep nesting
|
|
84
|
+
- Extract repeated query patterns to private helper methods (DRY)
|
|
85
|
+
- Prefer composition over inheritance — inject other services rather than extending base classes
|
|
86
|
+
- Avoid side effects in methods that read data (query methods shouldn't mutate state)
|
|
87
|
+
|
|
88
|
+
## Schema / Entity Patterns
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
@Schema({ timestamps: true, collection: 'items' })
|
|
92
|
+
export class Item {
|
|
93
|
+
@Prop({ required: true })
|
|
94
|
+
name: string;
|
|
95
|
+
|
|
96
|
+
@Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true, index: true })
|
|
97
|
+
userId: mongoose.Types.ObjectId;
|
|
98
|
+
|
|
99
|
+
@Prop({ type: [String], default: [] })
|
|
100
|
+
tags: string[];
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Review checklist:
|
|
105
|
+
- Use `{ timestamps: true }` for automatic createdAt/updatedAt
|
|
106
|
+
- Add `required: true` on non-optional fields
|
|
107
|
+
- Add `index: true` on fields used in queries
|
|
108
|
+
- Use `ref` for cross-document references
|
|
109
|
+
- Specify `collection` name explicitly
|
|
110
|
+
|
|
111
|
+
## DTO Validation
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
export class CreateItemDto {
|
|
115
|
+
@IsString()
|
|
116
|
+
@IsNotEmpty()
|
|
117
|
+
name: string;
|
|
118
|
+
|
|
119
|
+
@IsOptional()
|
|
120
|
+
@IsArray()
|
|
121
|
+
@IsString({ each: true })
|
|
122
|
+
tags?: string[];
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Review checklist:
|
|
127
|
+
- All input DTOs should use class-validator decorators
|
|
128
|
+
- Mark optional fields with `@IsOptional()`
|
|
129
|
+
- Use `@Transform()` for sanitization when needed
|
|
130
|
+
- Separate Create, Update, and Query DTOs
|
|
131
|
+
|
|
132
|
+
## Error Handling
|
|
133
|
+
|
|
134
|
+
The project should use a global `HttpExceptionFilter` in `core/exception/`.
|
|
135
|
+
|
|
136
|
+
In services, throw typed NestJS exceptions:
|
|
137
|
+
```typescript
|
|
138
|
+
throw new NotFoundException('Item not found');
|
|
139
|
+
throw new BadRequestException('Invalid input');
|
|
140
|
+
throw new UnauthorizedException('Not authorized');
|
|
141
|
+
throw new ConflictException('Item already exists');
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Review checklist:
|
|
145
|
+
- Never swallow errors silently (empty catch blocks) — this is a CRITICAL code smell
|
|
146
|
+
- Use typed exceptions, not generic `Error` — exception type communicates intent
|
|
147
|
+
- Log errors before throwing when there's useful context
|
|
148
|
+
- Handle async errors — all async functions should have try/catch or let exceptions propagate meaningfully
|
|
149
|
+
- **Fail fast**: Validate inputs at the boundary (controller/DTO), don't check deep in business logic
|
|
150
|
+
- **Consistent strategy per layer**: Controllers use HTTP exceptions, services use domain exceptions, repositories propagate DB errors
|
|
151
|
+
- Avoid `try/catch` around every line — wrap logical units, not individual statements
|
|
152
|
+
- Include actionable context in error messages: `Item ${id} not found` not just `Not found`
|
|
153
|
+
|
|
154
|
+
## Auth & Guards
|
|
155
|
+
|
|
156
|
+
- `JwtAuthGuard` — Standard JWT Bearer token guard
|
|
157
|
+
- `@CurrentUser()` — Extracts user from JWT payload
|
|
158
|
+
- Role-based guards for admin/privileged operations
|
|
159
|
+
|
|
160
|
+
Review checklist:
|
|
161
|
+
- All non-public endpoints should have `@UseGuards(JwtAuthGuard)`
|
|
162
|
+
- User-specific queries should filter by `userId` from `@CurrentUser()`
|
|
163
|
+
- No endpoints should expose other users' data without admin check
|
|
164
|
+
|
|
165
|
+
## AI Agent Patterns
|
|
166
|
+
|
|
167
|
+
AI agent modules have their own internal architecture:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
ai-agents/core/
|
|
171
|
+
├── llm/services/ # Abstraction layer for all LLM calls
|
|
172
|
+
├── providers/ # Provider configs (OpenAI, Gemini, Vertex AI)
|
|
173
|
+
├── graph/ # LangGraph state machine
|
|
174
|
+
├── tools/ # Custom tools the agent can call
|
|
175
|
+
├── knowledge/ # Knowledge base (embeddings → vector DB)
|
|
176
|
+
└── config/ # System prompts, tool configs
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Review checklist:
|
|
180
|
+
- LLM calls should go through the abstraction layer, not direct SDK calls
|
|
181
|
+
- New tools should follow the existing pattern (DynamicStructuredTool)
|
|
182
|
+
- System prompts should use reusable sections from config
|
|
183
|
+
- Token limits and timeouts should be configured, not hardcoded
|
|
184
|
+
- Retry logic should use circuit breakers
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ─────────────────────────────────────────────────────────────
|
|
3
|
+
# Module Health Check
|
|
4
|
+
#
|
|
5
|
+
# Quickly audit a single NestJS feature module for completeness:
|
|
6
|
+
# - Has module.ts, controller.ts, service.ts?
|
|
7
|
+
# - Has DTOs with validation decorators?
|
|
8
|
+
# - Has Mongoose schemas with proper decorators?
|
|
9
|
+
# - Has tests?
|
|
10
|
+
# - Has Swagger decorators?
|
|
11
|
+
# - Uses auth guards?
|
|
12
|
+
#
|
|
13
|
+
# Auto-detects backend directory from repo root.
|
|
14
|
+
#
|
|
15
|
+
# Usage:
|
|
16
|
+
# ./check-module.sh item
|
|
17
|
+
# ./check-module.sh auth
|
|
18
|
+
#
|
|
19
|
+
# Environment variables (override auto-detection):
|
|
20
|
+
# BE_SRC=./my-backend/src ./check-module.sh item
|
|
21
|
+
# ─────────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
set -euo pipefail
|
|
24
|
+
|
|
25
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
26
|
+
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || cd "$SCRIPT_DIR/../../../../.." && pwd)"
|
|
27
|
+
|
|
28
|
+
# ─── Auto-detect backend src directory ────────────────────────
|
|
29
|
+
if [ -z "${BE_SRC:-}" ]; then
|
|
30
|
+
for candidate in backend be-* server api apps/api apps/backend; do
|
|
31
|
+
if [ -d "$REPO_ROOT/$candidate/src" ]; then
|
|
32
|
+
BE_SRC="$REPO_ROOT/$candidate/src"
|
|
33
|
+
break
|
|
34
|
+
fi
|
|
35
|
+
done
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
if [ -z "${BE_SRC:-}" ]; then
|
|
39
|
+
echo " [error] No backend src directory found. Set BE_SRC env var."
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
MODULE_NAME="${1:?Usage: check-module.sh <module-name>}"
|
|
44
|
+
|
|
45
|
+
# Try to find the module directory
|
|
46
|
+
MODULE_DIR=""
|
|
47
|
+
for candidate in "$BE_SRC/features/$MODULE_NAME" "$BE_SRC/core/$MODULE_NAME"; do
|
|
48
|
+
if [ -d "$candidate" ]; then
|
|
49
|
+
MODULE_DIR="$candidate"
|
|
50
|
+
break
|
|
51
|
+
fi
|
|
52
|
+
done
|
|
53
|
+
|
|
54
|
+
if [ -z "$MODULE_DIR" ]; then
|
|
55
|
+
echo " [error] Module '$MODULE_NAME' not found in features/ or core/"
|
|
56
|
+
echo " Available feature modules:"
|
|
57
|
+
ls -1 "$BE_SRC/features/" 2>/dev/null | sed 's/^/ /'
|
|
58
|
+
exit 1
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
echo ""
|
|
62
|
+
echo " ╔══════════════════════════════════════╗"
|
|
63
|
+
echo " ║ Module Health Check: $MODULE_NAME"
|
|
64
|
+
echo " ║ Path: ${MODULE_DIR#$REPO_ROOT/}"
|
|
65
|
+
echo " ╚══════════════════════════════════════╝"
|
|
66
|
+
echo ""
|
|
67
|
+
|
|
68
|
+
ISSUES=0
|
|
69
|
+
WARNINGS=0
|
|
70
|
+
|
|
71
|
+
check() {
|
|
72
|
+
local label="$1" result="$2"
|
|
73
|
+
if [ "$result" == "pass" ]; then
|
|
74
|
+
echo " ✓ $label"
|
|
75
|
+
elif [ "$result" == "warn" ]; then
|
|
76
|
+
echo " ⚠ $label"
|
|
77
|
+
WARNINGS=$((WARNINGS + 1))
|
|
78
|
+
else
|
|
79
|
+
echo " ✗ $label"
|
|
80
|
+
ISSUES=$((ISSUES + 1))
|
|
81
|
+
fi
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
# ─── Structure Checks ────────────────────────────────────────
|
|
85
|
+
echo " Structure:"
|
|
86
|
+
|
|
87
|
+
# Module file
|
|
88
|
+
if find "$MODULE_DIR" -name "*.module.ts" | grep -q .; then
|
|
89
|
+
check "Has module.ts" "pass"
|
|
90
|
+
else
|
|
91
|
+
check "Missing module.ts" "fail"
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
# Controller
|
|
95
|
+
if find "$MODULE_DIR" -name "*.controller.ts" | grep -q .; then
|
|
96
|
+
check "Has controller(s)" "pass"
|
|
97
|
+
else
|
|
98
|
+
check "No controllers found" "warn"
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# Service
|
|
102
|
+
if find "$MODULE_DIR" -name "*.service.ts" | grep -q .; then
|
|
103
|
+
check "Has service(s)" "pass"
|
|
104
|
+
else
|
|
105
|
+
check "No services found" "warn"
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
echo ""
|
|
109
|
+
echo " Schemas & DTOs:"
|
|
110
|
+
|
|
111
|
+
# DTOs
|
|
112
|
+
DTO_COUNT=$(find "$MODULE_DIR" -path "*/dto/*" -name "*.ts" 2>/dev/null | wc -l | tr -d ' ')
|
|
113
|
+
if [ "$DTO_COUNT" -gt 0 ]; then
|
|
114
|
+
check "Has DTOs ($DTO_COUNT files)" "pass"
|
|
115
|
+
|
|
116
|
+
# Check for class-validator usage
|
|
117
|
+
VALIDATED=$(grep -rl "class-validator" "$MODULE_DIR" 2>/dev/null | wc -l | tr -d ' ')
|
|
118
|
+
if [ "$VALIDATED" -gt 0 ]; then
|
|
119
|
+
check "Uses class-validator decorators" "pass"
|
|
120
|
+
else
|
|
121
|
+
check "DTOs exist but no class-validator decorators found" "warn"
|
|
122
|
+
fi
|
|
123
|
+
else
|
|
124
|
+
check "No DTO directory" "warn"
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
# Entities/Schemas
|
|
128
|
+
ENTITY_COUNT=$(find "$MODULE_DIR" -path "*/entities/*" -name "*.ts" 2>/dev/null | wc -l | tr -d ' ')
|
|
129
|
+
SCHEMA_COUNT=$(grep -rl "@Schema" "$MODULE_DIR" 2>/dev/null | wc -l | tr -d ' ')
|
|
130
|
+
if [ "$ENTITY_COUNT" -gt 0 ] || [ "$SCHEMA_COUNT" -gt 0 ]; then
|
|
131
|
+
check "Has Mongoose schemas ($ENTITY_COUNT entity files, $SCHEMA_COUNT @Schema)" "pass"
|
|
132
|
+
|
|
133
|
+
# Check for indexes
|
|
134
|
+
INDEX_COUNT=$(grep -r "@Index\|index: true" "$MODULE_DIR" 2>/dev/null | wc -l | tr -d ' ')
|
|
135
|
+
if [ "$INDEX_COUNT" -gt 0 ]; then
|
|
136
|
+
check "Has database indexes ($INDEX_COUNT)" "pass"
|
|
137
|
+
else
|
|
138
|
+
check "No @Index or index:true found — may need indexes for query performance" "warn"
|
|
139
|
+
fi
|
|
140
|
+
else
|
|
141
|
+
check "No entity/schema files" "warn"
|
|
142
|
+
fi
|
|
143
|
+
|
|
144
|
+
echo ""
|
|
145
|
+
echo " Quality:"
|
|
146
|
+
|
|
147
|
+
# Tests
|
|
148
|
+
TEST_COUNT=$(find "$MODULE_DIR" -name "*.spec.ts" -o -name "*.test.ts" 2>/dev/null | wc -l | tr -d ' ')
|
|
149
|
+
if [ "$TEST_COUNT" -gt 0 ]; then
|
|
150
|
+
check "Has tests ($TEST_COUNT files)" "pass"
|
|
151
|
+
else
|
|
152
|
+
check "No test files found" "warn"
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
# Swagger decorators
|
|
156
|
+
SWAGGER_COUNT=$(grep -r "@ApiTags\|@ApiOperation\|@ApiResponse" "$MODULE_DIR" 2>/dev/null | wc -l | tr -d ' ')
|
|
157
|
+
if [ "$SWAGGER_COUNT" -gt 0 ]; then
|
|
158
|
+
check "Has Swagger docs ($SWAGGER_COUNT decorators)" "pass"
|
|
159
|
+
else
|
|
160
|
+
check "No Swagger decorators found" "warn"
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
# Auth guards
|
|
164
|
+
GUARD_COUNT=$(grep -r "UseGuards\|JwtAuthGuard\|AuthGuard" "$MODULE_DIR" 2>/dev/null | wc -l | tr -d ' ')
|
|
165
|
+
if [ "$GUARD_COUNT" -gt 0 ]; then
|
|
166
|
+
check "Uses auth guards ($GUARD_COUNT)" "pass"
|
|
167
|
+
else
|
|
168
|
+
check "No auth guards found — are all endpoints public?" "warn"
|
|
169
|
+
fi
|
|
170
|
+
|
|
171
|
+
# any usage
|
|
172
|
+
ANY_COUNT=$(grep -r ": any\b" "$MODULE_DIR" --include="*.ts" 2>/dev/null | wc -l | tr -d ' ')
|
|
173
|
+
if [ "$ANY_COUNT" -lt 5 ]; then
|
|
174
|
+
check "Low 'any' usage ($ANY_COUNT occurrences)" "pass"
|
|
175
|
+
elif [ "$ANY_COUNT" -lt 20 ]; then
|
|
176
|
+
check "'any' type used $ANY_COUNT times — consider adding proper types" "warn"
|
|
177
|
+
else
|
|
178
|
+
check "High 'any' usage ($ANY_COUNT occurrences) — needs typing improvement" "fail"
|
|
179
|
+
fi
|
|
180
|
+
|
|
181
|
+
# Error handling
|
|
182
|
+
TRY_CATCH=$(grep -r "try {" "$MODULE_DIR" --include="*.ts" 2>/dev/null | wc -l | tr -d ' ')
|
|
183
|
+
THROWS=$(grep -r "throw new" "$MODULE_DIR" --include="*.ts" 2>/dev/null | wc -l | tr -d ' ')
|
|
184
|
+
check "Error handling: $TRY_CATCH try/catch blocks, $THROWS throw statements" "pass"
|
|
185
|
+
|
|
186
|
+
# File count
|
|
187
|
+
TS_COUNT=$(find "$MODULE_DIR" -name "*.ts" | wc -l | tr -d ' ')
|
|
188
|
+
|
|
189
|
+
echo ""
|
|
190
|
+
echo " ════════════════════════════════════"
|
|
191
|
+
echo " Summary: $TS_COUNT TypeScript files"
|
|
192
|
+
echo " Issues: $ISSUES | Warnings: $WARNINGS"
|
|
193
|
+
if [ $ISSUES -gt 0 ]; then
|
|
194
|
+
echo " Status: NEEDS ATTENTION"
|
|
195
|
+
exit 1
|
|
196
|
+
elif [ $WARNINGS -gt 3 ]; then
|
|
197
|
+
echo " Status: FAIR — several areas for improvement"
|
|
198
|
+
else
|
|
199
|
+
echo " Status: GOOD"
|
|
200
|
+
fi
|
|
201
|
+
echo ""
|