@aws/lsp-codewhisperer 0.0.63 → 0.0.65

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/out/client/token/bearer-token-service.json +1 -1
  3. package/out/language-server/agenticChat/agenticChatController.d.ts +6 -0
  4. package/out/language-server/agenticChat/agenticChatController.js +137 -12
  5. package/out/language-server/agenticChat/agenticChatController.js.map +1 -1
  6. package/out/language-server/agenticChat/context/additionalContextProvider.d.ts +1 -1
  7. package/out/language-server/agenticChat/context/additionalContextProvider.js +8 -3
  8. package/out/language-server/agenticChat/context/additionalContextProvider.js.map +1 -1
  9. package/out/language-server/agenticChat/qAgenticChatServer.js +5 -1
  10. package/out/language-server/agenticChat/qAgenticChatServer.js.map +1 -1
  11. package/out/language-server/agenticChat/tools/executeBash.d.ts +16 -0
  12. package/out/language-server/agenticChat/tools/executeBash.js +95 -3
  13. package/out/language-server/agenticChat/tools/executeBash.js.map +1 -1
  14. package/out/language-server/agenticChat/tools/fsWrite.js +7 -0
  15. package/out/language-server/agenticChat/tools/fsWrite.js.map +1 -1
  16. package/out/language-server/agenticChat/tools/mcp/mcpManager.js +1 -1
  17. package/out/language-server/agenticChat/tools/mcp/mcpManager.js.map +1 -1
  18. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReview.d.ts +211 -0
  19. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReview.js +630 -0
  20. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReview.js.map +1 -0
  21. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewConstants.d.ts +34 -0
  22. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewConstants.js +200 -0
  23. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewConstants.js.map +1 -0
  24. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewErrors.d.ts +12 -0
  25. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewErrors.js +32 -0
  26. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewErrors.js.map +1 -0
  27. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewSchemas.d.ts +289 -0
  28. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewSchemas.js +140 -0
  29. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewSchemas.js.map +1 -0
  30. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewTypes.d.ts +58 -0
  31. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewTypes.js +3 -0
  32. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewTypes.js.map +1 -0
  33. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewUtils.d.ts +156 -0
  34. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewUtils.js +363 -0
  35. package/out/language-server/agenticChat/tools/qCodeAnalysis/qCodeReviewUtils.js.map +1 -0
  36. package/out/language-server/agenticChat/tools/toolServer.d.ts +1 -0
  37. package/out/language-server/agenticChat/tools/toolServer.js +90 -39
  38. package/out/language-server/agenticChat/tools/toolServer.js.map +1 -1
  39. package/out/language-server/chat/telemetry/chatTelemetryController.d.ts +3 -3
  40. package/out/language-server/chat/telemetry/chatTelemetryController.js +13 -3
  41. package/out/language-server/chat/telemetry/chatTelemetryController.js.map +1 -1
  42. package/out/language-server/configuration/qConfigurationServer.d.ts +1 -0
  43. package/out/language-server/configuration/qConfigurationServer.js.map +1 -1
  44. package/out/language-server/inline-completion/codeWhispererServer.js +58 -41
  45. package/out/language-server/inline-completion/codeWhispererServer.js.map +1 -1
  46. package/out/language-server/workspaceContext/artifactManager.d.ts +4 -1
  47. package/out/language-server/workspaceContext/artifactManager.js +16 -1
  48. package/out/language-server/workspaceContext/artifactManager.js.map +1 -1
  49. package/out/language-server/workspaceContext/dependency/dependencyDiscoverer.d.ts +2 -1
  50. package/out/language-server/workspaceContext/dependency/dependencyDiscoverer.js +9 -6
  51. package/out/language-server/workspaceContext/dependency/dependencyDiscoverer.js.map +1 -1
  52. package/out/language-server/workspaceContext/dependency/dependencyHandler/LanguageDependencyHandler.d.ts +7 -2
  53. package/out/language-server/workspaceContext/dependency/dependencyHandler/LanguageDependencyHandler.js +20 -7
  54. package/out/language-server/workspaceContext/dependency/dependencyHandler/LanguageDependencyHandler.js.map +1 -1
  55. package/out/language-server/workspaceContext/dependency/dependencyHandler/LanguageDependencyHandlerFactory.d.ts +2 -2
  56. package/out/language-server/workspaceContext/dependency/dependencyHandler/LanguageDependencyHandlerFactory.js +4 -4
  57. package/out/language-server/workspaceContext/dependency/dependencyHandler/LanguageDependencyHandlerFactory.js.map +1 -1
  58. package/out/language-server/workspaceContext/fileUploadJobManager.js +3 -1
  59. package/out/language-server/workspaceContext/fileUploadJobManager.js.map +1 -1
  60. package/out/language-server/workspaceContext/workspaceContextServer.js +32 -19
  61. package/out/language-server/workspaceContext/workspaceContextServer.js.map +1 -1
  62. package/out/language-server/workspaceContext/workspaceFolderManager.d.ts +5 -3
  63. package/out/language-server/workspaceContext/workspaceFolderManager.js +80 -59
  64. package/out/language-server/workspaceContext/workspaceFolderManager.js.map +1 -1
  65. package/out/shared/amazonQServiceManager/configurationUtils.js +6 -0
  66. package/out/shared/amazonQServiceManager/configurationUtils.js.map +1 -1
  67. package/out/shared/telemetry/telemetryService.d.ts +2 -0
  68. package/out/shared/telemetry/telemetryService.js +4 -1
  69. package/out/shared/telemetry/telemetryService.js.map +1 -1
  70. package/out/shared/telemetry/types.d.ts +2 -0
  71. package/out/shared/telemetry/types.js.map +1 -1
  72. package/out/shared/testUtils.d.ts +9 -0
  73. package/out/shared/testUtils.js +12 -1
  74. package/out/shared/testUtils.js.map +1 -1
  75. package/package.json +2 -2
