Based on the provided information and summaries, I'll create a README.md file for the readme-bot project. Here's the content:
Readme-Bot is a Next.js application designed to automate the process of generating and updating README files for GitHub repositories. It utilizes various services to summarize changes, manage file storage, and interact with GitHub repositories.
- Node.js (version specified in package.json)
- Docker and Docker Compose
- AWS account (for S3 storage)
- GitHub account and personal access token
-
Clone the repository:
git clone https://github.com/yourusername/readme-bot.git cd readme-bot
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory and add the following variables:GITHUB_TOKEN=your_github_token GITHUB_USERNAME=your_github_username AWS_ACCESS_KEY_ID=your_aws_access_key AWS_SECRET_ACCESS_KEY=your_aws_secret_key
-
Set up the database:
npx prisma migrate dev
-
For development:
npm run dev
- generate a greptile index.
curl -X POST http://localhost:3000/api/greptile-indexes \
-H "Content-Type: application/json" \
-d '{ "repoName": "readme-bot", "branchName": "main"}'
- generate a readme.
curl -X POST http://localhost:3000/api/readmes \
-H "Content-Type: application/json" \
-d '{ "repoName": "readme-bot", "branchName": "main"}'
- get a readme
curl -X GET http://localhost:3000/api/readmes/readme-bot/main
-
For production:
npm run build npm start
The application will be available at http://localhost:3000
.
Run the linter:
npm run lint
Note: Additional testing scripts should be added in the future.
The project uses Prisma ORM with PostgreSQL. Here's a simplified representation of the database schema:
Model | Field | Type | Attributes | Description |
---|---|---|---|---|
Repo | id |
Int |
@id @default(autoincrement()) |
Unique identifier for the repository. |
name |
String |
@unique |
Repository name, must be unique. | |
branches |
Branch[] |
A repository can have multiple branches. | ||
Branch | id |
Int |
@id @default(autoincrement()) |
Unique identifier for the branch. |
repoId |
Int |
Foreign key to the Repo model. |
||
repo |
Repo |
@relation(fields: [repoId], references: [id]) |
Relation to the Repo model. |
|
name |
String |
Name of the branch. | ||
createdAt |
DateTime |
@default(now()) |
Creation date of the branch. | |
readmes |
Readme[] |
A branch can have multiple README files. | ||
GreptileIndex |
GreptileIndex[] |
A branch can have multiple GreptileIndexes. | ||
@@unique([repoId, name]) |
Each repo can only have one branch with a specific name. | |||
GreptileIndex | id |
Int |
@id @default(autoincrement()) |
Unique identifier for the GreptileIndex. |
branchId |
Int |
Foreign key to the Branch model. |
||
branch |
Branch |
@relation(fields: [branchId], references: [id]) |
Relation to the Branch model. |
|
status |
String |
@default("submitted") |
Status of the GreptileIndex (default: "submitted"). | |
createdAt |
DateTime |
@default(now()) |
Creation date of the GreptileIndex. | |
@@unique([branchId]) |
Each branch has a unique GreptileIndex. | |||
Readme | id |
Int |
@id @default(autoincrement()) |
Unique identifier for the Readme. |
branchId |
Int |
Foreign key to the Branch model. |
||
branch |
Branch |
@relation(fields: [branchId], references: [id]) |
Relation to the Branch model. | |
s3_url |
String |
S3 URL where the README is stored. | ||
generatedFromCommitHistory |
Boolean |
@default(false) |
Flag to track if README was generated from commit history. | |
createdAt |
DateTime |
@default(now()) |
Creation date of the Readme. | |
lastCommitSha |
String? |
The last commit SHA or generated SHA (optional). |
-
Next.js Framework: Chosen for its server-side rendering capabilities and API routes, providing a seamless full-stack development experience.
-
Prisma ORM: Used for type-safe database access and easy schema management.
-
S3 for File Storage: Utilized to store README files, providing scalable and reliable file management.
-
GitHub API Integration: Implemented to fetch repository information and commit histories.
-
Greptile API: Used for advanced text processing and summarization tasks.
-
Docker: Employed for consistent development and deployment environments.
- Implement user authentication and authorization.
- Add more comprehensive testing suite, including unit and integration tests.
- Improve error handling and logging mechanisms.
- Implement a caching layer to reduce API calls and improve performance.
- Add support for multiple GitHub accounts and organizations.
- Develop a user-friendly interface for managing repositories and README files.
- Implement webhooks to automatically update READMEs on new commits.
This project is licensed under the MIT License - see the LICENSE.md file for details.
This README provides a comprehensive overview of the Readme-Bot project, including setup instructions, running commands, architectural decisions, and potential future enhancements. It's designed to give developers a clear understanding of the project structure and how to get started with development.