Skip to content

Commit 58c4b65

Browse files
committed
Adds tech stack and repo structure
1 parent d63d149 commit 58c4b65

File tree

1 file changed

+122
-4
lines changed

1 file changed

+122
-4
lines changed

.github/copilot-instructions.md

Lines changed: 122 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,128 @@
33
# Copilot Instructions
44

55
## Overview
6-
This project is a [Discord](https://discord.com/) Bot developed in Java, utilizing [JDA (Java Discord API)](https://jda.wiki/introduction/jda/) library for diverse interactions on Together Java server. The project is built with Gradle.
6+
This project is a [Discord](https://discord.com/) Bot developed in Java, utilizing [JDA (Java Discord API)](https://jda.wiki/introduction/jda/) library for diverse interactions on Together Java discord server.
7+
8+
## Tech Stack
9+
10+
The project uses a variety of technologies and libraries to achieve its functionality. Below is a comprehensive list of the main technologies used :
11+
12+
**Languages**
13+
- Java: the primary language for the project.
14+
- SQL: for database creation and management.
15+
- Groovy: for build-tool's configurations.
16+
17+
**Build & Dependency Management**
18+
- Gradle v8: the build tool used for managing dependencies and building the project.
19+
- Shadow plugin: for creating a fat JAR with all dependencies included.
20+
- Jib plugin: for building Docker images directly from Gradle.
21+
22+
**Framework :** JDA (Java Discord API): the main framework for interacting with Discord's API.
23+
24+
**Database**
25+
- SQLite: for local database storage.
26+
- jOOQ (ORM): for database interactions and schema generation.
27+
28+
**Logging**
29+
- Log4j v2: the logging framework used for logging messages.
30+
- log4j-slf4j2-impl: for bridging SLF4J to Log4j v2.
31+
32+
**JSON/XML/CSV Processing**
33+
- Jackson (core, dataformat-csv, dataformat-xml, datatype-jsr310, sealed-classes)
34+
35+
**Utilities**
36+
- jsr305: for annotations from JSR-305.
37+
- JetBrains Annotations: for annotations from JetBrains.
38+
- urlbuilder: for building URLs.
39+
- jsoup: for parsing HTML and extracting data.
40+
- jlatexmath (+ font modules): for rendering LaTeX math expressions.
41+
- ascii-table: for rendering ASCII tables.
42+
- url-detector
43+
- caffeine (caching)
44+
- github-api (kohsuke)
45+
- commons-text
46+
- rssreader
47+
- com.theokanning.openai-gpt3-java (api, service)
48+
49+
**Testing**
50+
- JUnit Jupiter
51+
- Mockito
52+
53+
**Code Quality**
54+
- Spotless
55+
- SonarLint
56+
57+
**Containerization**
58+
- Docker Compose
59+
- Jib (for container image building)
60+
61+
**Version Control & CI/CD**
62+
- Git v2
63+
- GitHub Actions (for CI/CD, under `.github/workflows`)
64+
- Dependabot (for dependency updates, under `.github/dependabot.yml`)
65+
- Docker
66+
67+
**IDE/Editor Support**
68+
- IntelliJ IDEA
69+
- Eclipse
70+
- GitHub Codespaces
71+
72+
## Repository Structure
73+
74+
A **multi-module** Gradle project composed of 5 modules :
75+
```txt
76+
TJ-Bot
77+
├── application (Application module)
78+
├── buildSrc (Custom Gradle plugin)
79+
├── database
80+
├── formatter
81+
├── utils
82+
```
83+
84+
The repository has other directories that are not modules :
85+
86+
- `.devcontainer` and `.vscode` directories are only about giving support to coding on [GitHub's Codespaces](https://github.com/features/codespaces).
87+
The project is not intended necessarily to be run in a container or a specific IDE_.
88+
- `.github` directory contains configuration files for GitHub Actions, Dependabot, and other GitHub features.
89+
- `.gradle` directory contains the Gradle wrapper files, allowing the project to be built with a specific version of Gradle without requiring users to install it manually, ignore it.
90+
- `meta` directory currently contains 3 [draw.io](https://www.drawio.com/) diagram files about the project, and a `google-style-eclipse.xml` file used in Spotless configuration.
91+
- `scripts` directory currently contains only one file which is a git pre-commit hook that runs Spotless to format the code before committing.
92+
93+
## Application
94+
95+
This is the main module. It contains the entry point, core logic, feature implementations, configuration management, and logging utilities for the bot.
96+
97+
Most packages are equipped with a `package-info.java` file, which contains a brief description and 2 annotations
98+
- `@MethodsReturnNonnullByDefault`: defined in the `/utils` module, indicating that all methods in the package return non-null values by default.
99+
- `@ParametersAreNonnullByDefault`: from `javax.annotation` package, indicating that all parameters in the package are non-null by default.
100+
101+
### 1. `config`:
102+
103+
Purpose: Handles all configuration aspects of the bot, including loading, validating, and providing access to configuration values.
104+
105+
Contents:
106+
- Classes for parsing and representing configuration files (e.g., `config.json.template`).
107+
- Utilities for environment variable overrides and runtime configuration changes.
108+
- Central access point for configuration values used throughout the application.
109+
110+
### 2. `features`
111+
112+
Purpose: Implements the bot’s features, including commands, event listeners, and integrations.
113+
114+
Contents:
115+
- Command classes extending `SlashCommandAdapter` for Discord slash commands.
116+
- Event listeners for handling Discord events (e.g., user asked a question, question answered).
117+
- Feature registration and lifecycle management (e.g., Features.createFeatures).
118+
- Sub-packages for organizing features by domain (e.g., basic, chatgpt (openai), code, projects, and others).
119+
120+
### 3. `logging`
121+
122+
Purpose: Provides logging configuration and utilities for the application.
7123

8-
## Project Structure
124+
Contents:
125+
- Log4j2 configuration files (e.g., `resources/log4j2.xml`).
126+
- Custom logging utilities and wrappers.
127+
- Integration with `SLF4J` for consistent logging across dependencies.
9128

10129
## Complex Aspects
11130

@@ -14,14 +133,13 @@ This project is a [Discord](https://discord.com/) Bot developed in Java, utilizi
14133
## Coding Style
15134
- Use meaningful variable and method names.
16135
- Use `@Override` annotation for overridden methods.
17-
- Use `final` for constants and method parameters that should not be modified.
136+
- Use `final` for fields and classes.
18137
- Use `this` keyword to refer to the current instance of a class.
19138
- No magic numbers or strings; use constants instead.
20139
- No unnecessary comments; code should be self-explanatory.
21140
- Use Javadoc for public classes and methods.
22141
- No wildcard imports; import only the necessary classes.
23142
- Adhere to the [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html).
24-
- Use Spotless for code formatting. Run `gradlew spotlessApply` to format code.
25143

26144
## Commands
27145
1. Create a new class extending `SlashCommandAdapter`.

0 commit comments

Comments
 (0)