Skip to content

Commit 1cc9f3d

Browse files
Merge pull request #8 from preeesha/fix--documentation
Enhanced Documentation Across Components and Commands
2 parents 93572df + a88f059 commit 1cc9f3d

35 files changed

+694
-85
lines changed

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ Rocket Chatter App is an open-source AI-powered assistant designed to help devel
1818

1919
- **Assess Code Importance**: The app can evaluate the criticality and centrality of code entities, providing insights into their impact and dependencies, which is crucial for tasks like refactoring or introducing new features. The app will generate scores for criticality (how many other parts of the code depend on this entity), centrality (how connected this entity is to other parts), and overall importance, helping developers prioritize their efforts.
2020

21-
- **Enforce Style Guides**: The app can automatically check the codebase against predefined style guides and coding standards, ensuring code quality, consistency, and readability across the project. Developers can provide code snippets, and the app will suggest improvements based on the project's style guide, promoting best practices and maintainability.
22-
2321
- **Suggest Improvements**: The app can analyze code snippets and offer targeted refactoring suggestions, such as renaming variables, extracting code into reusable functions, removing dead code, and optimizing performance. These suggestions will help developers write cleaner, more efficient, and maintainable code while adhering to the project's coding standards.
2422

2523
### Accessibility and Collaboration
@@ -49,21 +47,19 @@ Rocket Chatter App is an open-source AI-powered assistant designed to help devel
4947

5048
### Usage
5149

52-
Once the application is running, you can access the Rocket Chatter App through the Rocket.Chat interface. The app provides various slash commands (e.g., `/rcc-ask`, `/rcc-diagram`, `/rcc-document`) that you can use to interact with the assistant.
50+
Once the application is running, you can access the Rocket Chatter App through the Rocket.Chat interface. The app provides various slash commands (e.g., `/rcc-askcode`, `/rcc-diagram`, `/rcc-document`) that you can use to interact with the assistant.
5351

5452
## Architecture
5553

5654
The Rocket Chatter App follows a modular architecture with the following main components:
5755

5856
1. **Rocket Chat Application**: A user-friendly interface for developers to interact with the system, enabling them to ask questions, request diagrams, and access documentation directly within the Rocket.Chat environment. The application is built using the Rocket.Chat App Engine SDK and is deployed as a Rocket.Chat App. ![Rocket Chatter App](./docs/images/architecture-rc-app.png)
5957
2. **Ingestion Server**: Responsible for parsing the Rocket.Chat codebase, extracting relevant information, and storing it in the Neo4j graph database. It utilizes compiler APIs like `ts-morph` and `jscodeshift` to handle TypeScript and JavaScript code constructs. The ingestion process involves chunking the codebase, generating embeddings for code entities, and establishing relationships between them in the graph database. ![Rocket Chatter App](./docs/images/architecture-ingestion-server.png)
60-
3. **Application Server**: A middleware component built with Express.js that serves as a bridge between the database and the client application. It handles requests from the Rocket Chat App, queries the Neo4j database using cosine similarity-based searches, and generates responses using Language Models (LMs). The server employs a Retrieval Augmented Generation (RAG) pipeline to provide contextual and accurate information to developers. ![Rocket Chatter App](./docs/images/architecture-application-server.png)
61-
6258

6359
### Development Environment Setup
6460

65-
1. Fork the repository and clone your fork: `git clone https://github.com/your-username/rocket-chatter-app.git`
66-
2. Navigate to the project directory: `cd rocket-chatter-app`
67-
3. Install dependencies: `npm install`
61+
1. Fork the repository and clone your fork: `git clone https://github.com/your-username/Apps.AI.Codebase.Assistant.git`
62+
2. Navigate to the project directory: `cd Apps.AI.Codebase.Assistant`
63+
3. Install dependencies: `bun install`
6864
4. Set up the required environment variables (e.g., database credentials, API keys) by creating a `.env` file based on the provided `.env.example` file.
6965
5. Start the development server: `npm run dev`

ai-assistant/README.md

