@diff-review-system/drs 1.0.0 → 2.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/.opencode/agent/describe/pr-describer.md +221 -0
- package/.opencode/agent/review/documentation.md +56 -0
- package/.opencode/agent/review/performance.md +32 -130
- package/.opencode/agent/review/quality.md +36 -104
- package/.opencode/agent/review/security.md +32 -94
- package/.opencode/agent/review/style.md +26 -10
- package/.opencode/agent/review/unified-reviewer.md +74 -0
- package/.opencode/opencode.jsonc +4 -41
- package/.opencode/tool/write_json_output.ts +24 -0
- package/README.md +215 -82
- package/dist/ci/runner.d.ts.map +1 -1
- package/dist/ci/runner.js +4 -4
- package/dist/ci/runner.js.map +1 -1
- package/dist/cli/describe-mr.d.ts +11 -0
- package/dist/cli/describe-mr.d.ts.map +1 -0
- package/dist/cli/describe-mr.js +104 -0
- package/dist/cli/describe-mr.js.map +1 -0
- package/dist/cli/describe-pr.d.ts +12 -0
- package/dist/cli/describe-pr.d.ts.map +1 -0
- package/dist/cli/describe-pr.js +105 -0
- package/dist/cli/describe-pr.js.map +1 -0
- package/dist/cli/index.js +234 -20
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init.d.ts +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +337 -120
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/post-comments.d.ts +15 -0
- package/dist/cli/post-comments.d.ts.map +1 -0
- package/dist/cli/post-comments.js +216 -0
- package/dist/cli/post-comments.js.map +1 -0
- package/dist/cli/review-local.d.ts +3 -0
- package/dist/cli/review-local.d.ts.map +1 -1
- package/dist/cli/review-local.js +46 -63
- package/dist/cli/review-local.js.map +1 -1
- package/dist/cli/review-mr.d.ts +7 -0
- package/dist/cli/review-mr.d.ts.map +1 -1
- package/dist/cli/review-mr.js +88 -117
- package/dist/cli/review-mr.js.map +1 -1
- package/dist/cli/review-pr.d.ts +6 -0
- package/dist/cli/review-pr.d.ts.map +1 -1
- package/dist/cli/review-pr.js +81 -114
- package/dist/cli/review-pr.js.map +1 -1
- package/dist/cli/show-changes.d.ts +15 -0
- package/dist/cli/show-changes.d.ts.map +1 -0
- package/dist/cli/show-changes.js +184 -0
- package/dist/cli/show-changes.js.map +1 -0
- package/dist/github/client.d.ts +199 -4
- package/dist/github/client.d.ts.map +1 -1
- package/dist/github/client.js +37 -2
- package/dist/github/client.js.map +1 -1
- package/dist/github/client.test.d.ts +2 -0
- package/dist/github/client.test.d.ts.map +1 -0
- package/dist/github/client.test.js +206 -0
- package/dist/github/client.test.js.map +1 -0
- package/dist/github/platform-adapter.d.ts +31 -0
- package/dist/github/platform-adapter.d.ts.map +1 -0
- package/dist/github/platform-adapter.js +129 -0
- package/dist/github/platform-adapter.js.map +1 -0
- package/dist/github/platform-adapter.test.d.ts +2 -0
- package/dist/github/platform-adapter.test.d.ts.map +1 -0
- package/dist/github/platform-adapter.test.js +40 -0
- package/dist/github/platform-adapter.test.js.map +1 -0
- package/dist/gitlab/client.d.ts +12 -0
- package/dist/gitlab/client.d.ts.map +1 -1
- package/dist/gitlab/client.js +19 -1
- package/dist/gitlab/client.js.map +1 -1
- package/dist/gitlab/diff-parser.test.d.ts +2 -0
- package/dist/gitlab/diff-parser.test.d.ts.map +1 -0
- package/dist/gitlab/diff-parser.test.js +315 -0
- package/dist/gitlab/diff-parser.test.js.map +1 -0
- package/dist/gitlab/platform-adapter.d.ts +27 -0
- package/dist/gitlab/platform-adapter.d.ts.map +1 -0
- package/dist/gitlab/platform-adapter.js +121 -0
- package/dist/gitlab/platform-adapter.js.map +1 -0
- package/dist/gitlab/platform-adapter.test.d.ts +2 -0
- package/dist/gitlab/platform-adapter.test.d.ts.map +1 -0
- package/dist/gitlab/platform-adapter.test.js +21 -0
- package/dist/gitlab/platform-adapter.test.js.map +1 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +7 -0
- package/dist/index.test.js.map +1 -0
- package/dist/lib/change-summary.d.ts +8 -0
- package/dist/lib/change-summary.d.ts.map +1 -0
- package/dist/lib/change-summary.js +2 -0
- package/dist/lib/change-summary.js.map +1 -0
- package/dist/lib/code-quality-report.d.ts +44 -0
- package/dist/lib/code-quality-report.d.ts.map +1 -0
- package/dist/lib/code-quality-report.js +62 -0
- package/dist/lib/code-quality-report.js.map +1 -0
- package/dist/lib/code-quality-report.test.d.ts +2 -0
- package/dist/lib/code-quality-report.test.d.ts.map +1 -0
- package/dist/lib/code-quality-report.test.js +327 -0
- package/dist/lib/code-quality-report.test.js.map +1 -0
- package/dist/{gitlab → lib}/comment-formatter.d.ts +6 -3
- package/dist/lib/comment-formatter.d.ts.map +1 -0
- package/dist/{gitlab → lib}/comment-formatter.js +63 -16
- package/dist/lib/comment-formatter.js.map +1 -0
- package/dist/lib/comment-formatter.test.d.ts +2 -0
- package/dist/lib/comment-formatter.test.d.ts.map +1 -0
- package/dist/lib/comment-formatter.test.js +607 -0
- package/dist/lib/comment-formatter.test.js.map +1 -0
- package/dist/lib/comment-manager.d.ts +61 -0
- package/dist/lib/comment-manager.d.ts.map +1 -0
- package/dist/lib/comment-manager.js +91 -0
- package/dist/lib/comment-manager.js.map +1 -0
- package/dist/lib/comment-manager.test.d.ts +2 -0
- package/dist/lib/comment-manager.test.d.ts.map +1 -0
- package/dist/lib/comment-manager.test.js +618 -0
- package/dist/lib/comment-manager.test.js.map +1 -0
- package/dist/lib/comment-poster.d.ts +21 -0
- package/dist/lib/comment-poster.d.ts.map +1 -0
- package/dist/lib/comment-poster.js +96 -0
- package/dist/lib/comment-poster.js.map +1 -0
- package/dist/lib/comment-poster.test.d.ts +5 -0
- package/dist/lib/comment-poster.test.d.ts.map +1 -0
- package/dist/lib/comment-poster.test.js +215 -0
- package/dist/lib/comment-poster.test.js.map +1 -0
- package/dist/lib/config-model-overrides.test.d.ts +12 -0
- package/dist/lib/config-model-overrides.test.d.ts.map +1 -0
- package/dist/lib/config-model-overrides.test.js +254 -0
- package/dist/lib/config-model-overrides.test.js.map +1 -0
- package/dist/lib/config.d.ts +93 -8
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +178 -25
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/config.test.d.ts +2 -0
- package/dist/lib/config.test.d.ts.map +1 -0
- package/dist/lib/config.test.js +36 -0
- package/dist/lib/config.test.js.map +1 -0
- package/dist/lib/context-compression.d.ts +19 -0
- package/dist/lib/context-compression.d.ts.map +1 -0
- package/dist/lib/context-compression.js +170 -0
- package/dist/lib/context-compression.js.map +1 -0
- package/dist/lib/context-compression.test.d.ts +2 -0
- package/dist/lib/context-compression.test.d.ts.map +1 -0
- package/dist/lib/context-compression.test.js +33 -0
- package/dist/lib/context-compression.test.js.map +1 -0
- package/dist/lib/context-loader.d.ts +29 -0
- package/dist/lib/context-loader.d.ts.map +1 -0
- package/dist/lib/context-loader.js +75 -0
- package/dist/lib/context-loader.js.map +1 -0
- package/dist/lib/context-loader.test.d.ts +2 -0
- package/dist/lib/context-loader.test.d.ts.map +1 -0
- package/dist/lib/context-loader.test.js +207 -0
- package/dist/lib/context-loader.test.js.map +1 -0
- package/dist/lib/describe-core.d.ts +9 -0
- package/dist/lib/describe-core.d.ts.map +1 -0
- package/dist/lib/describe-core.js +71 -0
- package/dist/lib/describe-core.js.map +1 -0
- package/dist/lib/describe-core.test.d.ts +2 -0
- package/dist/lib/describe-core.test.d.ts.map +1 -0
- package/dist/lib/describe-core.test.js +208 -0
- package/dist/lib/describe-core.test.js.map +1 -0
- package/dist/lib/describe-output-path.test.d.ts +2 -0
- package/dist/lib/describe-output-path.test.d.ts.map +1 -0
- package/dist/lib/describe-output-path.test.js +51 -0
- package/dist/lib/describe-output-path.test.js.map +1 -0
- package/dist/lib/describe-parser.d.ts +3 -0
- package/dist/lib/describe-parser.d.ts.map +1 -0
- package/dist/lib/describe-parser.js +163 -0
- package/dist/lib/describe-parser.js.map +1 -0
- package/dist/lib/describe-parser.test.d.ts +2 -0
- package/dist/lib/describe-parser.test.d.ts.map +1 -0
- package/dist/lib/describe-parser.test.js +282 -0
- package/dist/lib/describe-parser.test.js.map +1 -0
- package/dist/lib/description-executor.d.ts +22 -0
- package/dist/lib/description-executor.d.ts.map +1 -0
- package/dist/lib/description-executor.js +72 -0
- package/dist/lib/description-executor.js.map +1 -0
- package/dist/lib/description-formatter.d.ts +37 -0
- package/dist/lib/description-formatter.d.ts.map +1 -0
- package/dist/lib/description-formatter.js +219 -0
- package/dist/lib/description-formatter.js.map +1 -0
- package/dist/{gitlab → lib}/diff-parser.d.ts +11 -0
- package/dist/lib/diff-parser.d.ts.map +1 -0
- package/dist/{gitlab → lib}/diff-parser.js +40 -3
- package/dist/lib/diff-parser.js.map +1 -0
- package/dist/lib/issue-parser.d.ts +29 -0
- package/dist/lib/issue-parser.d.ts.map +1 -0
- package/dist/lib/issue-parser.js +153 -0
- package/dist/lib/issue-parser.js.map +1 -0
- package/dist/lib/issue-parser.test.d.ts +2 -0
- package/dist/lib/issue-parser.test.d.ts.map +1 -0
- package/dist/lib/issue-parser.test.js +281 -0
- package/dist/lib/issue-parser.test.js.map +1 -0
- package/dist/lib/json-output-schema.d.ts +207 -0
- package/dist/lib/json-output-schema.d.ts.map +1 -0
- package/dist/lib/json-output-schema.js +124 -0
- package/dist/lib/json-output-schema.js.map +1 -0
- package/dist/lib/json-output-schema.test.d.ts +2 -0
- package/dist/lib/json-output-schema.test.d.ts.map +1 -0
- package/dist/lib/json-output-schema.test.js +92 -0
- package/dist/lib/json-output-schema.test.js.map +1 -0
- package/dist/lib/json-output.d.ts +43 -0
- package/dist/lib/json-output.d.ts.map +1 -0
- package/dist/lib/json-output.js +34 -0
- package/dist/lib/json-output.js.map +1 -0
- package/dist/lib/output-paths.d.ts +6 -0
- package/dist/lib/output-paths.d.ts.map +1 -0
- package/dist/lib/output-paths.js +5 -0
- package/dist/lib/output-paths.js.map +1 -0
- package/dist/lib/platform-client.d.ts +130 -0
- package/dist/lib/platform-client.d.ts.map +1 -0
- package/dist/lib/platform-client.js +8 -0
- package/dist/lib/platform-client.js.map +1 -0
- package/dist/lib/position-validator.d.ts +36 -0
- package/dist/lib/position-validator.d.ts.map +1 -0
- package/dist/lib/position-validator.js +43 -0
- package/dist/lib/position-validator.js.map +1 -0
- package/dist/lib/repository-validator.d.ts +52 -0
- package/dist/lib/repository-validator.d.ts.map +1 -0
- package/dist/lib/repository-validator.js +219 -0
- package/dist/lib/repository-validator.js.map +1 -0
- package/dist/lib/repository-validator.test.d.ts +5 -0
- package/dist/lib/repository-validator.test.d.ts.map +1 -0
- package/dist/lib/repository-validator.test.js +341 -0
- package/dist/lib/repository-validator.test.js.map +1 -0
- package/dist/lib/review-core.d.ts +66 -0
- package/dist/lib/review-core.d.ts.map +1 -0
- package/dist/lib/review-core.js +449 -0
- package/dist/lib/review-core.js.map +1 -0
- package/dist/lib/review-core.test.d.ts +2 -0
- package/dist/lib/review-core.test.d.ts.map +1 -0
- package/dist/lib/review-core.test.js +552 -0
- package/dist/lib/review-core.test.js.map +1 -0
- package/dist/lib/review-orchestrator.d.ts +77 -0
- package/dist/lib/review-orchestrator.d.ts.map +1 -0
- package/dist/lib/review-orchestrator.js +124 -0
- package/dist/lib/review-orchestrator.js.map +1 -0
- package/dist/lib/review-orchestrator.test.d.ts +2 -0
- package/dist/lib/review-orchestrator.test.d.ts.map +1 -0
- package/dist/lib/review-orchestrator.test.js +413 -0
- package/dist/lib/review-orchestrator.test.js.map +1 -0
- package/dist/lib/review-output-path.test.d.ts +2 -0
- package/dist/lib/review-output-path.test.d.ts.map +1 -0
- package/dist/lib/review-output-path.test.js +83 -0
- package/dist/lib/review-output-path.test.js.map +1 -0
- package/dist/lib/review-parser.d.ts +2 -0
- package/dist/lib/review-parser.d.ts.map +1 -0
- package/dist/lib/review-parser.js +100 -0
- package/dist/lib/review-parser.js.map +1 -0
- package/dist/lib/unified-review-executor.d.ts +49 -0
- package/dist/lib/unified-review-executor.d.ts.map +1 -0
- package/dist/lib/unified-review-executor.js +158 -0
- package/dist/lib/unified-review-executor.js.map +1 -0
- package/dist/lib/unified-review-executor.test.d.ts +5 -0
- package/dist/lib/unified-review-executor.test.d.ts.map +1 -0
- package/dist/lib/unified-review-executor.test.js +344 -0
- package/dist/lib/unified-review-executor.test.js.map +1 -0
- package/dist/lib/write-json-output.d.ts +13 -0
- package/dist/lib/write-json-output.d.ts.map +1 -0
- package/dist/lib/write-json-output.js +37 -0
- package/dist/lib/write-json-output.js.map +1 -0
- package/dist/opencode/agent-loader.d.ts +3 -4
- package/dist/opencode/agent-loader.d.ts.map +1 -1
- package/dist/opencode/agent-loader.js +51 -42
- package/dist/opencode/agent-loader.js.map +1 -1
- package/dist/opencode/agent-skill-overlay.d.ts +11 -0
- package/dist/opencode/agent-skill-overlay.d.ts.map +1 -0
- package/dist/opencode/agent-skill-overlay.js +164 -0
- package/dist/opencode/agent-skill-overlay.js.map +1 -0
- package/dist/opencode/client.d.ts +14 -5
- package/dist/opencode/client.d.ts.map +1 -1
- package/dist/opencode/client.js +311 -32
- package/dist/opencode/client.js.map +1 -1
- package/dist/opencode/client.test.d.ts +2 -0
- package/dist/opencode/client.test.d.ts.map +1 -0
- package/dist/opencode/client.test.js +317 -0
- package/dist/opencode/client.test.js.map +1 -0
- package/dist/opencode/opencode-paths.d.ts +2 -0
- package/dist/opencode/opencode-paths.d.ts.map +1 -0
- package/dist/opencode/opencode-paths.js +7 -0
- package/dist/opencode/opencode-paths.js.map +1 -0
- package/dist/opencode/skill-loader.d.ts +6 -0
- package/dist/opencode/skill-loader.d.ts.map +1 -0
- package/dist/opencode/skill-loader.js +36 -0
- package/dist/opencode/skill-loader.js.map +1 -0
- package/package.json +29 -20
- package/.opencode/agent/github-reviewer.md +0 -62
- package/.opencode/agent/gitlab-reviewer.md +0 -62
- package/.opencode/agent/local-reviewer.md +0 -71
- package/dist/gitlab/comment-formatter.d.ts.map +0 -1
- package/dist/gitlab/comment-formatter.js.map +0 -1
- package/dist/gitlab/diff-parser.d.ts.map +0 -1
- package/dist/gitlab/diff-parser.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Security vulnerability and OWASP Top 10 specialist
|
|
3
3
|
color: "#E53E3E"
|
|
4
|
-
model: opencode/claude-sonnet-4-5
|
|
5
4
|
hidden: false
|
|
6
5
|
tools:
|
|
7
6
|
Read: true
|
|
@@ -9,107 +8,46 @@ tools:
|
|
|
9
8
|
Grep: true
|
|
10
9
|
---
|
|
11
10
|
|
|
12
|
-
You are
|
|
11
|
+
You are an elite security code reviewer with deep expertise in application security, threat modeling, and secure coding practices. Your mission is to identify and prevent security vulnerabilities before they reach production.
|
|
13
12
|
|
|
14
|
-
##
|
|
13
|
+
## Security Vulnerability Assessment
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
- SQL injection
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
15
|
+
- Systematically scan for OWASP Top 10 vulnerabilities (injection flaws, broken authentication, sensitive data exposure, XXE, broken access control, security misconfiguration, XSS, insecure deserialization, using components with known vulnerabilities, insufficient logging)
|
|
16
|
+
- Identify potential SQL injection, NoSQL injection, and command injection vulnerabilities
|
|
17
|
+
- Check for cross-site scripting (XSS) vulnerabilities in any user-facing output
|
|
18
|
+
- Look for cross-site request forgery (CSRF) protection gaps
|
|
19
|
+
- Examine cryptographic implementations for weak algorithms or improper key management
|
|
20
|
+
- Identify potential race conditions and time-of-check-time-of-use (TOCTOU) vulnerabilities
|
|
22
21
|
|
|
23
|
-
|
|
24
|
-
- Broken authentication flows
|
|
25
|
-
- Missing authorization checks
|
|
26
|
-
- Insecure session management
|
|
27
|
-
- JWT vulnerabilities
|
|
28
|
-
- Privilege escalation
|
|
22
|
+
## Input Validation and Sanitization
|
|
29
23
|
|
|
30
|
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
24
|
+
- Verify all user inputs are properly validated against expected formats and ranges
|
|
25
|
+
- Ensure input sanitization occurs at appropriate boundaries (client-side validation is supplementary, never primary)
|
|
26
|
+
- Check for proper encoding when outputting user data
|
|
27
|
+
- Validate that file uploads have proper type checking, size limits, and content validation
|
|
28
|
+
- Ensure API parameters are validated for type, format, and business logic constraints
|
|
29
|
+
- Look for potential path traversal vulnerabilities in file operations
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
- Debug mode in production
|
|
39
|
-
- Default credentials
|
|
40
|
-
- Unnecessary services enabled
|
|
41
|
-
- Missing security headers
|
|
42
|
-
- Verbose error messages
|
|
31
|
+
## Authentication and Authorization Review
|
|
43
32
|
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
33
|
+
- Verify authentication mechanisms use secure, industry-standard approaches
|
|
34
|
+
- Check for proper session management (secure cookies, appropriate timeouts, session invalidation)
|
|
35
|
+
- Ensure passwords are properly hashed using modern algorithms (bcrypt, Argon2, PBKDF2)
|
|
36
|
+
- Validate that authorization checks occur at every protected resource access
|
|
37
|
+
- Look for privilege escalation opportunities
|
|
38
|
+
- Check for insecure direct object references (IDOR)
|
|
39
|
+
- Verify proper implementation of role-based or attribute-based access control
|
|
50
40
|
|
|
51
|
-
##
|
|
41
|
+
## Analysis Methodology
|
|
52
42
|
|
|
53
|
-
|
|
43
|
+
1. Identify the security context and attack surface of the code
|
|
44
|
+
2. Map data flows from untrusted sources to sensitive operations
|
|
45
|
+
3. Examine each security-critical operation for proper controls
|
|
46
|
+
4. Consider both common vulnerabilities and context-specific threats
|
|
47
|
+
5. Evaluate defense-in-depth measures
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
🔒 SECURITY - [Vulnerability Type]
|
|
57
|
-
File: [path]:[line]
|
|
58
|
-
Severity: CRITICAL | HIGH | MEDIUM | LOW
|
|
49
|
+
## Review Structure Guidance
|
|
59
50
|
|
|
60
|
-
|
|
61
|
-
[Clear explanation of the vulnerability]
|
|
51
|
+
Provide findings in order of severity (Critical, High, Medium, Low, Informational). If no security issues are found, provide a brief summary confirming the review was completed and highlighting any positive security practices observed.
|
|
62
52
|
|
|
63
|
-
|
|
64
|
-
[Potential impact and attack scenario]
|
|
65
|
-
|
|
66
|
-
Fix:
|
|
67
|
-
[Secure code example]
|
|
68
|
-
|
|
69
|
-
References:
|
|
70
|
-
- [OWASP link]
|
|
71
|
-
- [CWE link if applicable]
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Examples
|
|
75
|
-
|
|
76
|
-
### SQL Injection
|
|
77
|
-
|
|
78
|
-
```typescript
|
|
79
|
-
// ❌ VULNERABLE
|
|
80
|
-
const query = `SELECT * FROM users WHERE id = ${userId}`
|
|
81
|
-
|
|
82
|
-
// ✅ SECURE
|
|
83
|
-
const query = 'SELECT * FROM users WHERE id = ?'
|
|
84
|
-
const result = await db.query(query, [userId])
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### XSS Prevention
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
// ❌ VULNERABLE
|
|
91
|
-
element.innerHTML = userInput
|
|
92
|
-
|
|
93
|
-
// ✅ SECURE
|
|
94
|
-
element.textContent = userInput
|
|
95
|
-
// or use a sanitization library
|
|
96
|
-
element.innerHTML = DOMPurify.sanitize(userInput)
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Hardcoded Credentials
|
|
100
|
-
|
|
101
|
-
```typescript
|
|
102
|
-
// ❌ VULNERABLE
|
|
103
|
-
const apiKey = "sk-1234567890abcdef"
|
|
104
|
-
|
|
105
|
-
// ✅ SECURE
|
|
106
|
-
const apiKey = process.env.API_KEY
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Focus on exploitable vulnerabilities. Prioritize issues that could lead to:
|
|
110
|
-
- Data breaches
|
|
111
|
-
- Unauthorized access
|
|
112
|
-
- Code execution
|
|
113
|
-
- Denial of service
|
|
114
|
-
|
|
115
|
-
Be precise with line numbers and provide actionable fixes.
|
|
53
|
+
Always consider the principle of least privilege, defense in depth, and fail securely. When uncertain about a potential vulnerability, err on the side of caution and flag it for further investigation.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Code style, formatting, and documentation specialist
|
|
3
3
|
color: "#805AD5"
|
|
4
|
-
model: opencode/claude-haiku-4-5
|
|
5
4
|
hidden: false
|
|
6
5
|
tools:
|
|
7
6
|
Read: true
|
|
@@ -30,6 +29,10 @@ You are a code style reviewer ensuring consistency and documentation quality.
|
|
|
30
29
|
- Outdated comments
|
|
31
30
|
- JSDoc/TSDoc completeness
|
|
32
31
|
- README updates needed
|
|
32
|
+
- New CLI flags or config options documented in README
|
|
33
|
+
- Command examples formatted consistently and kept up-to-date
|
|
34
|
+
- Markdown formatting issues (headings, code fences, lists, links)
|
|
35
|
+
- Consistent terminology for key concepts and feature names
|
|
33
36
|
|
|
34
37
|
### 4. Type Safety (TypeScript)
|
|
35
38
|
- Missing type annotations
|
|
@@ -45,17 +48,30 @@ You are a code style reviewer ensuring consistency and documentation quality.
|
|
|
45
48
|
|
|
46
49
|
## Review Format
|
|
47
50
|
|
|
51
|
+
**IMPORTANT**: You MUST output your findings in structured JSON format for automated processing.
|
|
52
|
+
|
|
53
|
+
After your analysis, provide a JSON code block with all issues found:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"issues": [
|
|
58
|
+
{
|
|
59
|
+
"category": "STYLE",
|
|
60
|
+
"severity": "CRITICAL" | "HIGH" | "MEDIUM" | "LOW",
|
|
61
|
+
"title": "Brief title of the style issue",
|
|
62
|
+
"file": "path/to/file.ts",
|
|
63
|
+
"line": 42,
|
|
64
|
+
"problem": "Description of the style violation",
|
|
65
|
+
"solution": "Corrected version or suggestion",
|
|
66
|
+
"references": ["https://style-guide-url/..."],
|
|
67
|
+
"agent": "style"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
48
71
|
```
|
|
49
|
-
✨ STYLE - [Issue Type]
|
|
50
|
-
File: [path]:[line]
|
|
51
|
-
Priority: BLOCKING | ADVISORY
|
|
52
|
-
|
|
53
|
-
Issue:
|
|
54
|
-
[Style violation]
|
|
55
72
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
```
|
|
73
|
+
**Required fields**: category, severity, title, file, problem, solution
|
|
74
|
+
**Optional fields**: line (line number), references (array of URLs)
|
|
59
75
|
|
|
60
76
|
## Examples
|
|
61
77
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Unified review agent covering security, quality, style, performance, and documentation
|
|
3
|
+
color: "#6B46C1"
|
|
4
|
+
hidden: false
|
|
5
|
+
tools:
|
|
6
|
+
Read: true
|
|
7
|
+
Glob: true
|
|
8
|
+
Grep: true
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are a unified code review agent responsible for reviewing changes across **security**, **quality**, **style**, **performance**, and **documentation** in a single pass. Focus on issues introduced in the diff and keep feedback concise and actionable.
|
|
12
|
+
|
|
13
|
+
## Review Priorities
|
|
14
|
+
|
|
15
|
+
- **Security**: injection risks, auth/authorization flaws, secrets exposure, unsafe deserialization.
|
|
16
|
+
- **Quality**: correctness, error handling, edge cases, maintainability.
|
|
17
|
+
- **Performance**: inefficient loops, unnecessary I/O, excessive allocations.
|
|
18
|
+
- **Style**: naming, consistency, readability, TypeScript best practices.
|
|
19
|
+
- **Documentation**: missing or inaccurate comments, README/API doc drift.
|
|
20
|
+
|
|
21
|
+
## Output Requirements
|
|
22
|
+
|
|
23
|
+
- You MUST call the `write_json_output` tool with:
|
|
24
|
+
- `outputType`: `"review_output"`
|
|
25
|
+
- `payload`: the JSON object described below
|
|
26
|
+
- After calling the tool, return **only** the JSON pointer returned by the tool
|
|
27
|
+
(e.g. `{"outputType":"review_output","outputPath":".drs/review-output.json"}`)
|
|
28
|
+
- Do **not** return raw JSON directly.
|
|
29
|
+
- Do **not** include markdown, code fences, or extra text.
|
|
30
|
+
- Follow this exact schema:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"timestamp": "ISO-8601 timestamp or descriptive string",
|
|
35
|
+
"summary": {
|
|
36
|
+
"filesReviewed": 0,
|
|
37
|
+
"issuesFound": 0,
|
|
38
|
+
"bySeverity": {
|
|
39
|
+
"CRITICAL": 0,
|
|
40
|
+
"HIGH": 0,
|
|
41
|
+
"MEDIUM": 0,
|
|
42
|
+
"LOW": 0
|
|
43
|
+
},
|
|
44
|
+
"byCategory": {
|
|
45
|
+
"SECURITY": 0,
|
|
46
|
+
"QUALITY": 0,
|
|
47
|
+
"STYLE": 0,
|
|
48
|
+
"PERFORMANCE": 0,
|
|
49
|
+
"DOCUMENTATION": 0
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"issues": [
|
|
53
|
+
{
|
|
54
|
+
"category": "SECURITY" | "QUALITY" | "STYLE" | "PERFORMANCE" | "DOCUMENTATION",
|
|
55
|
+
"severity": "CRITICAL" | "HIGH" | "MEDIUM" | "LOW",
|
|
56
|
+
"title": "Brief title",
|
|
57
|
+
"file": "path/to/file.ts",
|
|
58
|
+
"line": 42,
|
|
59
|
+
"problem": "Description of the problem",
|
|
60
|
+
"solution": "Concrete fix or mitigation",
|
|
61
|
+
"references": ["https://link1", "https://link2"],
|
|
62
|
+
"agent": "unified"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
If there are no issues, set `issues` to `[]` and keep summary counts at `0`.
|
|
69
|
+
|
|
70
|
+
### Important Constraints
|
|
71
|
+
- **Only report issues on changed or added lines** (lines starting with `+` in the diff).
|
|
72
|
+
- Prioritize **additions over deletions**; deletions are context only.
|
|
73
|
+
- Be specific: include file names and line numbers when available.
|
|
74
|
+
- Keep severities calibrated (use HIGH/CRITICAL sparingly).
|
package/.opencode/opencode.jsonc
CHANGED
|
@@ -1,52 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://opencode.ai/config.json",
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
".gitlab-review.md"
|
|
7
|
-
],
|
|
8
|
-
|
|
9
|
-
// LLM provider configuration
|
|
10
|
-
"provider": {
|
|
11
|
-
"opencode": {
|
|
12
|
-
"options": {}
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
// Custom tools configuration
|
|
4
|
+
// Tools available to DRS review agents
|
|
5
|
+
// Note: Agent model configuration is done via .drs/drs.config.yaml
|
|
17
6
|
"tools": {
|
|
18
|
-
"gitlab-api": true,
|
|
19
|
-
"github-api": true,
|
|
20
|
-
"Bash": true,
|
|
21
7
|
"Read": true,
|
|
22
8
|
"Glob": true,
|
|
23
9
|
"Grep": true,
|
|
10
|
+
"Bash": true,
|
|
11
|
+
"write_json_output": true,
|
|
24
12
|
"Write": false,
|
|
25
13
|
"Edit": false
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
// Agent model configuration
|
|
29
|
-
"agent": {
|
|
30
|
-
"gitlab-reviewer": {
|
|
31
|
-
"model": "opencode/claude-opus-4-5"
|
|
32
|
-
},
|
|
33
|
-
"github-reviewer": {
|
|
34
|
-
"model": "opencode/claude-opus-4-5"
|
|
35
|
-
},
|
|
36
|
-
"local-reviewer": {
|
|
37
|
-
"model": "opencode/claude-sonnet-4-5"
|
|
38
|
-
},
|
|
39
|
-
"review/security": {
|
|
40
|
-
"model": "opencode/claude-sonnet-4-5"
|
|
41
|
-
},
|
|
42
|
-
"review/quality": {
|
|
43
|
-
"model": "opencode/claude-sonnet-4-5"
|
|
44
|
-
},
|
|
45
|
-
"review/style": {
|
|
46
|
-
"model": "opencode/claude-haiku-4-5"
|
|
47
|
-
},
|
|
48
|
-
"review/performance": {
|
|
49
|
-
"model": "opencode/claude-sonnet-4-5"
|
|
50
|
-
}
|
|
51
14
|
}
|
|
52
15
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { tool } from '@opencode-ai/plugin';
|
|
2
|
+
import { writeJsonOutput } from '../../src/lib/write-json-output.js';
|
|
3
|
+
|
|
4
|
+
export default tool({
|
|
5
|
+
description: 'Write validated JSON output for DRS agents.',
|
|
6
|
+
args: {
|
|
7
|
+
outputType: tool.schema
|
|
8
|
+
.enum(['describe_output', 'review_output'])
|
|
9
|
+
.describe('The DRS output type to validate and write'),
|
|
10
|
+
payload: tool.schema.any().describe('JSON value or JSON string to write'),
|
|
11
|
+
pretty: tool.schema.boolean().optional().describe('Pretty-print JSON output'),
|
|
12
|
+
indent: tool.schema
|
|
13
|
+
.number()
|
|
14
|
+
.int()
|
|
15
|
+
.min(2)
|
|
16
|
+
.max(8)
|
|
17
|
+
.optional()
|
|
18
|
+
.describe('Indent size when pretty-printing'),
|
|
19
|
+
},
|
|
20
|
+
async execute({ outputType, payload, pretty, indent }) {
|
|
21
|
+
const pointer = await writeJsonOutput({ outputType, payload, pretty, indent });
|
|
22
|
+
return JSON.stringify(pointer);
|
|
23
|
+
},
|
|
24
|
+
});
|