File tree Expand file tree Collapse file tree 6 files changed +28
-4
lines changed Expand file tree Collapse file tree 6 files changed +28
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"permissions" : {
3
3
"allow" : [
4
- " Bash(npm test)"
4
+ " Bash(npm test)" ,
5
+ " Bash(npm run lint)" ,
6
+ " Bash(npx eslint:*)"
5
7
],
6
8
"deny" : []
7
9
}
8
- }
10
+ }
Original file line number Diff line number Diff line change @@ -21,6 +21,12 @@ function check_version(): void {
21
21
}
22
22
}
23
23
24
+ /**
25
+ * Analyzes a Java file using Aibolit to find the most critical design issue.
26
+ * Runs Aibolit static analyzer and returns the highest priority code quality issue.
27
+ * @param path - The file path to the Java file to analyze
28
+ * @returns A promise that resolves to a formatted message describing the most critical issue
29
+ */
24
30
export const aibolit = async function ( path : string ) : Promise < string > {
25
31
check_version ( ) ;
26
32
if ( ! fs . existsSync ( path ) ) {
Original file line number Diff line number Diff line change 3
3
4
4
import { to_gpt } from './to_gpt' ;
5
5
6
+ /**
7
+ * Safely executes an async function and returns result or formatted error message.
8
+ * Wraps function execution in try-catch to handle errors gracefully.
9
+ * @template T - The return type of the async function
10
+ * @param f - The async function to execute safely
11
+ * @returns A promise that resolves to either the function result or a formatted error string
12
+ */
6
13
export const safe = async function < T > ( f : ( ) => Promise < T > ) : Promise < T | string > {
7
14
try {
8
15
return await f ( ) ;
Original file line number Diff line number Diff line change 3
3
4
4
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js' ;
5
5
6
+ /**
7
+ * MCP server instance for the Aibolit MCP Server.
8
+ * Provides capabilities for tool integration with Aibolit Java code quality analyzer.
9
+ */
6
10
export const server = new McpServer (
7
11
{
8
12
capabilities : {
Original file line number Diff line number Diff line change 1
1
// SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
2
2
// SPDX-License-Identifier: MIT
3
3
4
- // Replace all whitespace with a single space and remove spaces before punctuation
4
+ /**
5
+ * Formats text for GPT consumption by normalizing whitespace and punctuation.
6
+ * Converts multiple spaces to single spaces and removes spaces before punctuation marks.
7
+ * @param txt - The input text to format
8
+ * @returns The formatted text suitable for GPT processing
9
+ */
5
10
export const to_gpt = function ( txt : string ) : string {
6
11
return txt
7
12
. replace ( / \s + / g, ' ' )
Original file line number Diff line number Diff line change @@ -181,4 +181,4 @@ describe('aibolit', () => {
181
181
expect ( result ) . toBe ( 'Your code is perfect' ) ;
182
182
} ) ;
183
183
} ) ;
184
- } ) ;
184
+ } ) ;
You can’t perform that action at this time.
0 commit comments