Skip to content

Commit 579f054

Browse files
committed
#9: more docs
1 parent f5af603 commit 579f054

File tree

6 files changed

+28
-4
lines changed

6 files changed

+28
-4
lines changed

.claude/settings.local.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"permissions": {
33
"allow": [
4-
"Bash(npm test)"
4+
"Bash(npm test)",
5+
"Bash(npm run lint)",
6+
"Bash(npx eslint:*)"
57
],
68
"deny": []
79
}
8-
}
10+
}

src/aibolit.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ function check_version(): void {
2121
}
2222
}
2323

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+
*/
2430
export const aibolit = async function(path: string): Promise<string> {
2531
check_version();
2632
if (!fs.existsSync(path)) {

src/safe.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33

44
import { to_gpt } from './to_gpt';
55

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+
*/
613
export const safe = async function<T>(f: () => Promise<T>): Promise<T | string> {
714
try {
815
return await f();

src/server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
55

6+
/**
7+
* MCP server instance for the Aibolit MCP Server.
8+
* Provides capabilities for tool integration with Aibolit Java code quality analyzer.
9+
*/
610
export const server = new McpServer(
711
{
812
capabilities: {

src/to_gpt.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
// SPDX-FileCopyrightText: Copyright (c) 2025 Yegor Bugayenko
22
// SPDX-License-Identifier: MIT
33

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+
*/
510
export const to_gpt = function(txt: string): string {
611
return txt
712
.replace(/\s+/g, ' ')

test/aibolit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,4 @@ describe('aibolit', () => {
181181
expect(result).toBe('Your code is perfect');
182182
});
183183
});
184-
});
184+
});

0 commit comments

Comments
 (0)