Skip to content

raghureddyram/readme-bot

Repository files navigation

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

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.

Prerequisites

  • Node.js (version specified in package.json)
  • Docker and Docker Compose
  • AWS account (for S3 storage)
  • GitHub account and personal access token

How to Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/readme-bot.git cd readme-bot

  2. Install dependencies:

    npm install

  3. 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

  4. Set up the database:

    npx prisma migrate dev

How to Run

  1. 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
  1. For production:

    npm run build npm start

The application will be available at http://localhost:3000.

How to Test

Run the linter:

npm run lint

Note: Additional testing scripts should be added in the future.

Table Relationships

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).

Architectural Choices

  1. Next.js Framework: Chosen for its server-side rendering capabilities and API routes, providing a seamless full-stack development experience.

  2. Prisma ORM: Used for type-safe database access and easy schema management.

  3. S3 for File Storage: Utilized to store README files, providing scalable and reliable file management.

  4. GitHub API Integration: Implemented to fetch repository information and commit histories.

  5. Greptile API: Used for advanced text processing and summarization tasks.

  6. Docker: Employed for consistent development and deployment environments.

Possible Enhancements

  1. Implement user authentication and authorization.
  2. Add more comprehensive testing suite, including unit and integration tests.
  3. Improve error handling and logging mechanisms.
  4. Implement a caching layer to reduce API calls and improve performance.
  5. Add support for multiple GitHub accounts and organizations.
  6. Develop a user-friendly interface for managing repositories and README files.
  7. Implement webhooks to automatically update READMEs on new commits.

License

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published