File size: 4,295 Bytes
440cddf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9284ad7
 
 
 
440cddf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9284ad7
 
 
440cddf
 
9284ad7
440cddf
 
 
 
 
 
 
 
 
 
 
 
9284ad7
 
 
 
 
440cddf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9284ad7
 
 
440cddf
 
 
 
 
 
 
 
 
 
 
 
9284ad7
 
 
 
 
 
440cddf
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Inputs = void 0;
class Inputs {
    systemMessage;
    title;
    description;
    rawSummary;
    shortSummary;
    filename;
    fileContent;
    fileDiff;
    patches;
    diff;
    commentChain;
    comment;
    suggestion;
    error;
    taskDescription;
    codebaseStructure;
    remedyContext;
    batchContent;
    constructor(systemMessage = '', title = 'no title provided', description = 'no description provided', rawSummary = '', shortSummary = '', filename = '', fileContent = 'file contents cannot be provided', fileDiff = 'file diff cannot be provided', patches = '', diff = 'no diff', commentChain = 'no other comments on this patch', comment = 'no comment provided', suggestion = '', error = '', taskDescription = '', codebaseStructure = '', remedyContext = '', batchContent = '') {
        this.systemMessage = systemMessage;
        this.title = title;
        this.description = description;
        this.rawSummary = rawSummary;
        this.shortSummary = shortSummary;
        this.filename = filename;
        this.fileContent = fileContent;
        this.fileDiff = fileDiff;
        this.patches = patches;
        this.diff = diff;
        this.commentChain = commentChain;
        this.comment = comment;
        this.suggestion = suggestion;
        this.error = error;
        this.taskDescription = taskDescription;
        this.codebaseStructure = codebaseStructure;
        this.remedyContext = remedyContext;
        this.batchContent = batchContent;
    }
    clone() {
        return new Inputs(this.systemMessage, this.title, this.description, this.rawSummary, this.shortSummary, this.filename, this.fileContent, this.fileDiff, this.patches, this.diff, this.commentChain, this.comment, this.suggestion, this.error, this.taskDescription, this.codebaseStructure, this.remedyContext, this.batchContent);
    }
    render(content) {
        if (!content) {
            return '';
        }
        if (this.systemMessage) {
            content = content.replace('$system_message', this.systemMessage);
        }
        if (this.title) {
            content = content.replace('$title', this.title);
        }
        if (this.description) {
            let desc = this.description;
            if (desc.length > 2000) {
                desc = `${desc.substring(0, 2000)}\n\n[Note: PR Description truncated]`;
            }
            content = content.replace('$description', desc);
        }
        if (this.rawSummary) {
            content = content.replace('$raw_summary', this.rawSummary);
        }
        if (this.shortSummary) {
            content = content.replace('$short_summary', this.shortSummary);
        }
        if (this.filename) {
            content = content.replace('$filename', this.filename);
        }
        if (this.fileContent) {
            content = content.replace('$file_content', this.fileContent);
        }
        if (this.fileDiff) {
            content = content.replace('$file_diff', this.fileDiff);
        }
        if (this.patches) {
            content = content.replace('$patches', this.patches);
        }
        if (this.diff) {
            content = content.replace('$diff', this.diff);
        }
        if (this.taskDescription) {
            content = content.replace('$task_description', this.taskDescription);
        }
        if (this.codebaseStructure) {
            content = content.replace('$codebase_structure', this.codebaseStructure);
        }
        if (this.commentChain) {
            content = content.replace('$comment_chain', this.commentChain);
        }
        if (this.comment) {
            content = content.replace('$comment', this.comment);
        }
        if (this.suggestion) {
            content = content.replace('$suggestion', this.suggestion);
        }
        if (this.error) {
            content = content.replace('$error', this.error);
        }
        if (this.remedyContext) {
            content = content.replace('$remedy_context', this.remedyContext);
        }
        if (this.batchContent) {
            content = content.replace('$batch_content', this.batchContent);
        }
        return content;
    }
}
exports.Inputs = Inputs;
//# sourceMappingURL=inputs.js.map