Lines changed: 98 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,99 @@
11
# AI Assistant
2-
AI Assistant
3-
4-
## Getting Started
5-
Now that you have generated a blank default Rocket.Chat App, what are you supposed to do next?
6-
Start developing! Open up your favorite editor, our recommended one is Visual Studio code,
7-
and start working on your App. Once you have something ready to test, you can either
8-
package it up and manually deploy it to your test instance or you can use the CLI to do so.
9-
Here are some commands to get started:
10-
- `rc-apps package`: this command will generate a packaged app file (zip) which can be installed **if** it compiles with TypeScript
11-
- `rc-apps deploy`: this will do what `package` does but will then ask you for your server url, username, and password to deploy it for you
12-
13-
## Documentation
14-
Here are some links to examples and documentation:
15-
- [Rocket.Chat Apps TypeScript Definitions Documentation](https://rocketchat.github.io/Rocket.Chat.Apps-engine/)
16-
- [Rocket.Chat Apps TypeScript Definitions Repository](https://github.com/RocketChat/Rocket.Chat.Apps-engine)
17-
- [Example Rocket.Chat Apps](https://github.com/graywolf336/RocketChatApps)
18-
- Community Forums
19-
- [App Requests](https://forums.rocket.chat/c/rocket-chat-apps/requests)
20-
- [App Guides](https://forums.rocket.chat/c/rocket-chat-apps/guides)
21-
- [Top View of Both Categories](https://forums.rocket.chat/c/rocket-chat-apps)
22-
- [#rocketchat-apps on Open.Rocket.Chat](https://open.rocket.chat/channel/rocketchat-apps)
2+
3+
Rocket Chatter is a Rocket.Chat bot that provides code-related information and assistance to developers working on the Rocket Chat project. The bot is designed to help developers understand the Rocket Chat codebase, find relevant documentation, and improve their coding practices. Rocket Chatter uses the Rocket Chat API to access the codebase and provide context-specific information and suggestions to users.
4+
5+
## Commands
6+
7+
### `/rcc-help`
8+
9+
Provides descriptions and usage instructions for all available Rocket Chatter commands.
10+
11+
```
12+
/rcc-help
13+
```
14+
15+
### `/rcc-askcode`
16+
17+
Allows users to ask specific code-related questions about the Rocket Chat's codebase and receive context-specific answers.
18+
19+
```
20+
/rcc-askcode [your query]
21+
```
22+
23+
### `/rcc-askdocs`
24+
25+
Accesses and provides developer documentation related to the Rocket Chat project, including setup guides, API references, and contribution guidelines.
26+
27+
```
28+
/rcc-askdocs [your query]
29+
```
30+
31+
### `/rcc-diagram`
32+
33+
Generates clarifying diagrams to visually represent the relationships and structures between an entity and it's dependencies within the Rocket Chat codebase.
34+
35+
```
36+
/rcc-diagram [entity]
37+
```
38+
39+
### `/rcc-document`
40+
41+
Generates the documentation for a specific entity within the Rocket Chat codebase.
42+
43+
```
44+
/rcc-document [entity]
45+
```
46+
47+
### `/rcc-findsimilar`
48+
49+
Finds similar entities to the one provided within the Rocket Chat codebase to reduce redundancy and improve code quality.
50+
51+
```
52+
/rcc-findsimilar
53+
```
54+
55+
(A modal will open to input the code snippet you want to find similar entities to)
56+
57+
### `/rcc-improve`
58+
59+
Offers suggestions for code improvements, refactoring, or enhancements based on best practices and project standards.
60+
61+
```
62+
/rcc-improve
63+
```
64+
65+
(A modal will open to input the code snippet you want to suggest improvements for)
66+
67+
### `/rcc-importance`
68+
69+
Determines and explains the importance of a specific code entity within the larger context of the Rocket Chat codebase.
70+
71+
```
72+
/rcc-importance [entity]
73+
```
74+
75+
### `/rcc-testcases`
76+
77+
Generates test cases for the provided code which uses Rocket Chat codebase to ensure proper functionality and test coverage.
78+
79+
```
80+
/rcc-testcases
81+
```
82+
83+
(A modal will open to input the code snippet you want to generate testcases for)
84+
85+
### `/rcc-translate`
86+
87+
Translates the target entity from one programming language to another for a better understanding of the codebase.
88+
89+
```
90+
/rcc-translate [entity] [target language]
91+
```
92+
93+
### `/rcc-whyused`
94+
95+
Explains why a specific entity is used within the Rocket Chat codebase.
96+
97+
```
98+
/rcc-whyused [entity]
99+
```

ai-assistant/src/commands/AskCodeCommand.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ export class AskCodeCommand implements ISlashCommand {
2121
public i18nDescription = "";
2222
public providesPreview = false;
2323

24+
/**
25+
* Processes the user's query and returns the answer.
26+
*
27+
* @param {IHttp} http - The HTTP object used for making requests.
28+
* @param {string} query - The user's query.
29+
* @returns {Promise<string | null>} A promise that resolves to the response to be given to the user or `null` if no answer or no reference is found.
30+
*/
2431
private async process(http: IHttp, query: string): Promise<string | null> {
2532
const db = new Neo4j(http);
2633
const llm = new Llama3_70B(http);
@@ -65,6 +72,15 @@ export class AskCodeCommand implements ISlashCommand {
6572
return answer;
6673
}
6774

75+
/**
76+
* Executes the AskCodeCommand.
77+
*
78+
* @param context - The SlashCommandContext object.
79+
* @param read - The IRead object.
80+
* @param modify - The IModify object.
81+
* @param http - The IHttp object.
82+
* @returns A Promise that resolves to void.
83+
*/
6884
public async executor(
6985
context: SlashCommandContext,
7086
read: IRead,

ai-assistant/src/commands/DocumentCommand.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ export class DocumentCommand implements ISlashCommand {
2020
public i18nDescription = "";
2121
public providesPreview = false;
2222

23+
/**
24+
* Processes the HTTP request and query to generate documentation.
25+
*
26+
* @param http - The HTTP client.
27+
* @param query - The user's query.
28+
* @returns A promise that resolves to an object containing the generated JSDoc and explanation, or null if no references are found or the documentation could be generated.
29+
*/
2330
private async process(
2431
http: IHttp,
2532
query: string
@@ -78,6 +85,15 @@ export class DocumentCommand implements ISlashCommand {
7885
};
7986
}
8087

88+
/**
89+
* Executes the command to retrieve and display documentation for a given query.
90+
*
91+
* @param context - The SlashCommandContext object containing information about the command execution.
92+
* @param read - The IRead object used to read data from the Rocket.Chat server.
93+
* @param modify - The IModify object used to modify data on the Rocket.Chat server.
94+
* @param http - The IHttp object used to make HTTP requests.
95+
* @returns A Promise that resolves to void.
96+
*/
8197
public async executor(
8298
context: SlashCommandContext,
8399
read: IRead,

ai-assistant/src/commands/FindSimilar.modal.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ import { handleCommandResponse } from "../utils/handleCommandResponse";
2020
export const COMMAND = "rcc-findsimilar";
2121
export const FIND_SIMILAR_COMMAND_MODAL = "findsimilar-command";
2222

23+
/**
24+
* Helps to build the modal for `/rcc-findsimilar` command.
25+
*
26+
* @returns A promise that resolves to an object of type IUIKitSurfaceViewParam used to open RC's modal.
27+
*/
2328
export async function findSimilarModal(): Promise<IUIKitSurfaceViewParam> {
2429
return {
2530
id: FIND_SIMILAR_COMMAND_MODAL,
@@ -44,6 +49,13 @@ export async function findSimilarModal(): Promise<IUIKitSurfaceViewParam> {
4449
};
4550
}
4651

52+
/**
53+
* Processes the given query to find similar nodes in the database.
54+
*
55+
* @param http - The IHttp instance used for making HTTP requests.
56+
* @param query - The user's query string to process.
57+
* @returns Related code chunks from the database.
58+
*/
4759
async function process(http: IHttp, query: string): Promise<DBNode[] | null> {
4860
const db = new Neo4j(http);
4961
const embeddingModel = new MiniLML6(http);
@@ -61,6 +73,16 @@ async function process(http: IHttp, query: string): Promise<DBNode[] | null> {
6173
return similarNodes;
6274
}
6375

76+
/**
77+
* Handles the submit event of the findSimilarModal.
78+
*
79+
* @param view - The UI kit surface view.
80+
* @param sender - The user who triggered the event.
81+
* @param room - The room where the event occurred.
82+
* @param read - The read utility.
83+
* @param modify - The modify utility.
84+
* @param http - The HTTP utility.
85+
*/
6486
export async function findSimilarModalSubmitHandler(
6587
view: IUIKitSurface,
6688
sender: IUser,

ai-assistant/src/commands/FindSimilar.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ export class FindSimilarCommand implements ISlashCommand {
1717
public i18nDescription = "";
1818
public providesPreview = false;
1919

20+
/**
21+
* Executes the FindSimilar command.
22+
*
23+
* @param context - The SlashCommandContext object.
24+
* @param read - The IRead object.
25+
* @param modify - The IModify object.
26+
* @param http - The IHttp object.
27+
* @param persistence - The IPersistence object.
28+
* @returns A Promise that resolves to void.
29+
* @throws Error if no trigger ID is provided.
30+
*/
2031
public async executor(
2132
context: SlashCommandContext,
2233
read: IRead,

ai-assistant/src/commands/HelpCommand.ts

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,23 @@ import { handleCommandResponse } from "../utils/handleCommandResponse";
1313
const HELP_MESSAGE = `
1414
## Rocket Chatter
1515
16-
Rocket Chatter is a Slack bot that provides code-related information and assistance to developers working on the Rocket Chat project. The bot is designed to help developers understand the Rocket Chat codebase, find relevant documentation, and improve their coding practices. Rocket Chatter uses the Rocket Chat API to access the codebase and provide context-specific information and suggestions to users.
16+
Rocket Chatter is a Rocket.Chat bot that provides code-related information and assistance to developers working on the Rocket Chat project. The bot is designed to help developers understand the Rocket Chat codebase, find relevant documentation, and improve their coding practices. Rocket Chatter uses the Rocket Chat API to access the codebase and provide context-specific information and suggestions to users.
1717
1818
\`/rcc-help\`: Provides descriptions and usage instructions for all available Rocket Chatter commands.
1919
\`\`\`
2020
/rcc-help
2121
\`\`\`
22-
\`/rcc-ask\`: Allows users to ask specific code-related questions about the Rocket Chat's codebase and receive context-specific answers.
22+
23+
\`/rcc-askcode\`: Allows users to ask specific code-related questions about the Rocket Chat's codebase and receive context-specific answers.
24+
\`\`\`
25+
/rcc-askcode [your query]
26+
\`\`\`
27+
28+
\`/rcc-askdocs\`: Accesses and provides developer documentation related to the Rocket Chat project, including setup guides, API references, and contribution guidelines.
2329
\`\`\`
24-
/rcc-ask [your query]
30+
/rcc-askdocs [topic]
2531
\`\`\`
32+
2633
\`/rcc-diagram\`: Generates clarifying diagrams to visually represent the relationships and structures between an entity and it's dependencies within the Rocket Chat codebase.
2734
\`\`\`
2835
/rcc-diagram [entity]
@@ -39,18 +46,12 @@ Rocket Chatter is a Slack bot that provides code-related information and assista
3946
\`\`\`
4047
(A modal will open to input the code snippet you want to find similar entities to)
4148
42-
\`/rcc-suggest\`: Offers suggestions for code improvements, refactoring, or enhancements based on best practices and project standards.
49+
\`/rcc-improve\`: Offers suggestions for code improvements, refactoring, or enhancements based on best practices and project standards.
4350
\`\`\`
44-
/rcc-suggest
51+
/rcc-improve
4552
\`\`\`
4653
(A modal will open to input the code snippet you want to suggest improvements for)
4754
48-
\`/rcc-styleguide\`: Formats the codebase according to the styleguide used throughout the codebase.
49-
\`\`\`
50-
/rcc-styleguide
51-
\`\`\`
52-
(A modal will open to input the code snippet you want to format)
53-
5455
\`/rcc-importance\`: Determines and explains the importance of a specific code entity within the larger context of the Rocket Chat codebase.
5556
\`\`\`
5657
/rcc-importance [entity]
@@ -71,11 +72,6 @@ Rocket Chatter is a Slack bot that provides code-related information and assista
7172
\`\`\`
7273
/rcc-whyused [entity]
7374
\`\`\`
74-
75-
\`/rcc-devdocs\`: Accesses and provides developer documentation related to the Rocket Chat project, including setup guides, API references, and contribution guidelines.
76-
\`\`\`
77-
/rcc-devdocs [topic]
78-
\`\`\`
7975
`;
8076

8177
export class HelpCommand implements ISlashCommand {

0 commit comments

Comments
 (0)