AsyncGuard scans codebases for async/await anti-patterns, promise misuse, async resource leaks, event loop blocking, missing cancellation support, async error handling gaps, and coordination issues. It uses regex-based pattern matching against 90 async-specific patterns across 6 categories, lefthook for git hook integration, and produces markdown reports with actionable remediation guidance. 100% local. Zero telemetry.
asyncguard scan [file|directory]
One-shot async safety scan of files or directories.
How to execute:
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [target]
What it does:
Example usage scenarios:
asyncguard scan .
asyncguard scan src/server.ts
asyncguard scan src/
asyncguard scan .
asyncguard scan .
asyncguard scan --tier pro [file|directory]
Extended scan with 60 patterns covering promise misuse, resource leaks, event loop blocking, and cancellation.
How to execute:
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [target] --tier pro
What it does:
asyncguard scan --format json [directory]
Generate JSON output for CI/CD integration.
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [directory] --format json
asyncguard scan --format html [directory]
Generate HTML report for browser viewing.
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [directory] --format html
asyncguard scan --category EL [directory]
Filter scan to a specific check category (PM, AR, EL, CA, AE, AC).
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [directory] --category EL
asyncguard scan --tier team [directory]
Full scan with all 90 patterns across all 6 categories including async error patterns and coordination.
How to execute:
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [directory] --tier team
What it does:
asyncguard scan --verbose [directory]
Verbose output showing every matched line and pattern details.
bash "<SKILL_DIR>/scripts/dispatcher.sh" --path [directory] --verbose
asyncguard status
Show license and configuration information.
bash "<SKILL_DIR>/scripts/dispatcher.sh" status
AsyncGuard detects 90 async anti-patterns across 6 categories:
| Category | Code | Patterns | Description | Severity Range |
|----------|------|----------|-------------|----------------|
| Promise/Future Misuse | PM | 15 | Unhandled promises, async executor, nested .then chains, deferred antipattern | medium -- critical |
| Async Resource Leaks | AR | 15 | Unclosed connections, missing dispose, dangling streams, leaked timers | medium -- critical |
| Event Loop Blocking | EL | 15 | Sync file I/O, sync crypto, CPU loops, sync child process | low -- critical |
| Cancellation & Abortion | CA | 15 | Missing AbortSignal, orphaned tasks, no cleanup on unmount | medium -- critical |
| Async Error Patterns | AE | 15 | Swallowed rejections, empty .catch, async forEach, missing try/catch | medium -- critical |
| Async Coordination | AC | 15 | Unbounded Promise.all, missing semaphore, no backpressure, no rate limit | medium -- critical |
| Tier | Patterns | Categories |
|------|----------|------------|
| Free | 30 | PM, AR |
| Pro | 60 | PM, AR, EL, CA |
| Team | 90 | PM, AR, EL, CA, AE, AC |
| Enterprise | 90 | PM, AR, EL, CA, AE, AC + priority support |
AsyncGuard uses a deductive scoring system starting at 100 (perfect):
| Severity | Point Deduction | Description |
|----------|-----------------|-------------|
| Critical | -25 per finding | Severe async issue (resource leaks, unhandled rejections, blocking I/O) |
| High | -15 per finding | Significant async problem (missing cancellation, no error handler) |
| Medium | -8 per finding | Moderate concern (coordination issues, missing backpressure) |
| Low | -3 per finding | Informational / best practice suggestion |
| Grade | Score Range | Meaning |
|-------|-------------|---------|
| A | 90-100 | Excellent async code quality |
| B | 80-89 | Good async patterns with minor issues |
| C | 70-79 | Acceptable but needs improvement |
| D | 60-69 | Poor async quality |
| F | Below 60 | Critical async problems |
Users can configure AsyncGuard in ~/.openclaw/openclaw.json:
{
"skills": {
"entries": {
"asyncguard": {
"enabled": true,
"apiKey": "YOUR_LICENSE_KEY_HERE",
"config": {
"severityThreshold": "medium",
"ignorePatterns": ["**/test/**", "**/fixtures/**", "**/*.test.*"],
"ignoreChecks": [],
"reportFormat": "text"
}
}
}
}
}
The user might say things like:
共 1 个版本