@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
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { parseReviewIssues } from './issue-parser.js';
|
|
3
|
+
describe('parseReviewIssues', () => {
|
|
4
|
+
it('should parse valid JSON code block with issues', () => {
|
|
5
|
+
const content = `Here are my findings:
|
|
6
|
+
|
|
7
|
+
\`\`\`json
|
|
8
|
+
{
|
|
9
|
+
"issues": [
|
|
10
|
+
{
|
|
11
|
+
"category": "SECURITY",
|
|
12
|
+
"severity": "CRITICAL",
|
|
13
|
+
"title": "SQL Injection vulnerability",
|
|
14
|
+
"file": "src/api/users.ts",
|
|
15
|
+
"line": 42,
|
|
16
|
+
"problem": "Query uses string concatenation",
|
|
17
|
+
"solution": "Use parameterized queries",
|
|
18
|
+
"references": ["https://owasp.org/sql-injection"],
|
|
19
|
+
"agent": "security"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
\`\`\``;
|
|
24
|
+
const issues = parseReviewIssues(content, 'security');
|
|
25
|
+
expect(issues).toHaveLength(1);
|
|
26
|
+
expect(issues[0]).toEqual({
|
|
27
|
+
category: 'SECURITY',
|
|
28
|
+
severity: 'CRITICAL',
|
|
29
|
+
title: 'SQL Injection vulnerability',
|
|
30
|
+
file: 'src/api/users.ts',
|
|
31
|
+
line: 42,
|
|
32
|
+
problem: 'Query uses string concatenation',
|
|
33
|
+
solution: 'Use parameterized queries',
|
|
34
|
+
references: ['https://owasp.org/sql-injection'],
|
|
35
|
+
agent: 'security',
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
it('should parse multiple issues in a single JSON block', () => {
|
|
39
|
+
const content = `\`\`\`json
|
|
40
|
+
{
|
|
41
|
+
"issues": [
|
|
42
|
+
{
|
|
43
|
+
"category": "QUALITY",
|
|
44
|
+
"severity": "HIGH",
|
|
45
|
+
"title": "High complexity function",
|
|
46
|
+
"file": "src/utils/helper.ts",
|
|
47
|
+
"line": 10,
|
|
48
|
+
"problem": "Function has cyclomatic complexity of 15",
|
|
49
|
+
"solution": "Break into smaller functions",
|
|
50
|
+
"agent": "quality"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"category": "QUALITY",
|
|
54
|
+
"severity": "MEDIUM",
|
|
55
|
+
"title": "Code duplication",
|
|
56
|
+
"file": "src/utils/helper.ts",
|
|
57
|
+
"line": 50,
|
|
58
|
+
"problem": "Duplicated validation logic",
|
|
59
|
+
"solution": "Extract to shared validator function"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
\`\`\``;
|
|
64
|
+
const issues = parseReviewIssues(content, 'quality');
|
|
65
|
+
expect(issues).toHaveLength(2);
|
|
66
|
+
expect(issues[0].severity).toBe('HIGH');
|
|
67
|
+
expect(issues[1].severity).toBe('MEDIUM');
|
|
68
|
+
expect(issues[1].agent).toBe('quality'); // Should use default agent name
|
|
69
|
+
});
|
|
70
|
+
it('should parse raw JSON without code block markers', () => {
|
|
71
|
+
const content = `{"issues":[{"category":"PERFORMANCE","severity":"LOW","title":"Inefficient loop","file":"src/app.ts","line":5,"problem":"Using nested loops","solution":"Use hash map"}]}`;
|
|
72
|
+
const issues = parseReviewIssues(content, 'performance');
|
|
73
|
+
expect(issues).toHaveLength(1);
|
|
74
|
+
expect(issues[0].category).toBe('PERFORMANCE');
|
|
75
|
+
expect(issues[0].file).toBe('src/app.ts');
|
|
76
|
+
});
|
|
77
|
+
it('should handle issues without line numbers', () => {
|
|
78
|
+
const content = `\`\`\`json
|
|
79
|
+
{
|
|
80
|
+
"issues": [
|
|
81
|
+
{
|
|
82
|
+
"category": "STYLE",
|
|
83
|
+
"severity": "LOW",
|
|
84
|
+
"title": "Missing file header",
|
|
85
|
+
"file": "src/main.ts",
|
|
86
|
+
"problem": "No copyright header",
|
|
87
|
+
"solution": "Add standard file header",
|
|
88
|
+
"agent": "style"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
\`\`\``;
|
|
93
|
+
const issues = parseReviewIssues(content, 'style');
|
|
94
|
+
expect(issues).toHaveLength(1);
|
|
95
|
+
expect(issues[0].line).toBeUndefined();
|
|
96
|
+
});
|
|
97
|
+
it('should handle issues without references', () => {
|
|
98
|
+
const content = `\`\`\`json
|
|
99
|
+
{
|
|
100
|
+
"issues": [
|
|
101
|
+
{
|
|
102
|
+
"category": "QUALITY",
|
|
103
|
+
"severity": "MEDIUM",
|
|
104
|
+
"title": "Long function",
|
|
105
|
+
"file": "src/utils.ts",
|
|
106
|
+
"line": 100,
|
|
107
|
+
"problem": "Function exceeds 50 lines",
|
|
108
|
+
"solution": "Refactor into smaller functions",
|
|
109
|
+
"agent": "quality"
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
\`\`\``;
|
|
114
|
+
const issues = parseReviewIssues(content, 'quality');
|
|
115
|
+
expect(issues).toHaveLength(1);
|
|
116
|
+
expect(issues[0].references).toBeUndefined();
|
|
117
|
+
});
|
|
118
|
+
it('should return empty array for invalid JSON', () => {
|
|
119
|
+
const content = 'This is not valid JSON';
|
|
120
|
+
const issues = parseReviewIssues(content);
|
|
121
|
+
expect(issues).toEqual([]);
|
|
122
|
+
});
|
|
123
|
+
it('should return empty array for JSON without issues array', () => {
|
|
124
|
+
const content = `\`\`\`json
|
|
125
|
+
{
|
|
126
|
+
"message": "No issues found"
|
|
127
|
+
}
|
|
128
|
+
\`\`\``;
|
|
129
|
+
const issues = parseReviewIssues(content);
|
|
130
|
+
expect(issues).toEqual([]);
|
|
131
|
+
});
|
|
132
|
+
it('should skip invalid issues that are missing required fields', () => {
|
|
133
|
+
const content = `\`\`\`json
|
|
134
|
+
{
|
|
135
|
+
"issues": [
|
|
136
|
+
{
|
|
137
|
+
"category": "SECURITY",
|
|
138
|
+
"severity": "HIGH",
|
|
139
|
+
"title": "Missing problem field",
|
|
140
|
+
"file": "src/test.ts",
|
|
141
|
+
"solution": "Fix it"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"category": "QUALITY",
|
|
145
|
+
"severity": "MEDIUM",
|
|
146
|
+
"title": "Valid issue",
|
|
147
|
+
"file": "src/valid.ts",
|
|
148
|
+
"line": 10,
|
|
149
|
+
"problem": "This is valid",
|
|
150
|
+
"solution": "This has all required fields"
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
\`\`\``;
|
|
155
|
+
const issues = parseReviewIssues(content);
|
|
156
|
+
// Should only parse the valid issue
|
|
157
|
+
expect(issues).toHaveLength(1);
|
|
158
|
+
expect(issues[0].title).toBe('Valid issue');
|
|
159
|
+
});
|
|
160
|
+
it('should reject issues with invalid category', () => {
|
|
161
|
+
const content = `\`\`\`json
|
|
162
|
+
{
|
|
163
|
+
"issues": [
|
|
164
|
+
{
|
|
165
|
+
"category": "INVALID_CATEGORY",
|
|
166
|
+
"severity": "HIGH",
|
|
167
|
+
"title": "Test",
|
|
168
|
+
"file": "test.ts",
|
|
169
|
+
"problem": "Problem",
|
|
170
|
+
"solution": "Solution"
|
|
171
|
+
}
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
\`\`\``;
|
|
175
|
+
const issues = parseReviewIssues(content);
|
|
176
|
+
expect(issues).toEqual([]);
|
|
177
|
+
});
|
|
178
|
+
it('should reject issues with invalid severity', () => {
|
|
179
|
+
const content = `\`\`\`json
|
|
180
|
+
{
|
|
181
|
+
"issues": [
|
|
182
|
+
{
|
|
183
|
+
"category": "SECURITY",
|
|
184
|
+
"severity": "SUPER_CRITICAL",
|
|
185
|
+
"title": "Test",
|
|
186
|
+
"file": "test.ts",
|
|
187
|
+
"problem": "Problem",
|
|
188
|
+
"solution": "Solution"
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
\`\`\``;
|
|
193
|
+
const issues = parseReviewIssues(content);
|
|
194
|
+
expect(issues).toEqual([]);
|
|
195
|
+
});
|
|
196
|
+
it('should handle multiple JSON blocks in same content', () => {
|
|
197
|
+
const content = `First agent findings:
|
|
198
|
+
|
|
199
|
+
\`\`\`json
|
|
200
|
+
{
|
|
201
|
+
"issues": [
|
|
202
|
+
{
|
|
203
|
+
"category": "SECURITY",
|
|
204
|
+
"severity": "HIGH",
|
|
205
|
+
"title": "Issue 1",
|
|
206
|
+
"file": "src/a.ts",
|
|
207
|
+
"line": 1,
|
|
208
|
+
"problem": "Problem 1",
|
|
209
|
+
"solution": "Solution 1",
|
|
210
|
+
"agent": "security"
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
\`\`\`
|
|
215
|
+
|
|
216
|
+
Second agent findings:
|
|
217
|
+
|
|
218
|
+
\`\`\`json
|
|
219
|
+
{
|
|
220
|
+
"issues": [
|
|
221
|
+
{
|
|
222
|
+
"category": "QUALITY",
|
|
223
|
+
"severity": "MEDIUM",
|
|
224
|
+
"title": "Issue 2",
|
|
225
|
+
"file": "src/b.ts",
|
|
226
|
+
"line": 2,
|
|
227
|
+
"problem": "Problem 2",
|
|
228
|
+
"solution": "Solution 2",
|
|
229
|
+
"agent": "quality"
|
|
230
|
+
}
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
\`\`\``;
|
|
234
|
+
const issues = parseReviewIssues(content);
|
|
235
|
+
expect(issues).toHaveLength(2);
|
|
236
|
+
expect(issues[0].agent).toBe('security');
|
|
237
|
+
expect(issues[1].agent).toBe('quality');
|
|
238
|
+
});
|
|
239
|
+
it('should use provided agent name when issue does not have agent field', () => {
|
|
240
|
+
const content = `\`\`\`json
|
|
241
|
+
{
|
|
242
|
+
"issues": [
|
|
243
|
+
{
|
|
244
|
+
"category": "PERFORMANCE",
|
|
245
|
+
"severity": "LOW",
|
|
246
|
+
"title": "Slow operation",
|
|
247
|
+
"file": "src/perf.ts",
|
|
248
|
+
"line": 20,
|
|
249
|
+
"problem": "Inefficient algorithm",
|
|
250
|
+
"solution": "Use better algorithm"
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
\`\`\``;
|
|
255
|
+
const issues = parseReviewIssues(content, 'performance-agent');
|
|
256
|
+
expect(issues).toHaveLength(1);
|
|
257
|
+
expect(issues[0].agent).toBe('performance-agent');
|
|
258
|
+
});
|
|
259
|
+
it('should handle whitespace in JSON code blocks', () => {
|
|
260
|
+
const content = `\`\`\`json
|
|
261
|
+
|
|
262
|
+
{
|
|
263
|
+
"issues": [
|
|
264
|
+
{
|
|
265
|
+
"category": "STYLE",
|
|
266
|
+
"severity": "LOW",
|
|
267
|
+
"title": "Formatting",
|
|
268
|
+
"file": "src/style.ts",
|
|
269
|
+
"line": 1,
|
|
270
|
+
"problem": "Inconsistent formatting",
|
|
271
|
+
"solution": "Run prettier"
|
|
272
|
+
}
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
\`\`\``;
|
|
277
|
+
const issues = parseReviewIssues(content);
|
|
278
|
+
expect(issues).toHaveLength(1);
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
//# sourceMappingURL=issue-parser.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-parser.test.js","sourceRoot":"","sources":["../../src/lib/issue-parser.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;QACxD,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;OAkBb,CAAC;QAEJ,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAEtD,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC/B,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AC,IAAI,CAAC,UAAU,CAAC,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qEAAqE,EAAE,GAAG,EAAE;QAC7E,MAAM,OAAO,GAAG;;;;;;;;;;;;;;OAcb,CAAC;QAEJ,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;QAE/D,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;OAgBb,CAAC;QAEJ,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAE1C,MAAM,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
export declare const describeOutputSchema: {
|
|
2
|
+
readonly type: "object";
|
|
3
|
+
readonly additionalProperties: false;
|
|
4
|
+
readonly required: readonly ["type", "title", "summary"];
|
|
5
|
+
readonly properties: {
|
|
6
|
+
readonly type: {
|
|
7
|
+
readonly type: "string";
|
|
8
|
+
readonly enum: readonly ["feature", "bugfix", "refactor", "docs", "test", "chore", "perf"];
|
|
9
|
+
};
|
|
10
|
+
readonly title: {
|
|
11
|
+
readonly type: "string";
|
|
12
|
+
readonly minLength: 1;
|
|
13
|
+
};
|
|
14
|
+
readonly summary: {
|
|
15
|
+
readonly type: "array";
|
|
16
|
+
readonly items: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
};
|
|
19
|
+
readonly minItems: 1;
|
|
20
|
+
};
|
|
21
|
+
readonly walkthrough: {
|
|
22
|
+
readonly type: "array";
|
|
23
|
+
readonly items: {
|
|
24
|
+
readonly type: "object";
|
|
25
|
+
readonly additionalProperties: false;
|
|
26
|
+
readonly required: readonly ["file", "changeType", "semanticLabel", "title"];
|
|
27
|
+
readonly properties: {
|
|
28
|
+
readonly file: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly minLength: 1;
|
|
31
|
+
};
|
|
32
|
+
readonly changeType: {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
readonly enum: readonly ["added", "modified", "deleted", "renamed"];
|
|
35
|
+
};
|
|
36
|
+
readonly semanticLabel: {
|
|
37
|
+
readonly type: "string";
|
|
38
|
+
readonly enum: readonly ["feature", "bugfix", "refactor", "test", "docs", "infrastructure", "configuration"];
|
|
39
|
+
};
|
|
40
|
+
readonly title: {
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
readonly minLength: 1;
|
|
43
|
+
};
|
|
44
|
+
readonly changes: {
|
|
45
|
+
readonly type: "array";
|
|
46
|
+
readonly items: {
|
|
47
|
+
readonly type: "string";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
readonly significance: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
readonly enum: readonly ["major", "minor"];
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly labels: {
|
|
58
|
+
readonly type: "array";
|
|
59
|
+
readonly items: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
readonly recommendations: {
|
|
64
|
+
readonly type: "array";
|
|
65
|
+
readonly items: {
|
|
66
|
+
readonly type: "string";
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export declare const reviewOutputSchema: {
|
|
72
|
+
readonly type: "object";
|
|
73
|
+
readonly additionalProperties: false;
|
|
74
|
+
readonly required: readonly ["timestamp", "summary", "issues"];
|
|
75
|
+
readonly properties: {
|
|
76
|
+
readonly timestamp: {
|
|
77
|
+
readonly type: "string";
|
|
78
|
+
readonly minLength: 1;
|
|
79
|
+
};
|
|
80
|
+
readonly summary: {
|
|
81
|
+
readonly type: "object";
|
|
82
|
+
readonly additionalProperties: false;
|
|
83
|
+
readonly required: readonly ["filesReviewed", "issuesFound", "bySeverity", "byCategory"];
|
|
84
|
+
readonly properties: {
|
|
85
|
+
readonly filesReviewed: {
|
|
86
|
+
readonly type: "number";
|
|
87
|
+
};
|
|
88
|
+
readonly issuesFound: {
|
|
89
|
+
readonly type: "number";
|
|
90
|
+
};
|
|
91
|
+
readonly bySeverity: {
|
|
92
|
+
readonly type: "object";
|
|
93
|
+
readonly additionalProperties: false;
|
|
94
|
+
readonly required: readonly ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
95
|
+
readonly properties: {
|
|
96
|
+
readonly CRITICAL: {
|
|
97
|
+
readonly type: "number";
|
|
98
|
+
};
|
|
99
|
+
readonly HIGH: {
|
|
100
|
+
readonly type: "number";
|
|
101
|
+
};
|
|
102
|
+
readonly MEDIUM: {
|
|
103
|
+
readonly type: "number";
|
|
104
|
+
};
|
|
105
|
+
readonly LOW: {
|
|
106
|
+
readonly type: "number";
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
readonly byCategory: {
|
|
111
|
+
readonly type: "object";
|
|
112
|
+
readonly additionalProperties: false;
|
|
113
|
+
readonly required: readonly ["SECURITY", "QUALITY", "STYLE", "PERFORMANCE", "DOCUMENTATION"];
|
|
114
|
+
readonly properties: {
|
|
115
|
+
readonly SECURITY: {
|
|
116
|
+
readonly type: "number";
|
|
117
|
+
};
|
|
118
|
+
readonly QUALITY: {
|
|
119
|
+
readonly type: "number";
|
|
120
|
+
};
|
|
121
|
+
readonly STYLE: {
|
|
122
|
+
readonly type: "number";
|
|
123
|
+
};
|
|
124
|
+
readonly PERFORMANCE: {
|
|
125
|
+
readonly type: "number";
|
|
126
|
+
};
|
|
127
|
+
readonly DOCUMENTATION: {
|
|
128
|
+
readonly type: "number";
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
readonly issues: {
|
|
135
|
+
readonly type: "array";
|
|
136
|
+
readonly items: {
|
|
137
|
+
readonly type: "object";
|
|
138
|
+
readonly additionalProperties: false;
|
|
139
|
+
readonly required: readonly ["category", "severity", "title", "file", "problem", "solution", "agent"];
|
|
140
|
+
readonly properties: {
|
|
141
|
+
readonly category: {
|
|
142
|
+
readonly type: "string";
|
|
143
|
+
readonly enum: readonly ["SECURITY", "QUALITY", "STYLE", "PERFORMANCE", "DOCUMENTATION"];
|
|
144
|
+
};
|
|
145
|
+
readonly severity: {
|
|
146
|
+
readonly type: "string";
|
|
147
|
+
readonly enum: readonly ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
148
|
+
};
|
|
149
|
+
readonly title: {
|
|
150
|
+
readonly type: "string";
|
|
151
|
+
readonly minLength: 1;
|
|
152
|
+
};
|
|
153
|
+
readonly file: {
|
|
154
|
+
readonly type: "string";
|
|
155
|
+
readonly minLength: 1;
|
|
156
|
+
};
|
|
157
|
+
readonly line: {
|
|
158
|
+
readonly type: "number";
|
|
159
|
+
};
|
|
160
|
+
readonly problem: {
|
|
161
|
+
readonly type: "string";
|
|
162
|
+
readonly minLength: 1;
|
|
163
|
+
};
|
|
164
|
+
readonly solution: {
|
|
165
|
+
readonly type: "string";
|
|
166
|
+
readonly minLength: 1;
|
|
167
|
+
};
|
|
168
|
+
readonly references: {
|
|
169
|
+
readonly type: "array";
|
|
170
|
+
readonly items: {
|
|
171
|
+
readonly type: "string";
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
readonly agent: {
|
|
175
|
+
readonly type: "string";
|
|
176
|
+
readonly minLength: 1;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
readonly metadata: {
|
|
182
|
+
readonly type: "object";
|
|
183
|
+
readonly additionalProperties: false;
|
|
184
|
+
readonly properties: {
|
|
185
|
+
readonly source: {
|
|
186
|
+
readonly type: "string";
|
|
187
|
+
};
|
|
188
|
+
readonly project: {
|
|
189
|
+
readonly type: "string";
|
|
190
|
+
};
|
|
191
|
+
readonly branch: {
|
|
192
|
+
readonly type: "object";
|
|
193
|
+
readonly additionalProperties: false;
|
|
194
|
+
readonly properties: {
|
|
195
|
+
readonly source: {
|
|
196
|
+
readonly type: "string";
|
|
197
|
+
};
|
|
198
|
+
readonly target: {
|
|
199
|
+
readonly type: "string";
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
//# sourceMappingURL=json-output-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-output-schema.d.ts","sourceRoot":"","sources":["../../src/lib/json-output-schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCvB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgFrB,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
export const describeOutputSchema = {
|
|
2
|
+
type: 'object',
|
|
3
|
+
additionalProperties: false,
|
|
4
|
+
required: ['type', 'title', 'summary'],
|
|
5
|
+
properties: {
|
|
6
|
+
type: {
|
|
7
|
+
type: 'string',
|
|
8
|
+
enum: ['feature', 'bugfix', 'refactor', 'docs', 'test', 'chore', 'perf'],
|
|
9
|
+
},
|
|
10
|
+
title: { type: 'string', minLength: 1 },
|
|
11
|
+
summary: { type: 'array', items: { type: 'string' }, minItems: 1 },
|
|
12
|
+
walkthrough: {
|
|
13
|
+
type: 'array',
|
|
14
|
+
items: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
additionalProperties: false,
|
|
17
|
+
required: ['file', 'changeType', 'semanticLabel', 'title'],
|
|
18
|
+
properties: {
|
|
19
|
+
file: { type: 'string', minLength: 1 },
|
|
20
|
+
changeType: { type: 'string', enum: ['added', 'modified', 'deleted', 'renamed'] },
|
|
21
|
+
semanticLabel: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
enum: [
|
|
24
|
+
'feature',
|
|
25
|
+
'bugfix',
|
|
26
|
+
'refactor',
|
|
27
|
+
'test',
|
|
28
|
+
'docs',
|
|
29
|
+
'infrastructure',
|
|
30
|
+
'configuration',
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
title: { type: 'string', minLength: 1 },
|
|
34
|
+
changes: { type: 'array', items: { type: 'string' } },
|
|
35
|
+
significance: { type: 'string', enum: ['major', 'minor'] },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
labels: { type: 'array', items: { type: 'string' } },
|
|
40
|
+
recommendations: { type: 'array', items: { type: 'string' } },
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
export const reviewOutputSchema = {
|
|
44
|
+
type: 'object',
|
|
45
|
+
additionalProperties: false,
|
|
46
|
+
required: ['timestamp', 'summary', 'issues'],
|
|
47
|
+
properties: {
|
|
48
|
+
timestamp: { type: 'string', minLength: 1 },
|
|
49
|
+
summary: {
|
|
50
|
+
type: 'object',
|
|
51
|
+
additionalProperties: false,
|
|
52
|
+
required: ['filesReviewed', 'issuesFound', 'bySeverity', 'byCategory'],
|
|
53
|
+
properties: {
|
|
54
|
+
filesReviewed: { type: 'number' },
|
|
55
|
+
issuesFound: { type: 'number' },
|
|
56
|
+
bySeverity: {
|
|
57
|
+
type: 'object',
|
|
58
|
+
additionalProperties: false,
|
|
59
|
+
required: ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'],
|
|
60
|
+
properties: {
|
|
61
|
+
CRITICAL: { type: 'number' },
|
|
62
|
+
HIGH: { type: 'number' },
|
|
63
|
+
MEDIUM: { type: 'number' },
|
|
64
|
+
LOW: { type: 'number' },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
byCategory: {
|
|
68
|
+
type: 'object',
|
|
69
|
+
additionalProperties: false,
|
|
70
|
+
required: ['SECURITY', 'QUALITY', 'STYLE', 'PERFORMANCE', 'DOCUMENTATION'],
|
|
71
|
+
properties: {
|
|
72
|
+
SECURITY: { type: 'number' },
|
|
73
|
+
QUALITY: { type: 'number' },
|
|
74
|
+
STYLE: { type: 'number' },
|
|
75
|
+
PERFORMANCE: { type: 'number' },
|
|
76
|
+
DOCUMENTATION: { type: 'number' },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
issues: {
|
|
82
|
+
type: 'array',
|
|
83
|
+
items: {
|
|
84
|
+
type: 'object',
|
|
85
|
+
additionalProperties: false,
|
|
86
|
+
required: ['category', 'severity', 'title', 'file', 'problem', 'solution', 'agent'],
|
|
87
|
+
properties: {
|
|
88
|
+
category: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
enum: ['SECURITY', 'QUALITY', 'STYLE', 'PERFORMANCE', 'DOCUMENTATION'],
|
|
91
|
+
},
|
|
92
|
+
severity: {
|
|
93
|
+
type: 'string',
|
|
94
|
+
enum: ['CRITICAL', 'HIGH', 'MEDIUM', 'LOW'],
|
|
95
|
+
},
|
|
96
|
+
title: { type: 'string', minLength: 1 },
|
|
97
|
+
file: { type: 'string', minLength: 1 },
|
|
98
|
+
line: { type: 'number' },
|
|
99
|
+
problem: { type: 'string', minLength: 1 },
|
|
100
|
+
solution: { type: 'string', minLength: 1 },
|
|
101
|
+
references: { type: 'array', items: { type: 'string' } },
|
|
102
|
+
agent: { type: 'string', minLength: 1 },
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
metadata: {
|
|
107
|
+
type: 'object',
|
|
108
|
+
additionalProperties: false,
|
|
109
|
+
properties: {
|
|
110
|
+
source: { type: 'string' },
|
|
111
|
+
project: { type: 'string' },
|
|
112
|
+
branch: {
|
|
113
|
+
type: 'object',
|
|
114
|
+
additionalProperties: false,
|
|
115
|
+
properties: {
|
|
116
|
+
source: { type: 'string' },
|
|
117
|
+
target: { type: 'string' },
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=json-output-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-output-schema.js","sourceRoot":"","sources":["../../src/lib/json-output-schema.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC;IACtC,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC;SACzE;QACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE;QACvC,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;QAClE,WAAW,EAAE;YACX,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,I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