antigravity-devkit 1.0.0 โ 1.0.2
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/package.json +1 -1
- package/template/scripts/README.md +317 -0
- package/template/scripts/checklist.py +0 -0
- package/template/scripts/lint_runner.py +253 -0
- package/template/scripts/schema_validator.py +277 -0
- package/template/scripts/security_scan.py +354 -0
- package/template/scripts/verify_all.py +0 -0
- package/template/scripts/vitest_runner.py +203 -0
- package/template/scripts/xunit_runner.py +235 -0
- package/template/skills/aspnet-patterns/SKILL.md +2 -0
- package/template/skills/csharp-patterns/SKILL.md +40 -0
- package/template/skills/vue3-patterns/SKILL.md +40 -0
- package/template/skills/english-education/SKILL.md +0 -116
- package/template/skills/english-education/references/lesson-templates.md +0 -151
- package/template/skills/english-education/references/quiz-templates.md +0 -177
- package/template/skills/english-education/scripts/curriculum_validator.py +0 -175
package/package.json
CHANGED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# Verification Scripts
|
|
2
|
+
|
|
3
|
+
Automated validation scripts used by agents to ensure code quality, security, and correctness.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Agent โ Script Mapping
|
|
8
|
+
|
|
9
|
+
| Agent | Script | Purpose |
|
|
10
|
+
|-------|--------|---------|
|
|
11
|
+
| `frontend-specialist` | `vitest_runner.py` | Run Vue3/TypeScript tests with Vitest |
|
|
12
|
+
| `backend-specialist` | `xunit_runner.py` | Run ASP.NET/C# tests with xUnit |
|
|
13
|
+
| `database-architect` | `schema_validator.py` | Validate SQL schemas and migrations |
|
|
14
|
+
| `security-auditor` | `security_scan.py` | Scan for security vulnerabilities |
|
|
15
|
+
| **Any agent** | `lint_runner.py` | Universal code quality checker |
|
|
16
|
+
| **Any agent** | `checklist.py` | Quick validation checklist |
|
|
17
|
+
| **Any agent** | `verify_all.py` | Comprehensive validation suite |
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Script Output Protocol
|
|
22
|
+
|
|
23
|
+
When agents use these scripts, they follow this protocol:
|
|
24
|
+
|
|
25
|
+
1. **Run script** - Execute the appropriate validation script
|
|
26
|
+
2. **Parse errors/warnings** - Extract and categorize issues
|
|
27
|
+
3. **Summarize to user** - Present findings in readable format
|
|
28
|
+
4. **Ask before fixing** - Request approval before making changes
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Individual Script Usage
|
|
33
|
+
|
|
34
|
+
### ๐งช `vitest_runner.py` - Frontend Test Runner
|
|
35
|
+
|
|
36
|
+
**Purpose**: Execute and validate Vue3/TypeScript tests using Vitest
|
|
37
|
+
|
|
38
|
+
**Usage**:
|
|
39
|
+
```bash
|
|
40
|
+
# Run tests
|
|
41
|
+
python scripts/vitest_runner.py .
|
|
42
|
+
|
|
43
|
+
# Run with coverage
|
|
44
|
+
python scripts/vitest_runner.py . --coverage
|
|
45
|
+
|
|
46
|
+
# Watch mode
|
|
47
|
+
python scripts/vitest_runner.py . --watch
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Requirements**: Node.js, Vitest installed in project
|
|
51
|
+
|
|
52
|
+
**Output**: Test results, pass/fail counts, coverage metrics
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### ๐งช `xunit_runner.py` - Backend Test Runner
|
|
57
|
+
|
|
58
|
+
**Purpose**: Execute and validate ASP.NET/C# tests using xUnit
|
|
59
|
+
|
|
60
|
+
**Usage**:
|
|
61
|
+
```bash
|
|
62
|
+
# Run all tests
|
|
63
|
+
python scripts/xunit_runner.py .
|
|
64
|
+
|
|
65
|
+
# Run with coverage
|
|
66
|
+
python scripts/xunit_runner.py . --coverage
|
|
67
|
+
|
|
68
|
+
# Filter specific tests
|
|
69
|
+
python scripts/xunit_runner.py . --filter "UserServiceTests"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Requirements**: .NET SDK, xUnit test projects
|
|
73
|
+
|
|
74
|
+
**Output**: Test results, pass/fail counts, duration
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### ๐๏ธ `schema_validator.py` - Database Schema Validator
|
|
79
|
+
|
|
80
|
+
**Purpose**: Validate SQL Server schemas, migrations, and stored procedures
|
|
81
|
+
|
|
82
|
+
**Usage**:
|
|
83
|
+
```bash
|
|
84
|
+
# Validate schemas
|
|
85
|
+
python scripts/schema_validator.py .
|
|
86
|
+
|
|
87
|
+
# With connection string (for live validation)
|
|
88
|
+
python scripts/schema_validator.py . --connection-string "Server=..."
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Checks**:
|
|
92
|
+
- SQL syntax errors
|
|
93
|
+
- Missing primary keys
|
|
94
|
+
- Naming conventions
|
|
95
|
+
- Migration file naming
|
|
96
|
+
- SQL injection risks
|
|
97
|
+
- Transaction handling
|
|
98
|
+
|
|
99
|
+
**Output**: Schema quality report, syntax issues, recommendations
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### ๐ `security_scan.py` - Security Scanner
|
|
104
|
+
|
|
105
|
+
**Purpose**: Comprehensive security vulnerability detection
|
|
106
|
+
|
|
107
|
+
**Usage**:
|
|
108
|
+
```bash
|
|
109
|
+
# Full security scan
|
|
110
|
+
python scripts/security_scan.py .
|
|
111
|
+
|
|
112
|
+
# Filter by severity
|
|
113
|
+
python scripts/security_scan.py . --severity high
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Scans For**:
|
|
117
|
+
- Hardcoded secrets (passwords, API keys, tokens)
|
|
118
|
+
- npm package vulnerabilities
|
|
119
|
+
- NuGet package vulnerabilities
|
|
120
|
+
- SQL injection patterns
|
|
121
|
+
- XSS vulnerabilities
|
|
122
|
+
- Weak cryptography (MD5, SHA1)
|
|
123
|
+
- eval() usage
|
|
124
|
+
- HTTP vs HTTPS
|
|
125
|
+
- Missing security headers (HSTS, HTTPS redirect)
|
|
126
|
+
|
|
127
|
+
**Output**: Security findings grouped by severity (HIGH/MEDIUM/LOW)
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### ๐ `lint_runner.py` - Universal Linter
|
|
132
|
+
|
|
133
|
+
**Purpose**: Code quality and style validation for both frontend and backend
|
|
134
|
+
|
|
135
|
+
**Usage**:
|
|
136
|
+
```bash
|
|
137
|
+
# Lint entire project
|
|
138
|
+
python scripts/lint_runner.py .
|
|
139
|
+
|
|
140
|
+
# Auto-fix issues
|
|
141
|
+
python scripts/lint_runner.py . --fix
|
|
142
|
+
|
|
143
|
+
# Frontend only
|
|
144
|
+
python scripts/lint_runner.py . --frontend-only
|
|
145
|
+
|
|
146
|
+
# Backend only
|
|
147
|
+
python scripts/lint_runner.py . --backend-only
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Frontend Checks**:
|
|
151
|
+
- ESLint (JavaScript/TypeScript)
|
|
152
|
+
- Prettier (code formatting)
|
|
153
|
+
- TypeScript type checking
|
|
154
|
+
|
|
155
|
+
**Backend Checks**:
|
|
156
|
+
- dotnet format (C# formatting)
|
|
157
|
+
- dotnet build with warnings as errors
|
|
158
|
+
|
|
159
|
+
**Output**: Code quality report with pass/fail status
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
### โ
`checklist.py` - Quick Validation
|
|
164
|
+
|
|
165
|
+
**Purpose**: Fast validation checklist for development and pre-commit
|
|
166
|
+
|
|
167
|
+
**Usage**:
|
|
168
|
+
```bash
|
|
169
|
+
# Run checklist
|
|
170
|
+
python scripts/checklist.py .
|
|
171
|
+
|
|
172
|
+
# With URL for integration tests
|
|
173
|
+
python scripts/checklist.py . --url http://localhost:3000
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Checks**:
|
|
177
|
+
- Security (secrets, vulnerabilities)
|
|
178
|
+
- Frontend lint
|
|
179
|
+
- Frontend types
|
|
180
|
+
- Frontend tests
|
|
181
|
+
- Backend build
|
|
182
|
+
- Backend tests
|
|
183
|
+
|
|
184
|
+
**Output**: Pass/fail summary for each check
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
### ๐ฏ `verify_all.py` - Comprehensive Validation
|
|
189
|
+
|
|
190
|
+
**Purpose**: Complete validation suite before deployment
|
|
191
|
+
|
|
192
|
+
**Usage**:
|
|
193
|
+
```bash
|
|
194
|
+
# Full verification
|
|
195
|
+
python scripts/verify_all.py .
|
|
196
|
+
|
|
197
|
+
# With application URL
|
|
198
|
+
python scripts/verify_all.py . --url http://localhost:3000
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**Runs All Checks**:
|
|
202
|
+
- All checklist items
|
|
203
|
+
- Additional deployment validations
|
|
204
|
+
- Integration tests (if URL provided)
|
|
205
|
+
|
|
206
|
+
**Output**: Comprehensive validation report
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## When to Use Each Script
|
|
211
|
+
|
|
212
|
+
| Scenario | Script | Why |
|
|
213
|
+
|----------|--------|-----|
|
|
214
|
+
| Writing Vue components | `vitest_runner.py` | Validate component tests |
|
|
215
|
+
| Writing API endpoints | `xunit_runner.py` | Validate backend tests |
|
|
216
|
+
| Creating migrations | `schema_validator.py` | Ensure schema quality |
|
|
217
|
+
| Before commit | `checklist.py` | Quick validation |
|
|
218
|
+
| Before PR | `lint_runner.py` | Code quality check |
|
|
219
|
+
| Security review | `security_scan.py` | Find vulnerabilities |
|
|
220
|
+
| Before deployment | `verify_all.py` | Complete validation |
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Exit Codes
|
|
225
|
+
|
|
226
|
+
All scripts follow standard exit code conventions:
|
|
227
|
+
|
|
228
|
+
- **0** - Success (all checks passed)
|
|
229
|
+
- **1** - Failure (issues found)
|
|
230
|
+
|
|
231
|
+
This allows scripts to be used in CI/CD pipelines:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
python scripts/checklist.py . && echo "Ready to commit" || echo "Fix issues first"
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Integration with Agents
|
|
240
|
+
|
|
241
|
+
Agents automatically use these scripts when appropriate:
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
User: "Test my Vue components"
|
|
245
|
+
โ
|
|
246
|
+
@test-engineer activates
|
|
247
|
+
โ
|
|
248
|
+
Runs: python scripts/vitest_runner.py .
|
|
249
|
+
โ
|
|
250
|
+
Parses output and reports to user
|
|
251
|
+
โ
|
|
252
|
+
Asks: "Found 2 failing tests. Should I help fix them?"
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Requirements
|
|
258
|
+
|
|
259
|
+
### Python
|
|
260
|
+
- Python 3.7+
|
|
261
|
+
- No external dependencies (uses stdlib only)
|
|
262
|
+
|
|
263
|
+
### Project Dependencies
|
|
264
|
+
- **Frontend**: Node.js, npm, Vitest (for vitest_runner.py)
|
|
265
|
+
- **Backend**: .NET SDK (for xunit_runner.py)
|
|
266
|
+
- **Database**: SQL files in project (for schema_validator.py)
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Adding Custom Validations
|
|
271
|
+
|
|
272
|
+
To add project-specific validations:
|
|
273
|
+
|
|
274
|
+
1. Create a new script following the same pattern
|
|
275
|
+
2. Add to the agent's skill or workflow
|
|
276
|
+
3. Update this README with usage instructions
|
|
277
|
+
|
|
278
|
+
**Example**:
|
|
279
|
+
```python
|
|
280
|
+
#!/usr/bin/env python3
|
|
281
|
+
"""
|
|
282
|
+
Custom Validator - Your specific validation
|
|
283
|
+
"""
|
|
284
|
+
|
|
285
|
+
def main():
|
|
286
|
+
# Your validation logic
|
|
287
|
+
pass
|
|
288
|
+
|
|
289
|
+
if __name__ == "__main__":
|
|
290
|
+
main()
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Troubleshooting
|
|
296
|
+
|
|
297
|
+
### "Command not found"
|
|
298
|
+
- Ensure required tools are installed (npm, dotnet, etc.)
|
|
299
|
+
- Check PATH environment variable
|
|
300
|
+
|
|
301
|
+
### "Permission denied"
|
|
302
|
+
- Make scripts executable: `chmod +x scripts/*.py`
|
|
303
|
+
|
|
304
|
+
### "Timeout"
|
|
305
|
+
- Scripts timeout after 5 minutes
|
|
306
|
+
- For large projects, consider running specific checks
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Contributing
|
|
311
|
+
|
|
312
|
+
When modifying scripts:
|
|
313
|
+
|
|
314
|
+
1. Keep exit codes consistent (0 = success, 1 = failure)
|
|
315
|
+
2. Follow the output protocol (run โ parse โ summarize โ ask)
|
|
316
|
+
3. Add timeout handling for long-running commands
|
|
317
|
+
4. Update this README with changes
|
|
File without changes
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Lint Runner - Code quality and style checker
|
|
4
|
+
Universal linting script for any agent to validate code quality.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
python lint_runner.py <project_path>
|
|
8
|
+
python lint_runner.py <project_path> --fix
|
|
9
|
+
python lint_runner.py <project_path> --frontend-only
|
|
10
|
+
python lint_runner.py <project_path> --backend-only
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import subprocess
|
|
14
|
+
import sys
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
from typing import Tuple, Dict, Any, List
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def run_command(cmd: list[str], cwd: str = ".") -> Tuple[int, str]:
|
|
20
|
+
"""Run a command and return exit code and output."""
|
|
21
|
+
try:
|
|
22
|
+
result = subprocess.run(
|
|
23
|
+
cmd,
|
|
24
|
+
cwd=cwd,
|
|
25
|
+
capture_output=True,
|
|
26
|
+
text=True,
|
|
27
|
+
timeout=300
|
|
28
|
+
)
|
|
29
|
+
return result.returncode, result.stdout + result.stderr
|
|
30
|
+
except subprocess.TimeoutExpired:
|
|
31
|
+
return 1, "Command timed out after 5 minutes"
|
|
32
|
+
except FileNotFoundError:
|
|
33
|
+
return 1, f"Command not found: {cmd[0]}"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def detect_project_type(project_path: str) -> Dict[str, bool]:
|
|
37
|
+
"""Detect what types of projects exist."""
|
|
38
|
+
path = Path(project_path)
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
'frontend': (path / "package.json").exists(),
|
|
42
|
+
'backend': len(list(path.glob("**/*.csproj"))) > 0 or len(list(path.glob("*.sln"))) > 0,
|
|
43
|
+
'has_eslint': (path / ".eslintrc.js").exists() or (path / ".eslintrc.json").exists() or (path / "eslint.config.js").exists(),
|
|
44
|
+
'has_prettier': (path / ".prettierrc").exists() or (path / ".prettierrc.json").exists(),
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def lint_frontend(project_path: str, fix: bool = False) -> Tuple[int, str, Dict[str, Any]]:
|
|
49
|
+
"""Run frontend linting (ESLint, Prettier, TypeScript)."""
|
|
50
|
+
results = {
|
|
51
|
+
'eslint': {'code': None, 'output': ''},
|
|
52
|
+
'prettier': {'code': None, 'output': ''},
|
|
53
|
+
'typescript': {'code': None, 'output': ''},
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
package_json = Path(project_path) / "package.json"
|
|
57
|
+
if not package_json.exists():
|
|
58
|
+
return 1, "No package.json found", results
|
|
59
|
+
|
|
60
|
+
# ESLint
|
|
61
|
+
print(" Running ESLint...")
|
|
62
|
+
eslint_cmd = ["npm", "run", "lint"]
|
|
63
|
+
if fix:
|
|
64
|
+
eslint_cmd.append("--")
|
|
65
|
+
eslint_cmd.append("--fix")
|
|
66
|
+
|
|
67
|
+
code, output = run_command(eslint_cmd, project_path)
|
|
68
|
+
results['eslint'] = {'code': code, 'output': output}
|
|
69
|
+
|
|
70
|
+
# TypeScript type checking
|
|
71
|
+
print(" Running TypeScript type check...")
|
|
72
|
+
ts_cmd = ["npm", "run", "type-check"]
|
|
73
|
+
code, output = run_command(ts_cmd, project_path)
|
|
74
|
+
|
|
75
|
+
# If type-check script doesn't exist, try tsc directly
|
|
76
|
+
if "Missing script" in output or code == 1:
|
|
77
|
+
code, output = run_command(["npx", "tsc", "--noEmit"], project_path)
|
|
78
|
+
|
|
79
|
+
results['typescript'] = {'code': code, 'output': output}
|
|
80
|
+
|
|
81
|
+
# Prettier (if configured)
|
|
82
|
+
prettier_config = Path(project_path) / ".prettierrc"
|
|
83
|
+
if prettier_config.exists() or (Path(project_path) / ".prettierrc.json").exists():
|
|
84
|
+
print(" Running Prettier...")
|
|
85
|
+
prettier_cmd = ["npx", "prettier", "--check", "."]
|
|
86
|
+
if fix:
|
|
87
|
+
prettier_cmd = ["npx", "prettier", "--write", "."]
|
|
88
|
+
|
|
89
|
+
code, output = run_command(prettier_cmd, project_path)
|
|
90
|
+
results['prettier'] = {'code': code, 'output': output}
|
|
91
|
+
|
|
92
|
+
# Determine overall status
|
|
93
|
+
overall_code = 0
|
|
94
|
+
for tool, result in results.items():
|
|
95
|
+
if result['code'] is not None and result['code'] != 0:
|
|
96
|
+
overall_code = 1
|
|
97
|
+
|
|
98
|
+
return overall_code, "Frontend linting completed", results
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def lint_backend(project_path: str, fix: bool = False) -> Tuple[int, str, Dict[str, Any]]:
|
|
102
|
+
"""Run backend linting (dotnet format)."""
|
|
103
|
+
results = {
|
|
104
|
+
'dotnet_format': {'code': None, 'output': ''},
|
|
105
|
+
'dotnet_build': {'code': None, 'output': ''},
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
# Check if .NET project exists
|
|
109
|
+
sln_files = list(Path(project_path).glob("*.sln"))
|
|
110
|
+
csproj_files = list(Path(project_path).glob("**/*.csproj"))
|
|
111
|
+
|
|
112
|
+
if not sln_files and not csproj_files:
|
|
113
|
+
return 1, "No .NET project found", results
|
|
114
|
+
|
|
115
|
+
# dotnet format
|
|
116
|
+
print(" Running dotnet format...")
|
|
117
|
+
format_cmd = ["dotnet", "format"]
|
|
118
|
+
if not fix:
|
|
119
|
+
format_cmd.append("--verify-no-changes")
|
|
120
|
+
|
|
121
|
+
code, output = run_command(format_cmd, project_path)
|
|
122
|
+
results['dotnet_format'] = {'code': code, 'output': output}
|
|
123
|
+
|
|
124
|
+
# dotnet build (for additional warnings)
|
|
125
|
+
print(" Running dotnet build...")
|
|
126
|
+
build_cmd = ["dotnet", "build", "/warnaserror"]
|
|
127
|
+
code, output = run_command(build_cmd, project_path)
|
|
128
|
+
results['dotnet_build'] = {'code': code, 'output': output}
|
|
129
|
+
|
|
130
|
+
# Determine overall status
|
|
131
|
+
overall_code = 0
|
|
132
|
+
for tool, result in results.items():
|
|
133
|
+
if result['code'] is not None and result['code'] != 0:
|
|
134
|
+
overall_code = 1
|
|
135
|
+
|
|
136
|
+
return overall_code, "Backend linting completed", results
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def format_report(project_types: Dict[str, bool], frontend_results: Dict[str, Any], backend_results: Dict[str, Any]) -> str:
|
|
140
|
+
"""Format linting report."""
|
|
141
|
+
report = []
|
|
142
|
+
report.append("=" * 60)
|
|
143
|
+
report.append("๐ CODE QUALITY REPORT")
|
|
144
|
+
report.append("=" * 60)
|
|
145
|
+
|
|
146
|
+
report.append("")
|
|
147
|
+
report.append("๐ Project Type:")
|
|
148
|
+
if project_types['frontend']:
|
|
149
|
+
report.append(" โ
Frontend (Node.js/TypeScript)")
|
|
150
|
+
if project_types['backend']:
|
|
151
|
+
report.append(" โ
Backend (.NET/C#)")
|
|
152
|
+
|
|
153
|
+
# Frontend results
|
|
154
|
+
if frontend_results:
|
|
155
|
+
report.append("")
|
|
156
|
+
report.append("๐จ Frontend Linting:")
|
|
157
|
+
|
|
158
|
+
for tool, result in frontend_results.items():
|
|
159
|
+
if result['code'] is None:
|
|
160
|
+
continue
|
|
161
|
+
|
|
162
|
+
status = "โ
PASS" if result['code'] == 0 else "โ FAIL"
|
|
163
|
+
report.append(f" {tool.upper()}: {status}")
|
|
164
|
+
|
|
165
|
+
if result['code'] != 0:
|
|
166
|
+
# Show first few lines of error
|
|
167
|
+
error_lines = result['output'].split('\n')[:10]
|
|
168
|
+
for line in error_lines:
|
|
169
|
+
if line.strip():
|
|
170
|
+
report.append(f" {line}")
|
|
171
|
+
|
|
172
|
+
# Backend results
|
|
173
|
+
if backend_results:
|
|
174
|
+
report.append("")
|
|
175
|
+
report.append("โ๏ธ Backend Linting:")
|
|
176
|
+
|
|
177
|
+
for tool, result in backend_results.items():
|
|
178
|
+
if result['code'] is None:
|
|
179
|
+
continue
|
|
180
|
+
|
|
181
|
+
status = "โ
PASS" if result['code'] == 0 else "โ FAIL"
|
|
182
|
+
tool_name = tool.replace('_', ' ').title()
|
|
183
|
+
report.append(f" {tool_name}: {status}")
|
|
184
|
+
|
|
185
|
+
if result['code'] != 0:
|
|
186
|
+
# Show first few lines of error
|
|
187
|
+
error_lines = result['output'].split('\n')[:10]
|
|
188
|
+
for line in error_lines:
|
|
189
|
+
if line.strip():
|
|
190
|
+
report.append(f" {line}")
|
|
191
|
+
|
|
192
|
+
report.append("")
|
|
193
|
+
report.append("=" * 60)
|
|
194
|
+
|
|
195
|
+
return "\n".join(report)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def main():
|
|
199
|
+
if len(sys.argv) < 2:
|
|
200
|
+
print("Usage: python lint_runner.py <project_path> [--fix] [--frontend-only] [--backend-only]")
|
|
201
|
+
sys.exit(1)
|
|
202
|
+
|
|
203
|
+
project_path = sys.argv[1]
|
|
204
|
+
fix = "--fix" in sys.argv
|
|
205
|
+
frontend_only = "--frontend-only" in sys.argv
|
|
206
|
+
backend_only = "--backend-only" in sys.argv
|
|
207
|
+
|
|
208
|
+
print("๐ Lint Runner")
|
|
209
|
+
print("=" * 60)
|
|
210
|
+
print(f"Project: {project_path}")
|
|
211
|
+
print(f"Auto-fix: {fix}")
|
|
212
|
+
print()
|
|
213
|
+
|
|
214
|
+
# Detect project types
|
|
215
|
+
project_types = detect_project_type(project_path)
|
|
216
|
+
|
|
217
|
+
frontend_results = {}
|
|
218
|
+
backend_results = {}
|
|
219
|
+
overall_code = 0
|
|
220
|
+
|
|
221
|
+
# Run frontend linting
|
|
222
|
+
if project_types['frontend'] and not backend_only:
|
|
223
|
+
print("Running frontend linting...")
|
|
224
|
+
code, message, frontend_results = lint_frontend(project_path, fix)
|
|
225
|
+
if code != 0:
|
|
226
|
+
overall_code = 1
|
|
227
|
+
print()
|
|
228
|
+
|
|
229
|
+
# Run backend linting
|
|
230
|
+
if project_types['backend'] and not frontend_only:
|
|
231
|
+
print("Running backend linting...")
|
|
232
|
+
code, message, backend_results = lint_backend(project_path, fix)
|
|
233
|
+
if code != 0:
|
|
234
|
+
overall_code = 1
|
|
235
|
+
print()
|
|
236
|
+
|
|
237
|
+
# Generate report
|
|
238
|
+
report = format_report(project_types, frontend_results, backend_results)
|
|
239
|
+
print(report)
|
|
240
|
+
|
|
241
|
+
# Final status
|
|
242
|
+
if overall_code == 0:
|
|
243
|
+
print("โ
All linting checks passed!")
|
|
244
|
+
else:
|
|
245
|
+
print("โ Linting issues found")
|
|
246
|
+
if not fix:
|
|
247
|
+
print("\nRun with --fix to automatically fix issues")
|
|
248
|
+
|
|
249
|
+
sys.exit(overall_code)
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
if __name__ == "__main__":
|
|
253
|
+
main()
|