@aws/lsp-codewhisperer 0.0.64 → 0.0.66
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/CHANGELOG.md +57 -0
- package/out/client/token/bearer-token-service.json +1 -1
- package/out/language-server/agenticChat/agenticChatController.d.ts +13 -0
- package/out/language-server/agenticChat/agenticChatController.js +547 -125
- package/out/language-server/agenticChat/agenticChatController.js.map +1 -1
- package/out/language-server/agenticChat/constants/constants.d.ts +12 -0
- package/out/language-server/agenticChat/constants/constants.js +73 -1
- package/out/language-server/agenticChat/constants/constants.js.map +1 -1
- package/out/language-server/agenticChat/constants/toolConstants.d.ts +24 -0
- package/out/language-server/agenticChat/constants/toolConstants.js +35 -0
- package/out/language-server/agenticChat/constants/toolConstants.js.map +1 -0
- package/out/language-server/agenticChat/context/additionalContextProvider.d.ts +1 -1
- package/out/language-server/agenticChat/context/additionalContextProvider.js +44 -4
- package/out/language-server/agenticChat/context/additionalContextProvider.js.map +1 -1
- package/out/language-server/agenticChat/context/agenticChatTriggerContext.d.ts +11 -2
- package/out/language-server/agenticChat/context/agenticChatTriggerContext.js +32 -2
- package/out/language-server/agenticChat/context/agenticChatTriggerContext.js.map +1 -1
- package/out/language-server/agenticChat/context/contextCommandsProvider.js +1 -1
- package/out/language-server/agenticChat/context/contextCommandsProvider.js.map +1 -1
- package/out/language-server/agenticChat/context/contextUtils.d.ts +16 -0
- package/out/language-server/agenticChat/context/contextUtils.js +29 -0
- package/out/language-server/agenticChat/context/contextUtils.js.map +1 -1
- package/out/language-server/agenticChat/qAgenticChatServer.js +6 -2
- package/out/language-server/agenticChat/qAgenticChatServer.js.map +1 -1
- package/out/language-server/agenticChat/tools/chatDb/chatDb.d.ts +11 -3
- package/out/language-server/agenticChat/tools/chatDb/chatDb.js +103 -31
- package/out/language-server/agenticChat/tools/chatDb/chatDb.js.map +1 -1
- package/out/language-server/agenticChat/tools/chatDb/util.d.ts +4 -0
- package/out/language-server/agenticChat/tools/chatDb/util.js.map +1 -1
- package/out/language-server/agenticChat/tools/executeBash.d.ts +15 -5
- package/out/language-server/agenticChat/tools/executeBash.js +97 -22
- package/out/language-server/agenticChat/tools/executeBash.js.map +1 -1
- package/out/language-server/agenticChat/tools/mcp/mcpManager.js +1 -1
- package/out/language-server/agenticChat/tools/mcp/mcpManager.js.map +1 -1
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReview.d.ts +211 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReview.js +630 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReview.js.map +1 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewConstants.d.ts +34 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewConstants.js +200 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewConstants.js.map +1 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewErrors.d.ts +12 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewErrors.js +32 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewErrors.js.map +1 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewSchemas.d.ts +289 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewSchemas.js +140 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewSchemas.js.map +1 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewTypes.d.ts +58 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewTypes.js +3 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewTypes.js.map +1 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewUtils.d.ts +156 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewUtils.js +363 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewUtils.js.map +1 -0
- package/out/language-server/agenticChat/tools/toolServer.d.ts +1 -0
- package/out/language-server/agenticChat/tools/toolServer.js +90 -39
- package/out/language-server/agenticChat/tools/toolServer.js.map +1 -1
- package/out/language-server/chat/chatSessionService.d.ts +1 -0
- package/out/language-server/chat/chatSessionService.js +5 -2
- package/out/language-server/chat/chatSessionService.js.map +1 -1
- package/out/language-server/chat/quickActions.d.ts +7 -1
- package/out/language-server/chat/quickActions.js +7 -1
- package/out/language-server/chat/quickActions.js.map +1 -1
- package/out/language-server/chat/telemetry/chatTelemetryController.d.ts +4 -3
- package/out/language-server/chat/telemetry/chatTelemetryController.js +22 -3
- package/out/language-server/chat/telemetry/chatTelemetryController.js.map +1 -1
- package/out/language-server/configuration/qConfigurationServer.d.ts +1 -0
- package/out/language-server/configuration/qConfigurationServer.js.map +1 -1
- package/out/language-server/inline-completion/auto-trigger/autoTrigger.d.ts +2 -0
- package/out/language-server/inline-completion/auto-trigger/autoTrigger.js +69 -1
- package/out/language-server/inline-completion/auto-trigger/autoTrigger.js.map +1 -1
- package/out/language-server/inline-completion/auto-trigger/editPredictionAutoTrigger.js +6 -1
- package/out/language-server/inline-completion/auto-trigger/editPredictionAutoTrigger.js.map +1 -1
- package/out/language-server/inline-completion/auto-trigger/editPredictionConfig.d.ts +1 -0
- package/out/language-server/inline-completion/auto-trigger/editPredictionConfig.js +1 -0
- package/out/language-server/inline-completion/auto-trigger/editPredictionConfig.js.map +1 -1
- package/out/language-server/inline-completion/codeWhispererServer.js +72 -43
- package/out/language-server/inline-completion/codeWhispererServer.js.map +1 -1
- package/out/language-server/workspaceContext/artifactManager.d.ts +4 -1
- package/out/language-server/workspaceContext/artifactManager.js +16 -1
- package/out/language-server/workspaceContext/artifactManager.js.map +1 -1
- package/out/language-server/workspaceContext/dependency/dependencyDiscoverer.d.ts +2 -1
- package/out/language-server/workspaceContext/dependency/dependencyDiscoverer.js +9 -6
- package/out/language-server/workspaceContext/dependency/dependencyDiscoverer.js.map +1 -1
- package/out/language-server/workspaceContext/dependency/dependencyHandler/LanguageDependencyHandler.d.ts +7 -2
- package/out/language-server/workspaceContext/dependency/dependencyHandler/LanguageDependencyHandler.js +20 -7
- package/out/language-server/workspaceContext/dependency/dependencyHandler/LanguageDependencyHandler.js.map +1 -1
- package/out/language-server/workspaceContext/dependency/dependencyHandler/LanguageDependencyHandlerFactory.d.ts +2 -2
- package/out/language-server/workspaceContext/dependency/dependencyHandler/LanguageDependencyHandlerFactory.js +4 -4
- package/out/language-server/workspaceContext/dependency/dependencyHandler/LanguageDependencyHandlerFactory.js.map +1 -1
- package/out/language-server/workspaceContext/fileUploadJobManager.js +3 -1
- package/out/language-server/workspaceContext/fileUploadJobManager.js.map +1 -1
- package/out/language-server/workspaceContext/workspaceContextServer.js +32 -19
- package/out/language-server/workspaceContext/workspaceContextServer.js.map +1 -1
- package/out/language-server/workspaceContext/workspaceFolderManager.d.ts +5 -3
- package/out/language-server/workspaceContext/workspaceFolderManager.js +80 -59
- package/out/language-server/workspaceContext/workspaceFolderManager.js.map +1 -1
- package/out/shared/activeUserTracker.d.ts +52 -0
- package/out/shared/activeUserTracker.js +164 -0
- package/out/shared/activeUserTracker.js.map +1 -0
- package/out/shared/amazonQServiceManager/configurationUtils.js +6 -0
- package/out/shared/amazonQServiceManager/configurationUtils.js.map +1 -1
- package/out/shared/codeWhispererService.js +3 -1
- package/out/shared/codeWhispererService.js.map +1 -1
- package/out/shared/telemetry/telemetryService.d.ts +2 -0
- package/out/shared/telemetry/telemetryService.js +2 -0
- package/out/shared/telemetry/telemetryService.js.map +1 -1
- package/out/shared/telemetry/types.d.ts +9 -1
- package/out/shared/telemetry/types.js +1 -0
- package/out/shared/telemetry/types.js.map +1 -1
- package/package.json +8 -6
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Q_FINDINGS_SCHEMA = exports.Q_FINDING_SCHEMA = exports.Z_Q_CODE_REVIEW_INPUT_SCHEMA = exports.Q_CODE_REVIEW_INPUT_SCHEMA = void 0;
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
const qCodeReviewConstants_1 = require("./qCodeReviewConstants");
|
|
10
|
+
/**
|
|
11
|
+
* Input schema for QCodeReview tool
|
|
12
|
+
*/
|
|
13
|
+
exports.Q_CODE_REVIEW_INPUT_SCHEMA = {
|
|
14
|
+
type: 'object',
|
|
15
|
+
description: [
|
|
16
|
+
'**3 main fields in the tool:**',
|
|
17
|
+
'- scopeOfReview: CRITICAL - Must be set to either FULL_REVIEW (analyze entire codebase) or CODE_DIFF_REVIEW (focus only on changes/modifications). This is a required field.',
|
|
18
|
+
'- fileLevelArtifacts: Array of specific files to review, each with absolute path. Use this when reviewing individual files, not folders. Format: [{"path": "/absolute/path/to/file.py"}]',
|
|
19
|
+
'- folderLevelArtifacts: Array of folders to review, each with absolute path. Use this when reviewing entire directories, not individual files. Format: [{"path": "/absolute/path/to/folder/"}]',
|
|
20
|
+
"Note: Either fileLevelArtifacts OR folderLevelArtifacts should be provided based on what's being reviewed, but not both for the same items.",
|
|
21
|
+
].join('\n'),
|
|
22
|
+
properties: {
|
|
23
|
+
scopeOfReview: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
description: [
|
|
26
|
+
'CRITICAL: You must explicitly set the value of "scopeOfReview" based on user request analysis.',
|
|
27
|
+
'',
|
|
28
|
+
'Set "scopeOfReview" to CODE_DIFF_REVIEW when:',
|
|
29
|
+
'- User explicitly asks to review only changes/modifications/diffs in their code',
|
|
30
|
+
'- User mentions "review my changes", "look at what I modified", "check the uncommitted changes"',
|
|
31
|
+
'- User refers to "review the diff", "analyze recent changes", "look at the new code"',
|
|
32
|
+
'- User mentions "review what I added/updated", "check my latest commits", "review the modified lines"',
|
|
33
|
+
'- User includes phrases like "new changes", "recent changes", or any combination of words indicating recency (new, latest, recent) with changes/modifications',
|
|
34
|
+
'- User mentions specific files with terms like "review new changes in [file]" or "check changes in [file]"',
|
|
35
|
+
'',
|
|
36
|
+
'Set "scopeOfReview" to FULL_REVIEW for all other cases, including:',
|
|
37
|
+
'- When user asks for a general code review without mentioning changes/diffs',
|
|
38
|
+
'- When user asks to review specific files or folders without mentioning changes',
|
|
39
|
+
'- When user asks for security analysis or best practices review of their code',
|
|
40
|
+
'',
|
|
41
|
+
'This is a required field. You must inform the user whether you are performing a full review or only reviewing changes.',
|
|
42
|
+
].join('\n'),
|
|
43
|
+
enum: qCodeReviewConstants_1.SCOPE_OF_CODE_REVIEW,
|
|
44
|
+
},
|
|
45
|
+
fileLevelArtifacts: {
|
|
46
|
+
type: 'array',
|
|
47
|
+
description: [
|
|
48
|
+
'Array of absolute file paths that will be reviewed (e.g. [{"path": "absolute/path/to/file.py"}]).',
|
|
49
|
+
'So, if the user asks for a code review of a single file, provide the absolute file path in the array.',
|
|
50
|
+
'If the user asks for a code review of multiple files, provide the absolute file paths in the array.',
|
|
51
|
+
'If the user asks for a code review of a folder, do not provide any file paths or programming languages in this array. It should be provided in folderLevelArtifacts',
|
|
52
|
+
].join('\n'),
|
|
53
|
+
items: {
|
|
54
|
+
type: 'object',
|
|
55
|
+
description: 'Array item containing absolute path of artifact (e.g. {"path": "absolute/path/to/file.py"})',
|
|
56
|
+
properties: {
|
|
57
|
+
path: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'The absolute path of the file that will be scanned',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
required: ['path'],
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
folderLevelArtifacts: {
|
|
66
|
+
type: 'array',
|
|
67
|
+
description: [
|
|
68
|
+
'Array of absolute folder paths that will be reviewed (e.g. [{"path": "path/to/code/"}]).',
|
|
69
|
+
'So, if the user asks for a code review of a single folder, provide the absolute folder path in the array.',
|
|
70
|
+
'If the user asks for a code review of multiple folders, provide multiple absolute folder paths in the array.',
|
|
71
|
+
'If the user asks for a code review of a file or multiple files, do not provide any folder paths in this array. It should be provided in fileLevelArtifacts.',
|
|
72
|
+
].join('\n'),
|
|
73
|
+
items: {
|
|
74
|
+
type: 'object',
|
|
75
|
+
description: 'Array item containing absolute folder path of code that will be scanned (e.g. {"path": "path/to/code/"})',
|
|
76
|
+
properties: {
|
|
77
|
+
path: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
description: 'The absolute path of the folder that will be scanned',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
required: ['path'],
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
required: ['scopeOfReview'],
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Zod schema for input validation during execution of Q Code Review tool
|
|
90
|
+
*/
|
|
91
|
+
exports.Z_Q_CODE_REVIEW_INPUT_SCHEMA = zod_1.z.object({
|
|
92
|
+
scopeOfReview: zod_1.z.enum(qCodeReviewConstants_1.SCOPE_OF_CODE_REVIEW),
|
|
93
|
+
fileLevelArtifacts: zod_1.z
|
|
94
|
+
.array(zod_1.z.object({
|
|
95
|
+
path: zod_1.z.string(),
|
|
96
|
+
}))
|
|
97
|
+
.optional(),
|
|
98
|
+
folderLevelArtifacts: zod_1.z
|
|
99
|
+
.array(zod_1.z.object({
|
|
100
|
+
path: zod_1.z.string(),
|
|
101
|
+
}))
|
|
102
|
+
.optional(),
|
|
103
|
+
ruleArtifacts: zod_1.z
|
|
104
|
+
.array(zod_1.z.object({
|
|
105
|
+
path: zod_1.z.string(),
|
|
106
|
+
}))
|
|
107
|
+
.optional(),
|
|
108
|
+
});
|
|
109
|
+
/**
|
|
110
|
+
* Schema for a single finding
|
|
111
|
+
*/
|
|
112
|
+
exports.Q_FINDING_SCHEMA = zod_1.z.object({
|
|
113
|
+
description: zod_1.z.object({
|
|
114
|
+
markdown: zod_1.z.string(),
|
|
115
|
+
text: zod_1.z.string(),
|
|
116
|
+
}),
|
|
117
|
+
endLine: zod_1.z.number(),
|
|
118
|
+
filePath: zod_1.z.string(),
|
|
119
|
+
findingId: zod_1.z.string(),
|
|
120
|
+
relatedVulnerabilities: zod_1.z.array(zod_1.z.string().optional()),
|
|
121
|
+
remediation: zod_1.z.object({
|
|
122
|
+
recommendation: zod_1.z.object({
|
|
123
|
+
text: zod_1.z.string(),
|
|
124
|
+
url: zod_1.z.string().nullable().optional(),
|
|
125
|
+
}),
|
|
126
|
+
}),
|
|
127
|
+
severity: zod_1.z.enum(qCodeReviewConstants_1.FINDING_SEVERITY),
|
|
128
|
+
startLine: zod_1.z.number(),
|
|
129
|
+
title: zod_1.z.string(),
|
|
130
|
+
findingContext: zod_1.z.string().nullable().optional(),
|
|
131
|
+
detectorId: zod_1.z.string().optional(),
|
|
132
|
+
detectorName: zod_1.z.string().optional(),
|
|
133
|
+
ruleId: zod_1.z.string().optional(),
|
|
134
|
+
suggestedFixes: zod_1.z.array(zod_1.z.string().optional()).optional(),
|
|
135
|
+
});
|
|
136
|
+
/**
|
|
137
|
+
* Schema for an array of findings
|
|
138
|
+
*/
|
|
139
|
+
exports.Q_FINDINGS_SCHEMA = zod_1.z.array(exports.Q_FINDING_SCHEMA);
|
|
140
|
+
//# sourceMappingURL=qCodeReviewSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qCodeReviewSchemas.js","sourceRoot":"","sources":["../../../../../src/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewSchemas.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6BAAuB;AACvB,iEAA+E;AAE/E;;GAEG;AACU,QAAA,0BAA0B,GAAG;IACtC,IAAI,EAAS,QAAQ;IACrB,WAAW,EAAE;QACT,gCAAgC;QAChC,8KAA8K;QAC9K,0LAA0L;QAC1L,gMAAgM;QAChM,6IAA6I;KAChJ,CAAC,IAAI,CAAC,IAA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AAC,IAAI,CAAC,uCAAyC,CAAC;IAC3D,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE;IACrB,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAChD,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,cAAc,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC5D,CAAC,CAAA;AAEF;;GAEG;AACU,QAAA,iBAAiB,GAAG,OAAC,CAAC,KAAK,CAAC,wBAAgB,CAAC,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type FileArtifacts = Array<{
|
|
2
|
+
path: string;
|
|
3
|
+
}>;
|
|
4
|
+
export type FolderArtifacts = Array<{
|
|
5
|
+
path: string;
|
|
6
|
+
}>;
|
|
7
|
+
export type RuleArtifacts = Array<{
|
|
8
|
+
path: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type ArtifactType = 'FILE' | 'FOLDER';
|
|
11
|
+
export type ValidateInputAndSetupResult = {
|
|
12
|
+
fileArtifacts: FileArtifacts;
|
|
13
|
+
folderArtifacts: FolderArtifacts;
|
|
14
|
+
isFullReviewRequest: boolean;
|
|
15
|
+
artifactType: ArtifactType;
|
|
16
|
+
programmingLanguage: string;
|
|
17
|
+
scanName: string;
|
|
18
|
+
ruleArtifacts: RuleArtifacts;
|
|
19
|
+
};
|
|
20
|
+
export type PrepareAndUploadArtifactsResult = {
|
|
21
|
+
uploadId: string;
|
|
22
|
+
isCodeDiffPresent: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type StartCodeAnalysisResult = {
|
|
25
|
+
jobId: string;
|
|
26
|
+
status: string;
|
|
27
|
+
};
|
|
28
|
+
export type CodeReviewResult = {
|
|
29
|
+
codeReviewId: string;
|
|
30
|
+
message: string;
|
|
31
|
+
findingsByFile: string;
|
|
32
|
+
};
|
|
33
|
+
export type QCodeReviewFinding = {
|
|
34
|
+
filePath: string;
|
|
35
|
+
startLine: number;
|
|
36
|
+
endLine: number;
|
|
37
|
+
comment: string;
|
|
38
|
+
title: string;
|
|
39
|
+
description: {
|
|
40
|
+
markdown: string;
|
|
41
|
+
text: string;
|
|
42
|
+
};
|
|
43
|
+
detectorId?: string;
|
|
44
|
+
detectorName?: string;
|
|
45
|
+
findingId: string;
|
|
46
|
+
ruleId?: string;
|
|
47
|
+
relatedVulnerabilities: (string | undefined)[];
|
|
48
|
+
severity: string;
|
|
49
|
+
suggestedFixes?: (string | undefined)[];
|
|
50
|
+
recommendation: {
|
|
51
|
+
text: string;
|
|
52
|
+
url?: string | null;
|
|
53
|
+
};
|
|
54
|
+
scanJobId: string;
|
|
55
|
+
language: string;
|
|
56
|
+
autoDetected: false;
|
|
57
|
+
findingContext: string | null | undefined;
|
|
58
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qCodeReviewTypes.js","sourceRoot":"","sources":["../../../../../src/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { Features } from '@aws/language-server-runtimes/server-interface/server';
|
|
6
|
+
import JSZip = require('jszip');
|
|
7
|
+
import { InitializeParams } from '@aws/language-server-runtimes/server-interface';
|
|
8
|
+
import { InvokeOutput } from '../toolShared';
|
|
9
|
+
import { CancellationToken } from '@aws/language-server-runtimes/server-interface';
|
|
10
|
+
/**
|
|
11
|
+
* Utility functions for QCodeReview
|
|
12
|
+
*/
|
|
13
|
+
export declare class QCodeReviewUtils {
|
|
14
|
+
/**
|
|
15
|
+
* Check if a file should be skipped during zip creation
|
|
16
|
+
* @param fileName Name of the file to check
|
|
17
|
+
* @returns True if the file should be skipped, false otherwise
|
|
18
|
+
*/
|
|
19
|
+
static shouldSkipFile(fileName: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Check if a directory should be skipped during zip creation
|
|
22
|
+
* @param dirName Name of the directory to check
|
|
23
|
+
* @returns True if the directory should be skipped, false otherwise
|
|
24
|
+
*/
|
|
25
|
+
static shouldSkipDirectory(dirName: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Get the folder path from a file or folder path
|
|
28
|
+
* @param inputPath Path to a file or folder
|
|
29
|
+
* @returns The folder path
|
|
30
|
+
*/
|
|
31
|
+
static getFolderPath(inputPath: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Log a summary of the zip archive contents
|
|
34
|
+
* @param zip JSZip instance to analyze
|
|
35
|
+
* @param logging Logging interface
|
|
36
|
+
*/
|
|
37
|
+
static logZipSummary(zip: JSZip, logging: Features['logging']): void;
|
|
38
|
+
/**
|
|
39
|
+
* Generate a unique client token for the request
|
|
40
|
+
* @returns A unique string token
|
|
41
|
+
*/
|
|
42
|
+
static generateClientToken(): string;
|
|
43
|
+
/**
|
|
44
|
+
* Execute git command and return output
|
|
45
|
+
* @param command Git command to execute
|
|
46
|
+
* @param type Type of command for logging
|
|
47
|
+
* @param logging Logging interface
|
|
48
|
+
* @returns Promise resolving to command output
|
|
49
|
+
*/
|
|
50
|
+
static executeGitCommand(command: string, type: string, logging: Features['logging']): Promise<string>;
|
|
51
|
+
/**
|
|
52
|
+
* Get git diff for a file or folder
|
|
53
|
+
* @param artifactPath Path to the file or folder
|
|
54
|
+
* @param logging Logging interface
|
|
55
|
+
* @returns Git diff output as string or null if not in a git repository
|
|
56
|
+
*/
|
|
57
|
+
static getGitDiff(artifactPath: string, logging: Features['logging']): Promise<string | null>;
|
|
58
|
+
/**
|
|
59
|
+
* Log zip structure
|
|
60
|
+
* @param zip JSZip instance
|
|
61
|
+
* @param zipName Name of the zip for logging
|
|
62
|
+
* @param logging Logging interface
|
|
63
|
+
*/
|
|
64
|
+
static logZipStructure(zip: JSZip, zipName: string, logging: Features['logging']): void;
|
|
65
|
+
/**
|
|
66
|
+
* Count number of files in zip
|
|
67
|
+
* @param zip JSZip instance
|
|
68
|
+
* @returns number of files in zip
|
|
69
|
+
*/
|
|
70
|
+
static countZipFiles(zip: JSZip): number;
|
|
71
|
+
/**
|
|
72
|
+
* Generate zip buffer with compression
|
|
73
|
+
* @param zip JSZip instance
|
|
74
|
+
* @returns Promise resolving to compressed buffer
|
|
75
|
+
*/
|
|
76
|
+
static generateZipBuffer(zip: JSZip): Promise<Buffer>;
|
|
77
|
+
/**
|
|
78
|
+
* Save zip buffer to Downloads folder
|
|
79
|
+
* @param zipBuffer Buffer to save
|
|
80
|
+
* @param logging Logging interface
|
|
81
|
+
*/
|
|
82
|
+
static saveZipToDownloads(zipBuffer: Buffer, logging: Features['logging']): void;
|
|
83
|
+
/**
|
|
84
|
+
* Process artifact with git diff
|
|
85
|
+
* @param artifact Artifact with path
|
|
86
|
+
* @param isCodeDiffScan Whether to scan for code diff
|
|
87
|
+
* @param logging Logging interface
|
|
88
|
+
* @returns Promise resolving to diff string
|
|
89
|
+
*/
|
|
90
|
+
static processArtifactWithDiff(artifact: {
|
|
91
|
+
path: string;
|
|
92
|
+
}, isCodeDiffScan: boolean, logging: Features['logging']): Promise<string>;
|
|
93
|
+
/**
|
|
94
|
+
* Error handling wrapper
|
|
95
|
+
* @param operation Operation to execute
|
|
96
|
+
* @param errorMessage Error message prefix
|
|
97
|
+
* @param logging Logging interface
|
|
98
|
+
* @param path Optional path for error context
|
|
99
|
+
* @returns Promise resolving to operation result
|
|
100
|
+
*/
|
|
101
|
+
static withErrorHandling<T>(operation: () => Promise<T>, errorMessage: string, logging: Features['logging'], path?: string): Promise<T>;
|
|
102
|
+
/**
|
|
103
|
+
* Check if agentic review capability is enabled in client capabilities
|
|
104
|
+
* @param params Initialize parameters from client
|
|
105
|
+
* @returns True if agentic reviewer is enabled, false otherwise
|
|
106
|
+
*/
|
|
107
|
+
static isAgenticReviewEnabled(params: InitializeParams | undefined): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Converts a Windows absolute file path to Unix format and removes the drive letter
|
|
110
|
+
* @param windowsPath The Windows path to convert
|
|
111
|
+
* @returns The Unix formatted path without drive letter
|
|
112
|
+
*/
|
|
113
|
+
static convertToUnixPath(windowsPath: string): string;
|
|
114
|
+
/**
|
|
115
|
+
* Create a standardized error output object
|
|
116
|
+
* @param errorObj Error object or message
|
|
117
|
+
* @returns Formatted InvokeOutput with error details
|
|
118
|
+
*/
|
|
119
|
+
static createErrorOutput(errorObj: any): InvokeOutput;
|
|
120
|
+
/**
|
|
121
|
+
* Upload file content to the pre-signed URL
|
|
122
|
+
* @param uploadUrl Pre-signed URL for uploading the file
|
|
123
|
+
* @param fileContent Buffer containing the file content
|
|
124
|
+
* @param requestHeaders Additional headers for the request
|
|
125
|
+
* @param logging Logging interface
|
|
126
|
+
*/
|
|
127
|
+
static uploadFileToPresignedUrl(uploadUrl: string, fileContent: Buffer, requestHeaders: Record<string, string>, logging: Features['logging']): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Handle failure in a consistent way
|
|
130
|
+
* @param error Error object
|
|
131
|
+
* @param scanName Optional scan name for context
|
|
132
|
+
* @param jobId Optional job ID for context
|
|
133
|
+
* @param logging Logging interface
|
|
134
|
+
* @param telemetry Telemetry interface
|
|
135
|
+
* @param toolName Tool name for error messages
|
|
136
|
+
* @returns Standardized error response
|
|
137
|
+
*/
|
|
138
|
+
static handleFailure(error: any, logging: Features['logging'], telemetry: Features['telemetry'], toolName: string, scanName?: string, jobId?: string): any;
|
|
139
|
+
/**
|
|
140
|
+
* Emit a telemetry metric with standard formatting
|
|
141
|
+
* @param metricSuffix Suffix for the metric name
|
|
142
|
+
* @param metricData Additional metric data
|
|
143
|
+
* @param toolName Tool name for the metric prefix
|
|
144
|
+
* @param logging Logging interface
|
|
145
|
+
* @param telemetry Telemetry interface
|
|
146
|
+
* @param credentialStartUrl Optional credential start URL
|
|
147
|
+
*/
|
|
148
|
+
static emitMetric(metricSuffix: string, metricData: any, toolName: string, logging: Features['logging'], telemetry: Features['telemetry'], credentialStartUrl?: string): void;
|
|
149
|
+
/**
|
|
150
|
+
* Check if cancellation has been requested and throw if it has
|
|
151
|
+
* @param cancellationToken Cancellation token to check
|
|
152
|
+
* @param message Optional message for the error
|
|
153
|
+
* @param logging Logging interface
|
|
154
|
+
*/
|
|
155
|
+
static checkCancellation(cancellationToken: CancellationToken | undefined, logging: Features['logging'], message?: string): void;
|
|
156
|
+
}
|