@@ -0,0 +1,211 @@
1
+ import { Features } from '@aws/language-server-runtimes/server-interface/server';
2
+ import { InvokeOutput } from '../toolShared';
3
+ export declare class QCodeReview {
4
+ private static readonly CUSTOMER_CODE_BASE_PATH;
5
+ private static readonly CODE_ARTIFACT_PATH;
6
+ private static readonly CUSTOMER_CODE_ZIP_NAME;
7
+ private static readonly CODE_DIFF_PATH;
8
+ private static readonly RULE_ARTIFACT_PATH;
9
+ private static readonly MAX_POLLING_ATTEMPTS;
10
+ private static readonly MID_POLLING_ATTEMPTS;
11
+ private static readonly POLLING_INTERVAL_MS;
12
+ private static readonly UPLOAD_INTENT;
13
+ private static readonly SCAN_SCOPE;
14
+ private static readonly MAX_FINDINGS_COUNT;
15
+ private static readonly ERROR_MESSAGES;
16
+ private readonly credentialsProvider;
17
+ private readonly logging;
18
+ private readonly telemetry;
19
+ private readonly workspace;
20
+ private codeWhispererClient?;
21
+ private cancellationToken?;
22
+ private writableStream?;
23
+ constructor(features: Pick<Features, 'credentialsProvider' | 'logging' | 'telemetry' | 'workspace'> & Partial<Features>);
24
+ static readonly toolName = "qCodeReview";
25
+ static readonly toolDescription: string;
26
+ static readonly inputSchema: {
27
+ type: "object";
28
+ description: string;
29
+ properties: {
30
+ scopeOfReview: {
31
+ type: "string";
32
+ description: string;
33
+ enum: string[];
34
+ };
35
+ fileLevelArtifacts: {
36
+ type: "array";
37
+ description: string;
38
+ items: {
39
+ type: "object";
40
+ description: string;
41
+ properties: {
42
+ path: {
43
+ type: "string";
44
+ description: string;
45
+ };
46
+ };
47
+ required: readonly ["path"];
48
+ };
49
+ };
50
+ folderLevelArtifacts: {
51
+ type: "array";
52
+ description: string;
53
+ items: {
54
+ type: "object";
55
+ description: string;
56
+ properties: {
57
+ path: {
58
+ type: "string";
59
+ description: string;
60
+ };
61
+ };
62
+ required: readonly ["path"];
63
+ };
64
+ };
65
+ };
66
+ required: readonly ["scopeOfReview"];
67
+ };
68
+ /**
69
+ * Main execution method for the QCodeReview tool
70
+ * @param input User input parameters for code review
71
+ * @param context Execution context containing clients and tokens
72
+ * @returns Output containing code review results or error message
73
+ */
74
+ execute(input: any, context: any): Promise<InvokeOutput>;
75
+ /**
76
+ * Validates user input and sets up the execution environment
77
+ * @param input User input parameters for code review
78
+ * @param context Execution context containing clients and tokens
79
+ * @returns Setup object with validated parameters or error message
80
+ */
81
+ private validateInputAndSetup;
82
+ /**
83
+ * Prepares and uploads code artifacts for analysis
84
+ * @param setup Setup object with validated parameters
85
+ * @returns Upload result with uploadId or error message
86
+ */
87
+ private prepareAndUploadArtifacts;
88
+ /**
89
+ * Initiates code analysis with the uploaded artifacts
90
+ * @param setup Setup object with validated parameters
91
+ * @param uploadResult Result from artifact upload containing uploadId
92
+ * @returns Code scan jobId and status
93
+ */
94
+ private startCodeAnalysis;
95
+ /**
96
+ * Polls for completion of the code analysis job
97
+ * @param jobId ID of the code analysis job
98
+ * @param scanName Name of the code scan
99
+ * @param artifactType Type of artifact being scanned (FILE or FOLDER)
100
+ * @param chatStreamWriter Stream writer for sending progress updates
101
+ */
102
+ private pollForCompletion;
103
+ /**
104
+ * Processes the results of the completed code analysis
105
+ * @param setup Setup object with validated parameters
106
+ * @param isCodeDiffPresent If code diff is present in upload artifact
107
+ * @param jobId ID of the code analysis job
108
+ * @returns Processed results with findings grouped by file
109
+ */
110
+ private processResults;
111
+ /**
112
+ * Collects findings from the code analysis job
113
+ * @param jobId ID of the code analysis job
114
+ * @param isFullReviewRequest Whether this is a full review or diff review
115
+ * @param isCodeDiffPresent Whether code diff is present in the artifacts
116
+ * @param programmingLanguage Programming language
117
+ * @returns Object containing collected findings and whether limit was exceeded
118
+ */
119
+ private collectFindings;
120
+ /**
121
+ * Gets the current status of a code analysis job
122
+ * @param jobId ID of the code analysis job
123
+ * @returns Status response from the CodeWhisperer service
124
+ */
125
+ private getCodeAnalysisStatus;
126
+ /**
127
+ * Retrieves findings from a code analysis job
128
+ * @param jobId ID of the code analysis job
129
+ * @param nextToken Pagination token for retrieving next batch of findings
130
+ * @returns Findings response from the CodeWhisperer service
131
+ */
132
+ private getCodeAnalysisFindings;
133
+ /**
134
+ * Create a zip archive of the files and folders to be scanned and calculate MD5 hash
135
+ * @param fileArtifacts Array of file artifacts containing path and programming language
136
+ * @param folderArtifacts Array of folder artifacts containing path
137
+ * @param ruleArtifacts Array of file paths to user selected rules
138
+ * @param isFullReviewRequest If user asked for Full review or Partial review
139
+ * @returns An object containing the zip file buffer and its MD5 hash
140
+ */
141
+ private prepareFilesAndFoldersForUpload;
142
+ /**
143
+ * Processes file, folder, and rule artifacts for inclusion in the zip archive
144
+ * @param fileArtifacts Array of file artifacts to process
145
+ * @param folderArtifacts Array of folder artifacts to process
146
+ * @param ruleArtifacts Array of rule artifacts to process
147
+ * @param customerCodeZip JSZip instance for the customer code
148
+ * @param isCodeDiffScan Whether this is a code diff scan
149
+ * @returns Combined code diff string from all artifacts
150
+ */
151
+ private processArtifacts;
152
+ /**
153
+ * Processes file artifacts for inclusion in the zip archive
154
+ * @param fileArtifacts Array of file artifacts to process
155
+ * @param customerCodeZip JSZip instance for the customer code
156
+ * @param isCodeDiffScan Whether this is a code diff scan
157
+ * @returns Combined code diff string from file artifacts
158
+ */
159
+ private processFileArtifacts;
160
+ /**
161
+ * Processes folder artifacts for inclusion in the zip archive
162
+ * @param folderArtifacts Array of folder artifacts to process
163
+ * @param customerCodeZip JSZip instance for the customer code
164
+ * @param isCodeDiffScan Whether this is a code diff scan
165
+ * @returns Combined code diff string from folder artifacts
166
+ */
167
+ private processFolderArtifacts;
168
+ /**
169
+ * Processes rule artifacts for inclusion in the zip archive
170
+ * @param ruleArtifacts Array of rule artifacts to process
171
+ * @param customerCodeZip JSZip instance for the customer code
172
+ */
173
+ private processRuleArtifacts;
174
+ /**
175
+ * Recursively add a folder and its contents to a zip archive
176
+ * @param zip JSZip instance to add files to
177
+ * @param folderPath Path to the folder to add
178
+ * @param zipPath Relative path within the zip archive
179
+ */
180
+ private addFolderToZip;
181
+ /**
182
+ * Parse and validate findings JSON response
183
+ * @param findingsJson Raw JSON string from the code analysis response
184
+ * @param jobId Code scan job Id
185
+ * @param programmingLanguage programming language
186
+ * @returns Parsed and validated findings array
187
+ */
188
+ private parseFindings;
189
+ /**
190
+ * Aggregate findings by file path
191
+ * @param findings Array of findings
192
+ * @param fileArtifacts Array of file artifacts being scanned
193
+ * @param folderArtifacts Array of folder artifacts being scanned
194
+ * @returns Array of findings grouped by resolved file path
195
+ */
196
+ private aggregateFindingsByFile;
197
+ /**
198
+ * Resolve finding file path to actual file path
199
+ * @param findingPath Relative file path from the finding
200
+ * @param fileArtifacts Array of file artifacts being scanned
201
+ * @param folderArtifacts Array of folder artifacts being scanned
202
+ * @returns Resolved absolute file path or null if not found
203
+ */
204
+ private resolveFilePath;
205
+ /**
206
+ * Checks if the operation has been cancelled by the user
207
+ * @param message Optional message to include in the cancellation error
208
+ * @throws Error if the operation has been cancelled
209
+ */
210
+ private checkCancellation;
211
+ }