diff --git a/README.md b/README.md index 44ada906..27eb89f8 100644 --- a/README.md +++ b/README.md @@ -281,9 +281,9 @@ See the Configuration section below for the comple 3๏ธโƒฃ - readme-javascript.md - (repository deleted) - JavaScript, React + readme-postgres.md + postgres-proxy-server + Python, Postgres, Duckdb, Docker 4๏ธโƒฃ @@ -351,19 +351,7 @@ A repository URL or local path to your codebase is required run readme-ai. The f **OpenAI API Key** -An OpenAI API account and API key are needed to use *readme-ai*. The following steps outline the process. - -
- ๐Ÿ” OpenAI API Account Setup -
    -
  1. Go to the OpenAI website.
  2. -
  3. Click the "Sign up for free" button.
  4. -
  5. Fill out the registration form with your information and agree to the terms of service.
  6. -
  7. Once logged in, click on the "API" tab.
  8. -
  9. Follow the instructions to create a new API key.
  10. -
  11. Copy the API key and keep it in a secure place.
  12. -
-
+An OpenAI API account and API key are needed to use *readme-ai*. Get started by creating an account [here](https://platform.openai.com/docs/quickstart/account-setup). Once you have an account, you can create an API key on the [API settings page](https://platform.openai.com/api-keys). > [!WARNING] > @@ -395,11 +383,16 @@ conda install -c conda-forge readmeai Alternatively, clone the readme-ai repository and build from source. ```sh -git clone https://github.com/eli64s/readme-ai && \ +git clone https://github.com/eli64s/readme-ai +``` + +Change into the project directory. + +```sh cd readme-ai ``` -Then use one of the methods below to install the project's dependencies (Bash, Conda, Pipenv, or Poetry). +And install the dependencies using one of the methods below. Using `bash` ```sh @@ -420,7 +413,7 @@ poetry shell --- -### ๐Ÿ‘ฉโ€๐Ÿ’ป Running *README-AI* +### ๐Ÿ‘ฉโ€๐Ÿ’ป Running *readme-ai* Before running the application, ensure you have an OpenAI API key and its set as an environment variable. @@ -554,11 +547,6 @@ The readme-ai tool is designed with flexibility in mind, allowing users to confi
๐Ÿ”  Configuration Models
- - ***GitService Enum*** - **Purpose**: Defines Git service details. diff --git a/docs/architecture.md b/docs/architecture.md deleted file mode 100644 index 59e7e617..00000000 --- a/docs/architecture.md +++ /dev/null @@ -1,132 +0,0 @@ -# Architecture - -## Repository Preprocessing - -- User provides a repository URL or local path to command line interface. -- Input arguments are sanitized and validated. -- Temporary directory is created to clone the user's repository. -- Firstly, a file tree structure is generated from the cloned content. It serves two purposes: - - Used to provide context to the language model. - - Displayed in the output README file. - -> Directory Tree Example: - -```sh -โ””โ”€โ”€ readmeai/ - โ”œโ”€โ”€ Dockerfile - โ”œโ”€โ”€ Makefile - โ”œโ”€โ”€ poetry.lock - โ”œโ”€โ”€ pyproject.toml - โ”œโ”€โ”€ readmeai/ - โ”‚ โ”œโ”€โ”€ cli/ - โ”‚ โ”‚ โ”œโ”€โ”€ commands.py - โ”‚ โ”‚ โ””โ”€โ”€ options.py - โ”‚ โ”œโ”€โ”€ config/ - โ”‚ โ”‚ โ”œโ”€โ”€ __Init__.py - โ”‚ โ”‚ โ””โ”€โ”€ settings.py - โ”‚ โ”œโ”€โ”€ core/ - โ”‚ โ”‚ โ”œโ”€โ”€ factory.py - โ”‚ โ”‚ โ”œโ”€โ”€ logger.py - โ”‚ โ”‚ โ”œโ”€โ”€ model.py - โ”‚ โ”‚ โ”œโ”€โ”€ parser.py - โ”‚ โ”‚ โ”œโ”€โ”€ preprocess.py - โ”‚ โ”‚ โ””โ”€โ”€ tokens.py - โ”‚ โ”œโ”€โ”€ main.py - โ”‚ โ”œโ”€โ”€ markdown/ - โ”‚ โ”‚ โ”œโ”€โ”€ badges.py - โ”‚ โ”‚ โ”œโ”€โ”€ headers.py - โ”‚ โ”‚ โ”œโ”€โ”€ quickstart.py - โ”‚ โ”‚ โ”œโ”€โ”€ tables.py - โ”‚ โ”‚ โ”œโ”€โ”€ template.py - โ”‚ โ”‚ โ””โ”€โ”€ tree.py - โ”‚ โ”œโ”€โ”€ services/ - โ”‚ โ”‚ โ””โ”€โ”€ version_control.py - โ”‚ โ”œโ”€โ”€ settings/ - โ”‚ โ”‚ โ”œโ”€โ”€ config.toml - โ”‚ โ”‚ โ”œโ”€โ”€ dependency_files.toml - โ”‚ โ”‚ โ”œโ”€โ”€ identifiers.toml - โ”‚ โ”‚ โ”œโ”€โ”€ ignore_files.toml - โ”‚ โ”‚ โ”œโ”€โ”€ language_names.toml - โ”‚ โ”‚ โ””โ”€โ”€ language_setup.toml - โ”‚ โ””โ”€โ”€ utils/ - โ”‚ โ””โ”€โ”€ utils.py - ``` - -Following this, repo contents and metadata are processed and organized in the [preprocess.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/core/preprocess.py) script. The module returns two data structures in [main.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/main.py#L81) that are used in downstream tasks. This includes a list of dependencies and a file contents dictionary. - -### *Dependencies List* - -A list of project dependencies is genereated from scanning each file and its content during preprocessing. The list includes the dependencies and packages fround in the codebase files (e.g. `requirements.txt`, `package.json`, `poetry.lock`, etc.), programming languges used, platforms i.e. Docker, and any other relevant information. - -> Dependencies List Example: -```python -dependencies = ['poetry.lock', 'pandas', 'click', 'sh' 'pytest', 'python', 'streamlit', 'numpy'] -``` - -The list is used downstream for a variety of purposes, including generating the badges rendered in the output file, and also injected into prompts to give the LLM additional context of the repository. - - -### *File Contents Dictionary* - -A dictionary of file paths and contents is generated from the repository. - -> File Contents Dictionary Example: -```json -{ - "file_path": "my_root_directory/my_subdirectory/my_file.py", - "file_content_string": "import numpy as np\n\n\ndef my_function():\n return np.random.rand(1)\n", -} -``` - -This structure is first used to generate the file summaries at the individual file level. The file summaries are then used to generate three additional README.md sections. - -## OpenAI API Model - -### *File Summaries* - -The program invokes OpenAI API and begins processing the file contents dictionary. First, the code summary prompt is built, injecting the file path and contents into the prompt. Additionally, the prompt is embedded with the directory tree structure to provide context to the LLM about the current file. - -> Code Summary Prompt Example: -```toml -summaries = """Offer a comprehensive summary <= 80 words that encapsulates the core functionalities of the code below. Aim for precision and conciseness in your explanation, ensuring a fine balance between detail and brevity.\nDirectory Tree: {0}\nPath: {1}\nCode:\n{2}\n""" -``` - -After the prompt is created, we check if the prompt exceeds the model's maximum tokenn limit. If true, the prompt is truncated to the maximum and sent to the API. - -> The current default max is 4000 tokens for the `gpt-3.5-turbo` engine. - -This is not ideal, but from what I've seen, the model is able to generate a decent summary even with a truncated prompt. We are looking at ways to enhance context and accuracy, considering tools like [LangChain](https://python.langchain.com/docs/get_started/introduction) and [LlamaIndex](https://gpt-index.readthedocs.io/en/stable/index.html). - -### *Architecture Section* - -The prompt I use to generate the arcitecture table is located in the project settings file [here](https://github.com/eli64s/readme-ai/blob/main/readmeai/settings/config.toml#L31) and is as follows: - -```toml -features = """Hello! Analyze the repository {0} and following the instructions below to generate a comprehensive list of features. -Please provide a comprehensive technical analysis of the codebase and its components. -Consider the codebase as a whole and highlight the key characteristics, design patterns, architectural decisions, and any other noteworthy elements. -Generate your response as a Markdown table with the following columns: - -| | Feature | Description | -|----|--------------------|--------------------------------------------------------------------------------------------------------------------| -| โš™๏ธ | **Architecture** | Analyze the structural design of the system here. Limit your response to a maximum of 200 characters. | -| ๐Ÿ“„ | **Documentation** | Discuss the quality and comprehensiveness of the documentation here. Limit your response to a maximum of 200 characters.| -| ๐Ÿ”— | **Dependencies** | Examine the external libraries or other systems that this system relies on here. Limit your response to a maximum of 200 characters.| -| ๐Ÿงฉ | **Modularity** | Discuss the system's organization into smaller, interchangeable components here. Limit your response to a maximum of 200 characters.| -| ๐Ÿงช | **Testing** | Evaluate the system's testing strategies and tools here. Limit your response to a maximum of 200 characters. | -| โšก๏ธ | **Performance** | Analyze how well the system performs, considering speed, efficiency, and resource usage here. Limit your response to a maximum of 200 characters.| -| ๐Ÿ” | **Security** | Assess the measures the system uses to protect data and maintain functionality here. Limit your response to a maximum of 200 characters.| -| ๐Ÿ”€ | **Version Control**| Discuss the system's version control strategies and tools here. Limit your response to a maximum of 200 characters.| -| ๐Ÿ”Œ | **Integrations** | Evaluate how the system interacts with other systems and services here. Limit your response to a maximum of 200 characters.| -| ๐Ÿ“ถ | **Scalability** | Analyze the system's ability to handle growth here. Limit your response to a maximum of 200 characters. | - -Repository Details: -\nDirectory Tree: {1}\nDependencies: {2}\nCode Summaries: {3}\n -""" -``` - -The prompt has four `{}` placeholders with data injected as we did previously. This includes the repository URL, directory tree, dependencies list, and the code summaries dictionary generated in the preprocessing step. - -The prompt is very specific in its instructions, explicity telling the LLM to generate a Markdown table with the specified columns and giving a 200 character limit for each row of the table. - ---- diff --git a/docs/concepts.md b/docs/concepts.md new file mode 100644 index 00000000..cd80dbc8 --- /dev/null +++ b/docs/concepts.md @@ -0,0 +1,106 @@ +# readme-ai Core Concepts + +readme-ai is a tool for auto-generating README files for code repositories using AI. Here are some of its key concepts: + +## Repository Analysis + +- Traverses the repository directory tree to build a code structure overview +- Extracts metadata like dependencies and languages used +- Analyzes characteristics to inform content generation + +## AI-Powered Content Creation + +- Uses GPT language models via the OpenAI API +- Structured prompts injected with repository details +- Generates sections like project overview and technical features +- Summarizes code files in markdown tables + +## Customization + +- Flexible configuration system +- CLI options to tweak badge icons, images, model settings +- Supports different badge styles like flat, plastic, skills +- Can provide custom images and set text alignment +- Edit prompt templates to influence content + +## Modular Design + +- Components and parsers decoupled from core logic +- Built using factory and strategy patterns +- Easily extend functionality with new parsers +- Abstracts services like file handling and git ops + +## Asynchronous Workflows + +- Leverages Python asyncio for non-blocking I/O +- Concurrent networking, disk and CPU bound tasks +- Manages OpenAI rate limits for optimal performance +- Resource management via async context managers + +## Robustness + +- Exponential backoff retry logic for resilience +- Caching frequently used responses +- Handles Unicode encoding errors gracefully +- Secure temp directories to isolate repository +- Configurable logging for debuggability + +By leveraging these concepts and more, readme-ai aims to offer a flexible platform for auto-generating documentation to boost developer productivity. + +--- + + Here is a markdown document discussing some of the core concepts of the readme-ai project: + +# README-AI Core Concepts + +README-AI is a tool for auto-generating detailed README files for software projects using AI. It utilizes several core concepts and components to analyze codebases and produce high-quality documentation. + +## Codebase Analysis + +README-AI performs an in-depth analysis of the provided codebase to extract key information. + +- **File traversal**: Recursively traverse the codebase directory to identify all files. Special cases like ignoring certain files or handling GitHub workflows are handled programmatically. + +- **Metadata extraction**: File metadata like name, path, content, language, dependencies etc. are extracted and stored. Popular dependency manifest formats are parsed to detect dependencies. + +- **Content preprocessing**: File contents are tokenized to allow smarter content generation tailored to codebase complexity. + +The output is a structured `FileData` object that encapsulates file details. + +## LLM API Integration + +Language Models like GPT-3 are leveraged to generate fluent text for documentation. + +- **Modular design**: The LLM API client is abstracted into a separate `ModelHandler` class to allow swapping out different AI providers. + +- **Prompt engineering**: Carefully crafted prompt templates are populated with codebase metadata to produce accurate, relevant content. + +- **Batching & caching**: Requests are batched and caching used to optimize performance and costs. Exponential backoff retries handle errors. + +Generated text is inserted into Markdown templates to build a full-fledged README. + +## Configuration-driven + +The tool relies extensively on configuration using Pydantic models. + +- **Settings**: Central settings file with common constants and file paths. Helper configuration provides additional customization. + +- **Validation**: Rigorous validations are performed on settings like repository URL to prevent errors. + +- **Extensibility**: Adding new features or functionality requires minimal code changes due to config-driven design. + +Overall, this promotes maintainability, testability and flexibility. + +## Customizable Output + +Users can customize the look and feel of the generated README by providing a range of CLI options. + +- **Appearance**: Choose badge styles, header images, alignment options and more for unique styling. + +- **Content**: Control language model behavior with parameters like temperature and max tokens. Toggle emojis in text. + +- **Templates**: (WIP) Generate focused READMEs for domains like machine learning, webdev etc. + +In summary, README-AI aims to simplify documentation through intelligent automation, while keeping the user in control. + +--- diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 00000000..0773d7fd --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,98 @@ +# Configuration Models and Enums + +This page documents the data models and enums used for configuring the `readme-ai` CLI tool. These models are based on [Pydantic](https://pydantic-docs.helpmanual.io/), which allows for data parsing and validation through Python type annotations. + +## Git Settings + +`GitSettings` is used to represent and validate repository settings. + +### Fields + +- `repository`: A string or `Path` representing the location of the repository. +- `full_name`: An optional string denoting the full name of the repository in 'username/repo' format. +- `host`: An optional string representing the Git service host. +- `name`: An optional string for the repository name. +- `source`: An optional string representing the source Git service. + +### Validators + +Custom validators are used to ensure that the repository information is correct and that the `full_name`, `host`, `name`, and `source` fields are derived correctly from the `repository` field. + +## CLI Settings + +`CliSettings` manages the command-line interface options for the `readme-ai` application. + +### Fields + +- `emojis`: A boolean indicating whether to use emojis. +- `offline`: A boolean specifying if the tool should run in offline mode. + +## File Settings + +`FileSettings` defines paths related to different configurations and output. + +### Fields + +- `dependency_files`: The path to the file containing dependency configurations. +- `identifiers`: The path to the file with identifiers. +- `ignore_files`: The path to the file listing files to ignore. +- `language_names`: The path to the file with language names mapping. +- `language_setup`: The path to the file with language setup instructions. +- `output`: The path for the output file (e.g., `README.md`). +- `shields_icons`: The path to the file with shield icon configurations. +- `skill_icons`: The path to the file with skill icon configurations. + +## Enums + +The application uses several `Enum` classes to represent various configurations. + +### GitService + +`GitService` is an enum that includes: + +- `LOCAL`: Local repository. +- `GITHUB`: GitHub repository. +- `GITLAB`: GitLab repository. +- `BITBUCKET`: Bitbucket repository. + +Each service has properties for `api_url` and `file_url_template` to facilitate integration with the respective Git service. + +### BadgeOptions + +`BadgeOptions` represents the available styles for badges in the README files, such as: + +- `DEFAULT` +- `FLAT` +- `FLAT_SQUARE` +- `FOR_THE_BADGE` +- `PLASTIC` +- `SKILLS` +- `SKILLS_LIGHT` +- `SOCIAL` + +### ImageOptions + +`ImageOptions` enumerates the available choices for images used in the README header, including: + +- `CUSTOM` +- `DEFAULT` +- `BLACK` +- `GREY` +- `PURPLE` +- `YELLOW` +- `CLOUD` + +## Usage + +To use these models and enums, import them into your application and instantiate them with the appropriate configuration values. + +```python +from readmeai.config.models import CliSettings, GitSettings + +cli_settings = CliSettings(emojis=True, offline=False) +git_settings = GitSettings(repository='https://github.com/user/repo') +``` + +Remember to validate your configuration when instantiating the models to catch any issues early on. + +--- diff --git a/docs/contribute.md b/docs/contribute.md new file mode 100644 index 00000000..08959b7c --- /dev/null +++ b/docs/contribute.md @@ -0,0 +1,57 @@ +# Contributing Guidelines + +Thanks for your interest in contributing to *README-AI*! Please review these guidelines to ensure a smooth process. + +## Make Valuable Contributions + +Strive to make **useful**, **creative**, and **high quality** contributions. + +**Useful:** Solve common problems, use cases, exceptions, or issues. + +**Creative:** Innovative and helping us all learn new things. + +**High Quality:** Well-written, structured, and explained. + +## Follow The Code of Conduct + +Review and adhere to our [CODE_OF_CONDUCT](./CODE_OF_CONDUCT.md). + +## Ways to Contribute + +There are many ways to contribute to *README-AI*! You can: + +- Simply start a discussion by asking a question or making a suggestion. +- Look for opportunities to make processes more efficient to improve the user experience. + - Find ways to make code more readable and easier to understand. + - Find unhandled exceptions and bugs when running the program. + - Write unit test for the program. +- Brainstorm new CLI options and features that would be useful to users. + - i.e. `--language` option to specify the language of the README. + - What is the best way to implement README file generation in any language selected? + +These are just a few exmaples, there are many more ways to contribute to *README-AI*. + +## Submitting Changes + +1. Fork the repository and clone it locally. +2. Create a new branch with a descriptive name i.e feature/new-feature-name or bugfix-issue-123. +3. Make focused changes with clear commits. +4. Open a pull request document the changes you've made and why they're necessary. +5. Respond to code reviews from maintainers. + +## Code Quality Expectations + +- Clear, well-documented code +- Include tests for new code +- Follow project style standards +- Rebase onto latest main branch + +## Attribution + +Contributors to our project will be acknowledged in the project's README.md file and AUTHORS.md file. + +## License + +By contributing to our project, you agree to license your contributions under the project's open source license. The project's license can be found in the [LICENSE](./LICENSE.md) file. + +Thank you for contributing to our project! diff --git a/docs/examples.md b/docs/examples.md index 4fdb5c44..d3458147 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -1,74 +1,72 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Output FileRepositoryLanguages
1๏ธโƒฃreadme-python.mdreadme-aiPython
2๏ธโƒฃreadme-typescript.mdchatgpt-app-react-typescriptTypeScript, React
3๏ธโƒฃreadme-javascript.md(repository deleted)JavaScript, React
4๏ธโƒฃreadme-kotlin.mdfile.io-android-clientKotlin, Java, Android
5๏ธโƒฃreadme-rust-c.mdrust-c-appC, Rust
6๏ธโƒฃreadme-go.mdgo-docker-appGo
7๏ธโƒฃreadme-java.mdjava-minimal-todoJava
8๏ธโƒฃreadme-fastapi-redis.mdasync-ml-inferencePython, FastAPI, Redis
9๏ธโƒฃreadme-mlops.mdmlops-coursePython, Jupyter
๐Ÿ”Ÿreadme-pyflink.mdflink-flowPyFlink
Output FileRepositoryLanguages
1๏ธโƒฃreadme-python.mdreadme-aiPython
2๏ธโƒฃreadme-typescript.mdchatgpt-app-react-typescriptTypeScript, React
3๏ธโƒฃreadme-postgres.mdpostgres-proxy-serverPython, Postgres, Duckdb, Docker
4๏ธโƒฃreadme-kotlin.mdfile.io-android-clientKotlin, Java, Android
5๏ธโƒฃreadme-rust-c.mdrust-c-appC, Rust
6๏ธโƒฃreadme-go.mdgo-docker-appGo
7๏ธโƒฃreadme-java.mdjava-minimal-todoJava
8๏ธโƒฃreadme-fastapi-redis.mdasync-ml-inferencePython, FastAPI, Redis
9๏ธโƒฃreadme-mlops.mdmlops-coursePython, Jupyter
๐Ÿ”Ÿreadme-pyflink.mdflink-flowPyFlink
-
diff --git a/docs/features.md b/docs/features.md index e388baf8..691c99c5 100644 --- a/docs/features.md +++ b/docs/features.md @@ -1,271 +1,256 @@ -
-
- - โถ Badges - - - - - - - - -
-

Project Slogan and Badges

-

- โ€ฃ A slogan to highlight your poject is generated by prompting OpenAI's GPT engine. -

-

- โ€ฃ Codebase dependencies and metadata are visualized using Shields.io badges. -

-
- badges -
- -

- โ€ฃ Use the CLI option --badges to select the style of badges for your README!
- โ€ฃ 6 options currently supported: flat (default), flat-square, plastic, for-the-badge, social, square. Find a few examples below. -

- - - - - - - - -
-

1. Shieldsio flat badge style

-

Command: none as its the default style for readme-ai

-
- badges-shieldsio-default -
-
-

2. Shieldsio for-the-badge style

-

Command: --badges for-the-badge

-
- badges-shieldsio-flat -
-
-

3. Square iOS style badges

-

Command: --badges square

-
- badges-square -
-
+Built with flexibility in mind, readme-ai allows users to customize various aspects of the README file using CLI options and configuration settings. Content is generated using a combination of data extraction and making a few calls to LLM APIs. + +Currently, readme-ai uses generative ai to create four distinct sections of the README file. + +> i. **Header**: Project slogan that describes the repository in an engaging way. +> +> ii. **Overview**: Provides an intro to the project's core use-case and value proposition. +> +> iii. **Features**: Markdown table containing details about the project's technical components. +> +> iv. **Modules**: Codebase file summaries are generated and formatted into markdown tables. + +All other content is extracted from processing and analyzing repository metadata and files. + +### Customizable Header + +The header section is built using repository metadata and CLI options. Key features include: +- **Badges**: Svg icons that represent codebase metadata, provided by [shields.io](https://shields.io/) and [skill-icons](https://github.com/tandpfun/skill-icons). +- **Project Logo**: Select a project logo image from the base set or provide your image. +- **Project Slogan**: Catch phrase that describes the project, generated by generative ai. +- **Table of Contents/Quick Links**: Links to the different sections of the README file. + +Below are a few examples of README headers generated by the readme-ai tool. + + + + + + + + + + + + + + + + +
+ large-repo
+ default output (no options provided to cli) +
+ flat
+ --badges flat --image black +
+ flat
+ --badges flat-square --offline +
+ plastic
+ --badges plastic --image grey +
+ large-repo
+ --align left --badges flat --image purple +
+ skills-light
+ --badges skills-light --image grey +
+ skills
+ --align left --badges skills --image yellow +
+ +See the Configuration section below for the complete list of CLI options and settings.
+ +
+ ๐Ÿ“‘ Codebase Documentation +
+ + + + + + + + + + + + + +
+ Repository Structure
+

A directory tree structure is created and displayed in the README. Implemented using pure Python (tree.py).

+
+ tree +
+ Codebase Summaries +
+

File summaries generated using LLM APIs, and are formatted and grouped by directory in markdown tables.

+
+ summaries +
-
-
-
-
- - โท Codebase Documentation - - - - - - - - - - - - -
-

Directory Tree and File Summaries

-
-

โ€ฃ Your project's directory structure is visualized using a custom tree function.

-

โ€ฃ Each file in the codebase is summarized by OpenAI's GPT model.

-
- repository-tree - - code-summaries -
-
-
-
-
-
- - โธ Features Table - - - - - - - - -
-

Prompted Text Generation

-

- โ€ฃ An overview paragraph and features table are generated using detailed prompts, embedded with project metadata. -

-
- feature-table -
-
-
-
-
-
- - โน Dynamic Usage Guides
-
- - - - - - - -
-

Installation, Running, and Test

-

- โ€ฃ Generates instructions for installing, running, and testing your project. Instructions are created by identifying the codebase's top language and referring to our language_setup.toml configuration file. -

-
- usage-instructions -
-
-
-
-
-
- - โบ Additional README Sections
-
- - - - -
- - - -
- roadmap -
- license -
-
-
-
-
-
- - โป Templates (coming soon)
-
- - - - - - - -
-

โ€ฃ Developing CLI option letting users select from a variety of README styles

-

โ€ฃ Templates for use-cases such as data, machine learning, web development, and more!

-
-

AI and ML README Template Concept

- -
+ +
+ ๐Ÿ“ Overview & Features Table +
+ The overview and features sections are generated using OpenAI's API. Structured prompt templates are injected with repository metadata to help produce more accurate and relevant content. +
+ + + + + + + + + + + + + +
Overview
+

High-level introduction of the project, focused on the value proposition and use-cases, rather than technical aspects.

+
overview
Features Table
+

Describes technical components of the codebase, including architecture, dependencies, testing, integrations, and more.

+
features-table
-
-
-
-
- - โผ Example README Files
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Output FileRepositoryLanguages
1๏ธโƒฃreadme-python.mdreadme-aiPython
2๏ธโƒฃreadme-typescript.mdchatgpt-app-react-typescriptTypeScript, React
3๏ธโƒฃreadme-javascript.mdassistant-chat-gpt-javascriptJavaScript, React
4๏ธโƒฃreadme-kotlin.mdfile.io-android-clientKotlin, Java, Android
5๏ธโƒฃreadme-rust-c.mdrust-c-appC, Rust
6๏ธโƒฃreadme-go.mdgo-docker-appGo
7๏ธโƒฃreadme-java.mdjava-minimal-todoJava
8๏ธโƒฃreadme-fastapi-redis.mdasync-ml-inferencePython, FastAPI, Redis
9๏ธโƒฃreadme-mlops.mdmlops-coursePython, Jupyter
๐Ÿ”Ÿreadme-pyflink.mdflink-flowPyFlink
-
-
-
+ +
+ ๐Ÿš€ Dynamic Quick Start Guides +
+ + + + + + + +
Getting Started or Quick Start
+

Generates structured guides for installing, running, and testing your project. These steps are created by identifying dependencies and languages used in the codebase, and mapping this data to configuration files such as the language_setup.toml file.

+
getting-started +
+
+ +
+ ๐Ÿค Contributing Guidelines, License, & More +
+ + + + + + + +
Additional Sections
+

The remaining README sections are built from a baseline template that includes common sections such as Project Roadmap, Contributing Guidelines, License, and Acknowledgements.

+
contributing-guidelines
+
+ +
+ ๐Ÿงฉ Templates +
This feature is currently under development. The template system will allow users to generate README files in different flavors, such as ai, data, web development, etc. +
+ + + + +
+

README Template for ML & Data

+ +
+
+ +
+ ๐ŸŽจ Examples +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Output FileRepositoryLanguages
1๏ธโƒฃreadme-python.mdreadme-aiPython
2๏ธโƒฃreadme-typescript.mdchatgpt-app-react-typescriptTypeScript, React
3๏ธโƒฃreadme-postgres.mdpostgres-proxy-serverPython, Postgres, Duckdb, Docker
4๏ธโƒฃreadme-kotlin.mdfile.io-android-clientKotlin, Java, Android
5๏ธโƒฃreadme-rust-c.mdrust-c-appC, Rust
6๏ธโƒฃreadme-go.mdgo-docker-appGo
7๏ธโƒฃreadme-java.mdjava-minimal-todoJava
8๏ธโƒฃreadme-fastapi-redis.mdasync-ml-inferencePython, FastAPI, Redis
9๏ธโƒฃreadme-mlops.mdmlops-coursePython, Jupyter
๐Ÿ”Ÿreadme-pyflink.mdflink-flowPyFlink
+
+
diff --git a/docs/index.md b/docs/index.md index e9d0624e..74f26162 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,39 +1,38 @@ -# README-AI - - - -Automatically generate beautiful README files using OpenAI's GPT language models. - -[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/eli64s/readme-ai/.github%2Fworkflows%2Fpublish_package.yml?logo=GitHub&label=cicd&color=c125ff)](https://github.com/eli64s/readme-ai/actions) -[![Codecov](https://img.shields.io/codecov/c/github/eli64s/readme-ai?logo=codecov&color=c125ff)](https://app.codecov.io/gh/eli64s/readme-ai) -[![PyPI version](https://img.shields.io/pypi/v/readmeai?color=c125ff)](https://badge.fury.io/py/readmeai) -[![PyPI pyversions](https://img.shields.io/pypi/pyversions/readmeai.svg?color=c125ff)](https://pypi.python.org/pypi/readmeai/) -![License: MIT](https://img.shields.io/github/license/eli64s/readme-ai?color=c125ff) +

+ + +

+

README-AI

+

+ Auto-generate detailed and structured README files, powered by AI. +

+

+ + Test + + + Publish + + + PyPI Version + Python Versions + +

--- -## Introduction +## Overview -README-AI is a tool to generate README.md files for your projects. It is written in Python and uses the [GPT-4](https://openai.com/blog/better-language-models/) language model to generate the text. +***Objective*** -## Installation +Readme-ai is a developer tool that auto-generates README.md files using a combination of data extraction and generative ai. Simply provide a repository URL or local path to your codebase and a well-structured and detailed README file will be generated for you. -```bash -pip install readme-ai -``` +***Motivation*** -## Usage - -```bash -readme-ai --repository https://github/eli64s/readme-ai -``` - -## Example +Streamlines documentation creation and maintenance, enhancing developer productivity. This project aims to enable all skill levels, across all domains, to better understand, use, and contribute to open-source software. --- -## Motivation - -Streamlines documentation creation and maintenance, enhancing developer productivity. README-AI aims to improve the adoption of open-source software, enabling all skill levels and disciplines to understand, utilize, and contribute to projects more effectively. +## Key Concepts --- diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 00000000..0afb9287 --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,55 @@ +## Pip + +Using `pip` +```sh +pip install readmeai +``` + +## Docker + +Using `docker` +```sh +docker pull zeroxeli/readme-ai:latest +``` + +## Conda + +Using `conda` +```sh +conda install -c conda-forge readmeai +``` + + +## From Source + +Alternatively, clone the readme-ai repository and build from source. + +```sh +git clone https://github.com/eli64s/readme-ai +``` + +```sh +cd readme-ai +``` + +Then use one of the methods below to install the project's dependencies (Bash, Pipenv, or Poetry). + + +Using `bash` +```sh +bash setup/setup.sh +``` + +Using `pipenv` +```sh +pipenv install && \ +pipenv shell +``` + +Using `poetry` +```sh +poetry install && \ +poetry shell +``` + +--- diff --git a/docs/quickstart.md b/docs/quickstart.md new file mode 100644 index 00000000..b35ab96a --- /dev/null +++ b/docs/quickstart.md @@ -0,0 +1,108 @@ +**Requirements** + +* Python: 3.9+ +* Package manager or container runtime: `pip` or `docker` recommended. +* OpenAI API account and API key (other providers coming soon) + +**Repository** + +A repository URL or local path to your codebase is required run readme-ai. The following are supported: + +- [GitHub](https://github.com/) +- [GitLab](https://gitlab.com/) +- [Bitbucket](https://bitbucket.org/) +- [File System](https://en.wikipedia.org/wiki/File_system) + +**OpenAI API Key** + +An OpenAI API account and API key are needed to use *readme-ai*. The following steps outline the process. + +
+ ๐Ÿ” OpenAI API Account Setup +
    +
  1. Go to the OpenAI website.
  2. +
  3. Click the "Sign up for free" button.
  4. +
  5. Fill out the registration form with your information and agree to the terms of service.
  6. +
  7. Once logged in, click on the "API" tab.
  8. +
  9. Follow the instructions to create a new API key.
  10. +
  11. Copy the API key and keep it in a secure place.
  12. +
+
+ + +--- + +### Running *README-AI* + +Before running the application, ensure you have an OpenAI API key and its set as an environment variable. + +On `Linux` or `MacOS` +```console +$ export OPENAI_API_KEY=YOUR_API_KEY +``` + +On `Windows` +```console +$ set OPENAI_API_KEY=YOUR_API_KEY +``` + +Use one of the methods below to run the application (Pip, Docker, Conda, Streamlit, etc). + +Using `pip` +```sh +readmeai --repository https://github.com/eli64s/readme-ai +``` + +Using `docker` + +```sh +docker run -it \ +-e OPENAI_API_KEY=$OPENAI_API_KEY \ +-v "$(pwd)":/app zeroxeli/readme-ai:latest \ +-r https://github.com/eli64s/readme-ai +``` + +Using `conda` +```sh +readmeai -r https://github.com/eli64s/readme-ai +``` + +Using `streamlit` + +[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://readmeai.streamlit.app/) + +> [!NOTE] +> +> The web app is hosted on Streamlit Community Cloud, a free service for sharing Streamlit apps. Thus, the app may be unstable or unavailable at times. See the readme-ai-streamlit repository for more details. + +
Alternatively, run the application locally from the cloned repository.
+ +Using `pipenv` +```sh +pipenv shell && \ +python3 -m readmeai.cli.commands -o readme-ai.md -r https://github.com/eli64s/readme-ai +``` + +Using `poetry` +```sh +poetry shell && \ +poetry run python3 -m readmeai.cli.commands -o readme-ai.md -r https://github.com/eli64s/readme-ai +``` + +
+ +--- + +### Tests + +Use [`pytest`](https://docs.pytest.org/en/7.1.x/contents.html) to run the default test suite. +```sh +make test +``` + +Use [`nox`](https://nox.thea.codes/en/stable/) to run the test suite against multiple Python versions including `(3.9, 3.10, 3.11, 3.12)`. +```sh +nox -f noxfile.py +``` + +--- diff --git a/docs/requirements.txt b/docs/requirements.txt index ae3eb3e0..d5f2dcb8 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,14 +1,14 @@ -click -colorlog -cachetools -gitpython -httpx -h2 -openai -pydantic -pyyaml -responses -tabulate -tenacity -tiktoken -toml +# Requirements for core +jinja2~=3.0 +markdown~=3.2 +mkdocs~=1.5.3 +mkdocs-material-extensions~=1.3 +pygments~=2.16 +pymdown-extensions~=10.2 + +# Requirements for plugins +babel~=2.10 +colorama~=0.4 +paginate~=0.5 +regex>=2022.4 +requests~=2.26 diff --git a/examples/markdown/readme-java.md b/examples/markdown/readme-java.md index c60658d3..98c7b84c 100644 --- a/examples/markdown/readme-java.md +++ b/examples/markdown/readme-java.md @@ -1,21 +1,30 @@ -

+

-

-

MINIMAL-TODO

+

+

MINIMAL-TODO

-

- Minimal-Todo: Simplify Your Task Management +

+ Simplify and conquer with Minimal-Todo!

-

-

-

- Developed with the software and tools below +

+ license + last-commit + repo-top-language + repo-language-count +

+

+ Developed with the software and tools below.

-

- - - +

+ YAML + Google + Android + GitHub + Gradle + JSON + java + Markdown


@@ -38,7 +47,7 @@ ## ๐Ÿ“ Overview -Minimal-Todo is a lightweight Android application that helps users keep track of their tasks and to-do lists. The project's main purpose is to provide a simple and intuitive interface for managing tasks efficiently. The app allows users to create, update, and delete tasks, set due dates and priorities, and mark tasks as completed. It also includes features like search and filtering to help users organize and find tasks easily. Minimal-Todo's value proposition lies in its minimalist design and straightforward functionality, making it a practical choice for those seeking a hassle-free task management solution. +Minimal-Todo is a lightweight Android application that allows users to manage their tasks efficiently. The project provides a user-friendly interface for creating, viewing, editing, and deleting tasks. Users can organize tasks by setting due dates and marking them as complete. The app also supports task prioritization and allows users to add detailed descriptions and labels to each task. With an intuitive design and simple functionality, Minimal-Todo aims to help users stay organized and increase productivity. --- @@ -46,16 +55,16 @@ Minimal-Todo is a lightweight Android application that helps users keep track of | | Feature | Description | |----|--------------------|--------------------------------------------------------------------------------------------------------------------| -| โš™๏ธ | **Architecture** | The architecture of the system is not explicitly mentioned in the repository. It appears to be a traditional Android app architecture with activities, fragments, and custom views. | -| ๐Ÿ“„ | **Documentation** | The repository lacks comprehensive documentation. There is a README.md file that provides basic setup instructions, but additional documentation is sparse. | -| ๐Ÿ”— | **Dependencies** | The repository relies on several external libraries such as Calligraphy, TextDrawable, and YAML. The specific versions and purposes of these dependencies are not explicitly mentioned. | -| ๐Ÿงฉ | **Modularity** | The system is organized into smaller components like fragments, activities, and custom views. The separation of concerns could be improved by following a more structured architecture pattern. | -| ๐Ÿงช | **Testing** | The repository does not include extensive testing. There are some basic unit tests and instrumented tests present in the `androidTest` directory, but the coverage is limited. | -| โšก๏ธ | **Performance** | There is no specific information available regarding performance optimizations. The app's performance may depend on individual device configurations and the efficiency of implemented code. | -| ๐Ÿ” | **Security** | The repository does not have explicit security measures mentioned. Basic security practices like secure data storage and network communication should be implemented for a production-level app. | -| ๐Ÿ”€ | **Version Control**| The repository uses Git for version control. The presence of a `.gitignore` file, `.travis.yml` for CI/CD with Travis CI, and multiple commits indicate the use of version control practices. | -| ๐Ÿ”Œ | **Integrations** | The system does not appear to have direct integrations with external systems or services. However, it utilizes external libraries for specific functionality, as mentioned in the dependencies section. | -| ๐Ÿ“ถ | **Scalability** | The scalability of the system is not explicitly discussed in the repository. The app's performance and scalability may depend on the efficiency of implemented code and potential architecture improvements. | +| โš™๏ธ | **Architecture** | The codebase follows a typical Android app architecture using activities, fragments, and ViewModel for separation of concerns. It is not mentioned whether any specific design pattern was used. | +| ๐Ÿ“„ | **Documentation** | The codebase lacks comprehensive documentation. Some important files like `proguard-rules.pro` and `google-services.json` are mentioned, but there is no specific mention of documentation quality. | +| ๐Ÿ”— | **Dependencies** | The codebase relies on libraries such as `com.android.tools.build:gradle`, `com.google.gms:google-services`, and `mavenCentral()`. The use of `google()` suggests usage of Google libraries. | +| ๐Ÿงฉ | **Modularity** | The codebase is organized into smaller components such as activities, fragments, and ViewModel classes, which promote modularity and reusability to some extent. | +| ๐Ÿงช | **Testing** | The codebase does not mention any specific testing strategies or tools, suggesting a lack of comprehensive testing. | +| โšก๏ธ | **Performance** | Without specific performance measurements, it is difficult to assess the system's performance. No specific optimizations or considerations are mentioned. | +| ๐Ÿ” | **Security** | No specific security measures are mentioned in the codebase, suggesting a lack of specific security implementations. | +| ๐Ÿ”€ | **Version Control**| The codebase uses Git for version control, with a mention of ".travis.yml" suggesting the use of Travis CI for continuous integration. | +| ๐Ÿ”Œ | **Integrations** | The codebase does not mention any specific integrations with other systems or services. | +| ๐Ÿ“ถ | **Scalability** | Without specific information, it is difficult to assess the system's scalability. The codebase structure does not explicitly mention any scalable architecture or strategies. | --- @@ -64,21 +73,18 @@ Minimal-Todo is a lightweight Android application that helps users keep track of ```sh โ””โ”€โ”€ Minimal-Todo/ โ”œโ”€โ”€ .travis.yml - โ”œโ”€โ”€ app/ + โ”œโ”€โ”€ app โ”‚ โ”œโ”€โ”€ app-release.apk โ”‚ โ”œโ”€โ”€ build.gradle โ”‚ โ”œโ”€โ”€ google-services.json โ”‚ โ”œโ”€โ”€ proguard-rules.pro - โ”‚ โ””โ”€โ”€ src/ - โ”‚ โ”œโ”€โ”€ androidTest/ - โ”‚ โ””โ”€โ”€ main/ + โ”‚ โ””โ”€โ”€ src + โ”‚ โ”œโ”€โ”€ androidTest + โ”‚ โ””โ”€โ”€ main โ”œโ”€โ”€ build.gradle - โ”œโ”€โ”€ gradle/ - โ”‚ โ””โ”€โ”€ wrapper/ + โ”œโ”€โ”€ gradle โ”œโ”€โ”€ gradlew.bat - โ”œโ”€โ”€ screenshots/ โ””โ”€โ”€ settings.gradle - ``` --- @@ -87,112 +93,112 @@ Minimal-Todo is a lightweight Android application that helps users keep track of
. -| File | Summary | -| --- | --- | -| [build.gradle](https://github.com/avjinder/Minimal-Todo/blob/main/build.gradle) | This code snippet is a part of the Minimal-Todo repository. It configures the build and dependencies for the Android application, using Gradle for managing the project. The code ensures necessary plugins and repositories are included for successful compilation and execution of the app. | -| [gradlew.bat](https://github.com/avjinder/Minimal-Todo/blob/main/gradlew.bat) | This code snippet is a Gradle startup script for the Windows operating system. It sets up the JVM options, finds the Java executable, and executes the Gradle build process. It is a critical component in the overall architecture of the repository as it facilitates the build and configuration of the project. | -| [settings.gradle](https://github.com/avjinder/Minimal-Todo/blob/main/settings.gradle) | This code snippet is part of the Minimal-Todo repository. It plays a critical role in the main app's architecture. The code achieves specific functionalities listed in the `app/` directory and relies on dependencies and software mentioned in the `settings.gradle` file. Key files within the codebase include `:app`. | -| [.travis.yml](https://github.com/avjinder/Minimal-Todo/blob/main/.travis.yml) | This code snippet is a part of the Minimal-Todo repository's architecture. It builds the Android app, utilizing various tools and dependencies specified in the codebase. The main goal is to successfully build the app using the provided configurations. | +| File | Summary | +| --- | --- | +| [build.gradle](https://github.com/avjinder/Minimal-Todo/blob/main/build.gradle) | This code snippet manages the build configuration of the parent repository. It includes dependencies and repositories for the sub-projects. | +| [gradlew.bat](https://github.com/avjinder/Minimal-Todo/blob/main/gradlew.bat) | This code snippet is a Gradle startup script for the Windows operating system. It sets up the necessary environment variables and executes the Gradle build tool for the parent repository. | +| [settings.gradle](https://github.com/avjinder/Minimal-Todo/blob/main/settings.gradle) | This code snippet serves as a crucial component in the parent repository's architecture. It achieves specific functionalities related to the app module. The codebase relies on certain dependencies and software, as mentioned in the settings.gradle file. Refer to the repository structure for further details. | +| [.travis.yml](https://github.com/avjinder/Minimal-Todo/blob/main/.travis.yml) | The code snippet is a build script for an Android project. It sets up the required dependencies and builds the project using Gradle. It ensures that the project is built properly for the specified Android version and with the necessary tools. |
app -| File | Summary | -| --- | --- | -| [proguard-rules.pro](https://github.com/avjinder/Minimal-Todo/blob/main/app/proguard-rules.pro) | The code snippet in the `proguard-rules.pro` file contains project-specific ProGuard rules. It specifies the flags and options for code obfuscation and optimization when building the Android app. It includes rules for keeping certain classes and packages from being obfuscated. The file also includes rules for handling WebView and JavaScript interfaces. | -| [build.gradle](https://github.com/avjinder/Minimal-Todo/blob/main/app/build.gradle) | The code snippet in the app/build.gradle file configures the Android application, specifying its version, dependencies, and build settings. It includes libraries for analytics, UI components, and support for different Android versions. | -| [google-services.json](https://github.com/avjinder/Minimal-Todo/blob/main/app/google-services.json) | This code snippet, located in the app directory, includes the necessary configuration files and source code for the Minimal-Todo Android app. It uses the google-services.json file for dependencies and software integration. The codebase is part of the Minimal-Todo repository, which follows a specific directory structure. | +| File | Summary | +| --- | --- | +| [proguard-rules.pro](https://github.com/avjinder/Minimal-Todo/blob/main/app/proguard-rules.pro) | The code snippet in this repository contains ProGuard rules for an Android project. These rules specify which classes should be kept and which ones should be obfuscated during the build process. The main purpose of this code is to protect sensitive information and optimize the size of the final APK file. | +| [build.gradle](https://github.com/avjinder/Minimal-Todo/blob/main/app/build.gradle) | This code snippet is a part of an Android application that uses various dependencies to implement features like analytics tracking, custom fonts, spinner menu, date/time picker, and material design components. It also configures the build settings and signing configuration for releasing the app. | +| [google-services.json](https://github.com/avjinder/Minimal-Todo/blob/main/app/google-services.json) | This code snippet plays a critical role in the parent repository's architecture. It achieves important features related to project information, client information, and services, enabling analytics, messaging, sign-in, and ads functionalities. The codebase relies on the `google-services.json` file and follows a specific directory structure. |
app.src.androidTest.java.com.example.avjindersinghsekhon.minimaltodo -| File | Summary | -| --- | --- | -| [TestStoreRetrieveData.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/androidTest/java/com/example/avjindersinghsekhon/minimaltodo/TestStoreRetrieveData.java) | This code snippet contains test cases for the StoreRetrieveData class. It verifies the functionality of storing and retrieving data from a storage file, and also checks the conversion of data to JSON format. | -| [ApplicationTest.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/androidTest/java/com/example/avjindersinghsekhon/minimaltodo/ApplicationTest.java) | Summary: The code snippet in the `ApplicationTest.java` file is a test case that verifies the functionality of the `Application` class in the Minimal-Todo Android app. It is part of the parent repository's architecture and helps ensure the quality and reliability of the application. | -| [TestTodoItem.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/androidTest/java/com/example/avjindersinghsekhon/minimaltodo/TestTodoItem.java) | This code snippet contains JUnit tests that verify the functionality of the ToDoItem class. It checks if the ToDoItem object can be constructed using a three-parameter constructor, marshalled to JSON, and unmarshalled from JSON. The tests ensure that the object properties are set correctly. | +| File | Summary | +| --- | --- | +| [TestStoreRetrieveData.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/androidTest/java/com/example/avjindersinghsekhon/minimaltodo/TestStoreRetrieveData.java) | This code snippet contains test cases for the `StoreRetrieveData` class in the MinimalToDo app. It tests the functionality to store and retrieve data from the app's storage. The tests check if the data is saved correctly and can be retrieved accurately. It also includes a test to ensure the conversion of data to a JSONArray works as intended. | +| [ApplicationTest.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/androidTest/java/com/example/avjindersinghsekhon/minimaltodo/ApplicationTest.java) | This code snippet is a test file (`ApplicationTest.java`) in the `com.example.avjindersinghsekhon.minimaltodo` package. It tests the application's fundamental functionality. | +| [TestTodoItem.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/androidTest/java/com/example/avjindersinghsekhon/minimaltodo/TestTodoItem.java) | The code snippet is a unit test for the ToDoItem class in the MinimalTodo application. It verifies the functionality of constructing a ToDoItem object, marshaling and unmarshaling it to JSON. |
app.src.main.java.com.example.avjindersinghsekhon.minimaltodo.Settings -| File | Summary | -| --- | --- | -| [SettingsFragment.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Settings/SettingsFragment.java) | This code snippet is a SettingsFragment class that handles user preferences in the Minimal-Todo Android app. It allows users to change the app's theme and uses Google Analytics to track Night Mode usage. | -| [SettingsActivity.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Settings/SettingsActivity.java) | This code snippet represents the SettingsActivity file within the Minimal-Todo repository. It is responsible for managing the settings screen of the Minimal Todo app, including theme selection and navigation handling. | +| File | Summary | +| --- | --- | +| [SettingsFragment.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Settings/SettingsFragment.java) | The `SettingsFragment.java` file is a key component in the codebase. It handles user preferences and theme settings for the app. It listens for changes in preferences and updates the theme accordingly, utilizing the `SharedPreferences` and the `PreferenceKeys` class. The `SettingsFragment` communicates with the `MainFragment` and uses the `AnalyticsApplication`. | +| [SettingsActivity.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Settings/SettingsActivity.java) | The code snippet is a key file in the Settings package of the repository. It handles the creation and behavior of the SettingsActivity, including setting the theme, displaying a toolbar, and navigating back to the parent activity. |
app.src.main.java.com.example.avjindersinghsekhon.minimaltodo.Reminder -| File | Summary | -| --- | --- | -| [ReminderFragment.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Reminder/ReminderFragment.java) | This code snippet is a reminder fragment that handles the display and functionality of reminders in the Minimal-Todo app. It allows users to view, modify, and remove reminders. The code includes features like snooze options, saving data, and handling menu options. | -| [ReminderActivity.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Reminder/ReminderActivity.java) | This code snippet is a key file in the Minimal-Todo repository. It handles the creation of reminder activities within the app, utilizing the ReminderFragment. It extends a base activity and sets the layout to reminder_layout. | +| File | Summary | +| --- | --- | +| [ReminderFragment.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Reminder/ReminderFragment.java) | The code snippet is a ReminderFragment class in the com.example.avjindersinghsekhon.minimaltodo.Reminder package. It handles the display and interaction of a reminder for a to-do item, allowing users to remove the reminder or snooze it for a specific duration. The class also saves the changes made to the reminder and closes the app after the changes are saved. | +| [ReminderActivity.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Reminder/ReminderActivity.java) | The code snippet is a ReminderActivity class in the parent repository's architecture. It extends AppDefaultActivity and sets the layout for the activity. It also creates and returns an instance of the ReminderFragment. |
app.src.main.java.com.example.avjindersinghsekhon.minimaltodo.About -| File | Summary | -| --- | --- | -| [AboutActivity.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/About/AboutActivity.java) | This code snippet is part of an Android app's repository and is located in the `com.example.avjindersinghsekhon.minimaltodo.About` package. It represents the `AboutActivity` class, which is responsible for displaying information about the app, including its version and a toolbar. It also allows the user to navigate back to the previous activity. | -| [AboutFragment.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/About/AboutFragment.java) | The code snippet is a part of the Minimal-Todo repository's architecture. It contains the AboutFragment.java file, which handles the display of app version, toolbar, and contact information. This code contributes to the user interface and analytics functionality of the app. | +| File | Summary | +| --- | --- | +| [AboutActivity.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/About/AboutActivity.java) | This code snippet represents the AboutActivity class in the parent repository. It is responsible for displaying information about the application, including the version, and handling the functionality of the toolbar in the About screen. | +| [AboutFragment.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/About/AboutFragment.java) | This code snippet is a part of the About feature in the codebase. It handles the creation and display of the About page, showing the app version and providing a contact option for user feedback. It also utilizes analytics for tracking user actions. |
app.src.main.java.com.example.avjindersinghsekhon.minimaltodo.AddToDo -| File | Summary | -| --- | --- | -| [AddToDoFragment.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/AddToDo/AddToDoFragment.java) | This code snippet is part of the Minimal-Todo repository and it consists of a Java class called AddToDoFragment. It handles the logic and user interface for adding new tasks in the Minimal Todo app. | -| [AddToDoActivity.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/AddToDo/AddToDoActivity.java) | The code snippet is an Android activity that adds a new to-do item. It extends AppDefaultActivity and sets up the layout and initial fragment for the to-do creation process. | +| File | Summary | +| --- | --- | +| [AddToDoFragment.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/AddToDo/AddToDoFragment.java) | This code snippet is part of the parent repository's architecture and is located in the AddToDo package. It contains code for a fragment that allows users to add a new to-do item. The fragment includes various UI elements such as buttons, text fields, and switches, as well as functionality for handling user input and interactions. | +| [AddToDoActivity.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/AddToDo/AddToDoActivity.java) | This code snippet is the implementation of the AddToDoActivity class within the Minimal Todo app. It extends the AppDefaultActivity class and handles the creation of the activity, setting the content view, creating the initial fragment, and handling the onResume event. |
app.src.main.java.com.example.avjindersinghsekhon.minimaltodo.Main -| File | Summary | -| --- | --- | -| [MainActivity.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Main/MainActivity.java) | This code snippet is the main activity of the Minimal-Todo app. It handles the creation of the toolbar, menu options, and navigation to other activities like About and Settings. | -| [CustomRecyclerScrollViewListener.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Main/CustomRecyclerScrollViewListener.java) | This code snippet is a custom implementation of a scroll listener for a RecyclerView. It enables hiding and showing of a view based on the scroll direction and distance. The code provides the ability to customize the actions to be performed when the view is shown or hidden. | -| [MainFragment.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Main/MainFragment.java) | The code snippet is a key file in the Minimal-Todo repository. It contains the main functionality and user interface elements for the app, including alarms, shared preferences, and a RecyclerView for displaying tasks. | +| File | Summary | +| --- | --- | +| [MainActivity.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Main/MainActivity.java) | The code snippet is the `MainActivity` file in the `com.example.avjindersinghsekhon.minimaltodo.Main` package. It sets up the toolbar, handles menu items, and navigates to other activities. | +| [CustomRecyclerScrollViewListener.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Main/CustomRecyclerScrollViewListener.java) | Code snippet `CustomRecyclerScrollViewListener.java` is a part of the parent repository's architecture and provides functionality for hiding and showing elements in a RecyclerView based on the user's scroll behavior. It listens to scroll events and triggers the appropriate actions when the user scrolls up or down. | +| [MainFragment.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Main/MainFragment.java) | The code snippet is a key file in the `Main` package of the codebase. It manages the main screen of the app, including the layout, animation, and interaction logic with the user. The code also utilizes various dependencies and software. |
app.src.main.java.com.example.avjindersinghsekhon.minimaltodo.Analytics -| File | Summary | -| --- | --- | -| [AnalyticsApplication.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Analytics/AnalyticsApplication.java) | The `AnalyticsApplication.java` file in the parent repository's `app` directory is responsible for handling analytics tracking within the Minimal Todo app. It initializes and manages the Google Analytics tracker, sets up analytics properties, and sends tracking events and screen views. The code also provides methods for sending customized tracking events. | +| File | Summary | +| --- | --- | +| [AnalyticsApplication.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Analytics/AnalyticsApplication.java) | The `AnalyticsApplication` class in the codebase is responsible for managing the Google Analytics integration. It initializes the tracker and provides methods to send screen views and events to Google Analytics. The code retrieves the Analytics code from the `global_tracker` XML file and sets up the necessary configurations for tracking. |
app.src.main.java.com.example.avjindersinghsekhon.minimaltodo.AppDefault -| File | Summary | -| --- | --- | -| [AppDefaultFragment.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/AppDefault/AppDefaultFragment.java) | This code snippet defines an abstract class called AppDefaultFragment that extends the Fragment class. It provides a method for inflating the layout of the fragment and a callback for when the fragment is destroyed. This class serves as a base class for implementing custom fragments within the Minimal-Todo repository. | -| [AppDefaultActivity.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/AppDefault/AppDefaultActivity.java) | The code snippet defines an abstract activity class, AppDefaultActivity, that sets up an initial fragment and handles the creation of a ContentViewLayoutRes. It is part of an Android repository structure for a Minimal Todo app. | +| File | Summary | +| --- | --- | +| [AppDefaultFragment.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/AppDefault/AppDefaultFragment.java) | The code snippet is a base class for Fragments in the parent repository. It handles the inflation of the layout and provides a method to specify the layout resource. | +| [AppDefaultActivity.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/AppDefault/AppDefaultActivity.java) | This code snippet is an abstract activity class called AppDefaultActivity. It sets up the initial fragment and the content view layout for an Android app. It abstracts common functionality for activities in the app. |
app.src.main.java.com.example.avjindersinghsekhon.minimaltodo.Utility -| File | Summary | -| --- | --- | -| [TodoNotificationService.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/TodoNotificationService.java) | The `TodoNotificationService` class in the `Utility` package is responsible for handling and displaying notifications for the Minimal-Todo app. It receives a todo item's text and unique identifier, and creates a notification with the provided content. The notification includes a title, small icon, and actions for opening the app and deleting the todo item. | -| [ScrollingFABBehaviour.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/ScrollingFABBehaviour.java) | The code snippet is an implementation of a custom behavior for a FloatingActionButton in a CoordinatorLayout. It allows the button to react to the scrolling of certain views, such as a Snackbar or a Toolbar, by animating its position. | -| [ToDoItem.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/ToDoItem.java) | This code snippet includes the ToDoItem class, which represents a single task in the Minimal-Todo app. It stores information such as the task text, description, reminder status, color, date, and identifier. The class provides methods for creating objects, converting to JSON, and accessing/updating task properties. | -| [CustomTextInputLayout.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/CustomTextInputLayout.java) | This code snippet is a custom implementation of the TextInputLayout class in Android. It ensures that the hint text is always visible, even after the EditText's hint is cleared. It overrides the onDraw method to achieve this behavior. | -| [StoreRetrieveData.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/StoreRetrieveData.java) | The `StoreRetrieveData` class in the `Utility` package of the codebase enables the saving and loading of `ToDoItem` objects to and from a file in the app's internal storage. It provides methods to convert the items to JSON format, save them to a file, and load them back into an `ArrayList`. | -| [Utils.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/Utils.java) | The code snippet in `Utils.java` retrieves the height of the toolbar in the app by accessing the theme attributes. This information is crucial for the parent repository's architecture as it determines layout calculations. | -| [DeleteNotificationService.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/DeleteNotificationService.java) | This code snippet is a service that handles the deletion of a notification in the Minimal-Todo app. It retrieves the data, finds the corresponding notification, removes it, and saves the updated data. It also marks the data as changed for future use. | -| [ItemTouchHelperClass.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/ItemTouchHelperClass.java) | The `ItemTouchHelperClass` in the `Utility` package is a crucial file in the Minimal-Todo repository. It provides functionality for dragging and swiping items in a RecyclerView. This code snippet enables the movement and removal of items within the application's UI. | -| [PreferenceKeys.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/PreferenceKeys.java) | This code snippet defines the key preference for night mode in the Minimal-Todo app. It retrieves the resource string for the night mode preference key. Its parent repository has a directory structure with various files and dependencies. | -| [RecyclerViewEmptySupport.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/RecyclerViewEmptySupport.java) | The code snippet defines a custom RecyclerView class called RecyclerViewEmptySupport. It is responsible for displaying an empty view when the RecyclerView has no items. The class handles updating the visibility of the empty view based on changes in the adapter's data. | +| File | Summary | +| --- | --- | +| [TodoNotificationService.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/TodoNotificationService.java) | This code snippet is a part of the parent repository's architecture and is responsible for handling and generating notifications for to-do tasks. It uses Android's NotificationManager and PendingIntent for creating and managing notifications. | +| [ScrollingFABBehaviour.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/ScrollingFABBehaviour.java) | This code snippet defines the behavior of a floating action button (FAB) in a scrolling view. It allows the FAB to move up and down based on the scroll position, and also handles the interaction with other UI elements like a snackbar or toolbar. The code is part of the parent repository's architecture for managing the FAB's behavior in a coordinated layout. | +| [ToDoItem.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/ToDoItem.java) | The `ToDoItem` class in the codebase is responsible for representing a to-do item with its properties such as title, description, reminder, color, date, and identifier. It offers methods to serialize the object to JSON and vice versa. | +| [CustomTextInputLayout.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/CustomTextInputLayout.java) | The CustomTextInputLayout class in the com.example.avjindersinghsekhon.minimaltodo.Utility package extends the TextInputLayout class from the Android support library. It overrides the addView() and onDraw() methods to handle the hint behavior of EditText views within the layout. | +| [StoreRetrieveData.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/StoreRetrieveData.java) | This code snippet, located in `app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/StoreRetrieveData.java`, provides functionality for saving and loading data using JSON format. It handles file operations and performs serialization and deserialization of `ToDoItem` objects. | +| [Utils.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/Utils.java) | The code snippet in `Utils.java` provides a utility function `getToolbarHeight` that retrieves the height of the toolbar from the device's context. This is crucial for calculating layout dimensions in the parent repository's architecture. | +| [DeleteNotificationService.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/DeleteNotificationService.java) | This code snippet is a service that handles deleting a notification and updating the data set in the parent repository. It retrieves the necessary data, removes the specified item, saves the updated data, and notifies the parent repository of the data change. | +| [ItemTouchHelperClass.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/ItemTouchHelperClass.java) | The ItemTouchHelperClass code snippet in the repository's Utility package defines the behavior for dragging and swiping items in a RecyclerView. It implements the ItemTouchHelper.Callback interface to handle movement and removal of items. | +| [PreferenceKeys.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/PreferenceKeys.java) | This code snippet defines the PreferenceKeys class, which holds a single field representing the key for a night mode preference setting. The key is obtained from a resources file. | +| [RecyclerViewEmptySupport.java](https://github.com/avjinder/Minimal-Todo/blob/main/app/src/main/java/com/example/avjindersinghsekhon/minimaltodo/Utility/RecyclerViewEmptySupport.java) | The `RecyclerViewEmptySupport` class is a key component in the repository. It manages the display of an empty view when a RecyclerView has no items. It extends the RecyclerView class and provides methods to set and show/hide the empty view. |
diff --git a/examples/markdown/readme-kotlin.md b/examples/markdown/readme-kotlin.md index 799f9d12..7d6b7250 100644 --- a/examples/markdown/readme-kotlin.md +++ b/examples/markdown/readme-kotlin.md @@ -1,74 +1,73 @@ -

+

-

-

FILE.IO-ANDROID-CLIENT

+

+

FILE.IO-ANDROID-CLIENT

-

- Simple file sharing made effortless and fast. +

+ Share files seamlessly with file.io-Android-Client!

-

+

license last-commit repo-top-language repo-language-count

-

- Developed with the software and tools below +

+ Developed with the software and tools below.

-

+

Firebase YAML Kotlin Org Google - Android
+ Android GitHub Gradle - JetBrains java - Markdown + JetBrains


## ๐Ÿ”— Quick Links -- [๐Ÿ”— Quick Links](#-quick-links) -- [๐Ÿ“ Overview](#-overview) -- [๐Ÿ“ฆ Features](#-features) -- [๐Ÿ“‚ Repository Structure](#-repository-structure) -- [๐Ÿงฉ Modules](#modules) -- [๐Ÿš€ Getting Started](#-getting-started) - - [โš™๏ธ Installation](#-installation) - - [๐Ÿค– Running file.io-Android-Client](#-running-file.io-Android-Client) - - [๐Ÿงช Tests](#-tests) -- [๐Ÿ›  Roadmap](#-roadmap) -- [๐Ÿค Contributing](#-contributing) -- [๐Ÿ“„ License](#-license) -- [๐Ÿ‘ Acknowledgments](#-acknowledgments) + +> - [๐Ÿ“ Overview](#-overview) +> - [๐Ÿ“ฆ Features](#-features) +> - [๐Ÿ“‚ Repository Structure](#-repository-structure) +> - [๐Ÿงฉ Modules](#-modules) +> - [๐Ÿš€ Getting Started](#-getting-started) +> - [โš™๏ธ Installation](#-installation) +> - [๐Ÿค– Running file.io-Android-Client](#-running-file.io-Android-Client) +> - [๐Ÿงช Tests](#-tests) +> - [๐Ÿ›  Project Roadmap](#-project-roadmap) +> - [๐Ÿค Contributing](#-contributing) +> - [๐Ÿ“„ License](#-license) +> - [๐Ÿ‘ Acknowledgments](#-acknowledgments) --- ## ๐Ÿ“ Overview -The file.io-Android-Client project is an Android app that provides a convenient and secure way to share files with others. It allows users to easily upload files from their Android devices and generate shareable links. The app also supports downloading files shared through link access. With a simple and intuitive user interface, this project aims to streamline the file sharing process, making it efficient and hassle-free. Whether it's sharing documents, images, or any other file type, this app ensures that users can quickly share files with others while maintaining data privacy and security. +The file.io-Android-Client project is a mobile application that allows users to easily upload and share files. The app provides a convenient and secure way to quickly send files to others, without the need for complex file-sharing platforms or email attachments. Users can select files from their device and upload them to the file.io server, which generates a unique link that can be shared with recipients. The files are encrypted during transit and stored securely on the server for a limited period of time before being automatically deleted. This project offers a simple and efficient solution for file sharing, making it a valuable tool for both personal and professional use. --- ## ๐Ÿ“ฆ Features -| | Feature | Description | -|----|--------------------|--------------------------------------------------------------------------------------------------------------------| -| โš™๏ธ | **Architecture** | The codebase follows the Model-View-ViewModel (MVVM) architectural pattern.| -| ๐Ÿ“„ | **Documentation** | The codebase has limited documentation. It could benefit from more comprehensive documentation to improve understanding.| -| ๐Ÿ”— | **Dependencies** | The codebase relies on various external libraries, including Firebase, ConstraintLayout, CardView, and AndroidX.| -| ๐Ÿงฉ | **Modularity** | The system is organized into smaller, interchangeable components, with separate modules for tests and Android-specific code.| -| ๐Ÿงช | **Testing** | The codebase includes unit tests for some classes, but overall, the testing strategy could be improved with more comprehensive test coverage.| -| โšก๏ธ | **Performance** | The performance of the system depends on external factors such as network speeds and file sizes. The codebase itself does not have significant performance optimizations.| -| ๐Ÿ” | **Security** | The codebase does not explicitly address security measures, but it relies on external systems like Firebase for authentication and data protection.| -| ๐Ÿ”€ | **Version Control**| The codebase uses Git for version control.| -| ๐Ÿ”Œ | **Integrations** | The system integrates with Firebase for authentication and Firebase Cloud Storage for file storage.| -| ๐Ÿ“ถ | **Scalability** | The system's scalability depends on external factors, such as the scalability of Firebase Cloud Storage. The codebase itself does not have explicit scalability measures.| +| | Feature | Description | +|----|-------------------|---------------------------------------------------------------| +| โš™๏ธ | **Architecture** | The architecture of the project is not mentioned in the repository. | +| ๐Ÿ”ฉ | **Code Quality** | The code quality and style are not explicitly mentioned in the repository. | +| ๐Ÿ“„ | **Documentation** | The extent and quality of documentation are not mentioned in the repository. | +| ๐Ÿ”Œ | **Integrations** | The key integrations and external dependencies include Firebase, Kittinunf, and WorkManager. | +| ๐Ÿงฉ | **Modularity** | The modularity and reusability of the codebase are not mentioned in the repository. | +| ๐Ÿงช | **Testing** | The testing frameworks and tools used are not mentioned in the repository. | +| โšก๏ธ | **Performance** | The efficiency, speed, and resource usage are not mentioned in the repository. | +| ๐Ÿ›ก๏ธ | **Security** | The measures used for data protection and access control are not mentioned in the repository. | +| ๐Ÿ“ฆ | **Dependencies** | The key external libraries and dependencies include Firebase, Kittinunf, and WorkManager. | + --- @@ -77,24 +76,22 @@ The file.io-Android-Client project is an Android app that provides a convenient ```sh โ””โ”€โ”€ file.io-Android-Client/ โ”œโ”€โ”€ .travis.yml - โ”œโ”€โ”€ app/ - โ”‚ โ”œโ”€โ”€ build/ - โ”‚ โ”‚ โ””โ”€โ”€ outputs/ + โ”œโ”€โ”€ app + โ”‚ โ”œโ”€โ”€ build + โ”‚ โ”‚ โ””โ”€โ”€ outputs โ”‚ โ”œโ”€โ”€ build.gradle โ”‚ โ”œโ”€โ”€ proguard-rules.pro - โ”‚ โ”œโ”€โ”€ release/ + โ”‚ โ”œโ”€โ”€ release โ”‚ โ”‚ โ””โ”€โ”€ app-release.apk - โ”‚ โ””โ”€โ”€ src/ - โ”‚ โ”œโ”€โ”€ androidTest/ - โ”‚ โ”œโ”€โ”€ main/ - โ”‚ โ””โ”€โ”€ test/ + โ”‚ โ””โ”€โ”€ src + โ”‚ โ”œโ”€โ”€ androidTest + โ”‚ โ”œโ”€โ”€ main + โ”‚ โ””โ”€โ”€ test โ”œโ”€โ”€ build.gradle - โ”œโ”€โ”€ gradle/ - โ”‚ โ””โ”€โ”€ wrapper/ - โ”œโ”€โ”€ screenshots/ - โ”‚ โ”œโ”€โ”€ readme.txt + โ”œโ”€โ”€ gradle + โ”œโ”€โ”€ screenshots + โ”‚ โ””โ”€โ”€ readme.txt โ””โ”€โ”€ settings.gradle - ``` --- @@ -103,122 +100,122 @@ The file.io-Android-Client project is an Android app that provides a convenient
. -| File | Summary | -| --- | --- | -| [build.gradle](https://github.com/rumaan/file.io-Android-Client/blob/main/build.gradle) | The code snippet in the `build.gradle` file sets up the necessary dependencies and repositories for the Android client application in the `file.io` repository. It includes configurations for the Android build tools, Fabric, Google services, and Kotlin. | -| [settings.gradle](https://github.com/rumaan/file.io-Android-Client/blob/main/settings.gradle) | The code snippet is part of the file.io-Android-Client repository. It plays a key role in the architecture by including the:app file. The repository's layout consists of necessary directories and dependencies to enable the Android client functionality. | -| [.travis.yml](https://github.com/rumaan/file.io-Android-Client/blob/main/.travis.yml) | This code snippet includes the configuration for the Android build process in the parent repository. It sets up the necessary dependencies and software, manages caching and licenses, and ensures compatibility with Android versions 26 and 27. | +| File | Summary | +| --- | --- | +| [build.gradle](https://github.com/rumaan/file.io-Android-Client/blob/master/build.gradle) | This code snippet in the build.gradle file is responsible for configuring the build and dependencies of the Android client app in the parent repository. It sets up repositories, declares dependencies, and configures the build tools. | +| [settings.gradle](https://github.com/rumaan/file.io-Android-Client/blob/master/settings.gradle) | This code snippet, located in the `settings.gradle` file, includes the `app` module in the repository's build process. It ensures that the `app` module is built and included in the final output of the parent repository's architecture. | +| [.travis.yml](https://github.com/rumaan/file.io-Android-Client/blob/master/.travis.yml) | This code snippet in the.travis.yml file defines the configuration for continuous integration on the parent repository. It specifies the required JDK, Android SDK components, and caching directories. |
screenshots -| File | Summary | -| --- | --- | -| [readme.txt](https://github.com/rumaan/file.io-Android-Client/blob/main/screenshots/readme.txt) | The code snippet in the `app` directory of the `file.io-Android-Client` repository serves as the main Android client for accessing and interacting with the file.io platform. It includes build configurations, source code, and test files necessary for the functionality of the app. The codebase relies on various dependencies and software as documented in the `screenshots/readme.txt` file. Additionally, key files such as `readme.txt`, `screenshot.png`, and `todo-ui.png` provide further information and visual representations about the codebase. | +| File | Summary | +| --- | --- | +| [readme.txt](https://github.com/rumaan/file.io-Android-Client/blob/master/screenshots/readme.txt) | This code snippet is part of the file.io Android Client repository. It contributes to the parent repository's architecture by managing and displaying screenshots in the Android app. The code achieves the critical feature of organizing and presenting screenshots to enhance user experience. |
app -| File | Summary | -| --- | --- | -| [proguard-rules.pro](https://github.com/rumaan/file.io-Android-Client/blob/main/app/proguard-rules.pro) | This code snippet adds and configures ProGuard rules in the Android client of the file.io repository. It ensures proper obfuscation and exclusion of certain classes, while preserving necessary attributes for debugging and Crashlytics integration. | -| [build.gradle](https://github.com/rumaan/file.io-Android-Client/blob/main/app/build.gradle) | This code snippet is part of an Android client for the file.io file-sharing service. It applies various plugins and dependencies, including permissions_dispatcher, Firebase Crashlytics, Room, Fuel, Gson, Kotlin, and more. Additionally, it configures build types and sets up necessary dependencies for testing. The code focuses on providing a smooth user experience and robust functionality for file sharing and management. | +| File | Summary | +| --- | --- | +| [proguard-rules.pro](https://github.com/rumaan/file.io-Android-Client/blob/master/app/proguard-rules.pro) | The `proguard-rules.pro` file in the `app` directory of the repository contains project-specific ProGuard rules. It specifies the applied configuration fileEntities and preserves line number and source file information for debugging. It also handles warnings and keeps specific classes and attributes while excluding others. Additionally, it includes rules for the Crashlytics library. | +| [build.gradle](https://github.com/rumaan/file.io-Android-Client/blob/master/app/build.gradle) | This code snippet is a build file for an Android application. It specifies various dependencies for the app, such as appcompat, material design, and Firebase Crashlytics. It also applies plugins for Kotlin and Android extensions. The file is a crucial part of the repository's architecture as it defines the project's configuration and dependencies. |
app.src.androidTest.java.com.thecoolguy.rumaan.fileio -| File | Summary | -| --- | --- | -| [ExampleInstrumentedTest.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/androidTest/java/com/thecoolguy/rumaan/fileio/ExampleInstrumentedTest.kt) | This code snippet is an instrumented test that validates the context of the app under test. It uses the AndroidJUnit4 framework and asserts that the package name matches the expected value. The main role of this code in the repository's architecture is to ensure the correctness of the app's context during testing. | -| [FileEntityDaoTest.java](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/androidTest/java/com/thecoolguy/rumaan/fileio/FileEntityDaoTest.java) | This code snippet is a test suite for the RoomDatabase in the File.io Android Client repository. It tests the functionality of the FileEntityDao, such as counting rows, inserting and retrieving items, and saving multiple items. The tests ensure that the database operations are working correctly. | -| [UploadHistoryInstrumentedTest.java](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/androidTest/java/com/thecoolguy/rumaan/fileio/UploadHistoryInstrumentedTest.java) | This code snippet is an instrumented test for the UploadHistoryActivity in the File.io-Android-Client repository. It sets up the database, adds test data, and tests a long press action. | +| File | Summary | +| --- | --- | +| [ExampleInstrumentedTest.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/androidTest/java/com/thecoolguy/rumaan/fileio/ExampleInstrumentedTest.kt) | This code snippet is an instrumented test for the File.io Android client app. It tests the app's context and asserts that the package name is correct. It is part of the app's testing documentation for Android devices. | +| [FileEntityDaoTest.java](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/androidTest/java/com/thecoolguy/rumaan/fileio/FileEntityDaoTest.java) | This code snippet contains test cases for the RoomDatabase in the Android app. It tests functionalities such as counting the number of rows, inserting and retrieving items from the database. The tests ensure that the database operations are working correctly, by checking various conditions and assertions. | +| [UploadHistoryInstrumentedTest.java](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/androidTest/java/com/thecoolguy/rumaan/fileio/UploadHistoryInstrumentedTest.java) | This code snippet is an Android Instrumentation test for the UploadHistoryActivity. It initializes the UploadHistoryRoomDatabase and adds five FileEntity items to the database. The test method check_longPressItemDelete is empty. |
app.src.test.java.com.thecoolguy.rumaan.fileio -| File | Summary | -| --- | --- | -| [ExampleUnitTest.java](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/test/java/com/thecoolguy/rumaan/fileio/ExampleUnitTest.java) | This code snippet contains a unit test file that checks if the addition operation is correct. It is part of an Android client repository for file.io service. | -| [UploadRepositoryTest.java](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/test/java/com/thecoolguy/rumaan/fileio/UploadRepositoryTest.java) | This code snippet is a test file within the `UploadRepositoryTest` class, located in the `com.thecoolguy.rumaan.fileio` package. It verifies the functionality of the `getExpireUrl` method by comparing the expected URL with the actual URL. The test checks that the expiration parameter is correctly appended to the URL. | -| [UrlTest.java](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/test/java/com/thecoolguy/rumaan/fileio/UrlTest.java) | The code snippet in `UrlTest.java` tests the functionality of `URLParser` in the `Utils` class. It checks if the `parseEncryptUrl` method correctly extracts the base URL from an encrypted URL. The test asserts the expected output with the actual result. | -| [FileEntityTest.java](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/test/java/com/thecoolguy/rumaan/fileio/FileEntityTest.java) | This code snippet is a test file that verifies the functionality of the FileEntity class within the parent repository. It checks if the name and URL values are properly set and retrieved. The test ensures that the FileEntity object is functioning correctly. | +| File | Summary | +| --- | --- | +| [ExampleUnitTest.java](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/test/java/com/thecoolguy/rumaan/fileio/ExampleUnitTest.java) | This code snippet is a unit test that verifies the correctness of addition operation. It is part of the file.io-Android-Client repository and contributes to ensuring the reliability of the application. | +| [UploadRepositoryTest.java](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/test/java/com/thecoolguy/rumaan/fileio/UploadRepositoryTest.java) | This code snippet is a test case that checks if the expire URL is correctly generated by the UploadRepository class. It verifies that the generated URL matches the expected URL and also checks if the generated URL matches the URL created using constant values. | +| [UrlTest.java](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/test/java/com/thecoolguy/rumaan/fileio/UrlTest.java) | This code snippet contains a unit test for the `parseEncryptUrl` method in the `UrlTest` class. The test validates that the method correctly extracts the base URL from an encrypted URL. | +| [FileEntityTest.java](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/test/java/com/thecoolguy/rumaan/fileio/FileEntityTest.java) | This code snippet is a test class named FileEntityTest in the Android client of the file.io repository. It tests the functionality of the FileEntity model by checking if its name and URL can be set and retrieved correctly. |
app.src.main.java.com.thecoolguy.rumaan.fileio.viewmodel -| File | Summary | -| --- | --- | -| [UploadHistoryViewModel.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/viewmodel/UploadHistoryViewModel.kt) | The code snippet is part of the `file.io-Android-Client` repository and is located in the `UploadHistoryViewModel` file. It defines a ViewModel class that retrieves and stores a list of file uploads using a Room database. | +| File | Summary | +| --- | --- | +| [UploadHistoryViewModel.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/viewmodel/UploadHistoryViewModel.kt) | The code snippet represents the UploadHistoryViewModel class in the file UploadHistoryViewModel.kt. It is responsible for managing the upload history feature in the Android app. It retrieves a list of uploaded files from the UploadHistoryRoomDatabase and provides it as LiveData to the UI. |
app.src.main.java.com.thecoolguy.rumaan.fileio.ui -| File | Summary | -| --- | --- | -| [FileioApplication.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/FileioApplication.kt) | This code snippet is a key file in the repository's architecture. It initializes the application and handles logging and error handling. It uses libraries like Timber and Custom Activity on Crash. The code sets up logging and configures a custom error activity for crashes. | -| [UploadHistoryListAdapter.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/UploadHistoryListAdapter.kt) | The `UploadHistoryListAdapter` is a key file in the `file.io-Android-Client` repository. It handles the UI and data binding for displaying a list of uploaded files in a RecyclerView. It uses different view types to display dates and file details, and handles user interactions such as copying file URLs to the clipboard and showing toast messages. | -| [SwipeToDeleteCallBack.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/SwipeToDeleteCallBack.kt) | The `SwipeToDeleteCallBack` class is a key file in the `com.thecoolguy.rumaan.fileio.ui` package. It provides functionality to enable swiping and deleting items in a RecyclerView. It handles the drawing of the delete icon and the red background, as well as the logic for canceling the swipe action. | -| [NotificationHelper.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/NotificationHelper.kt) | The code snippet is a NotificationHelper class that creates and displays a notification for a successful file upload. It sets the notification's content, icon, and behavior, and also handles the creation of a notification channel for devices running Android O and above. The main role of this code is to provide a convenient way to generate and display notifications for file uploads in the app. | +| File | Summary | +| --- | --- | +| [FileioApplication.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/FileioApplication.kt) | The FileioApplication.kt code snippet is responsible for defining the application class for the File.io Android Client repository. It handles initialization tasks such as setting up logging and configuring a custom activity to handle crashes. | +| [UploadHistoryListAdapter.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/UploadHistoryListAdapter.kt) | The UploadHistoryListAdapter code in the Android Client repository is responsible for displaying a list of uploaded files with their corresponding details. It uses two view holders to handle different types of items in the list. The code provides methods for updating the list, handling item clicks, and removing items. | +| [SwipeToDeleteCallBack.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/SwipeToDeleteCallBack.kt) | This code snippet is a SwipeToDeleteCallBack class that handles the swipe-to-delete functionality in a RecyclerView. It provides the necessary methods to draw a background and icon for the delete action, as well as handle user interactions with the swipe gesture. | +| [NotificationHelper.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/NotificationHelper.kt) | This code snippet is responsible for creating a notification and handling its behavior when a file upload is successful in the Android application. It sets up the notification with appropriate content, an intent for further action, and handles compatibility with different Android versions. |
app.src.main.java.com.thecoolguy.rumaan.fileio.ui.fragments -| File | Summary | -| --- | --- | -| [NoNetworkDialogFragment.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/fragments/NoNetworkDialogFragment.kt) | The code snippet is a Kotlin class file named NoNetworkDialogFragment.kt within the com.thecoolguy.rumaan.fileio.ui.fragments package. It creates a dialog fragment that displays an AlertDialog when there is no network connection. It includes a button that triggers a callback to the parent activity when clicked. | -| [HomeFragment.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/fragments/HomeFragment.kt) | The `HomeFragment` class is part of the `file.io-Android-Client` repository. It represents a UI fragment for displaying the main layout of the app and handles user interactions. It has a callback for choosing a file and storing it in the local file object cache. The fragment communicates with its parent activity using the `OnFragmentInteractionListener` interface. | -| [ResultFragment.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/fragments/ResultFragment.kt) | This code snippet is a key file within the ResultFragment package of the Android client app. It handles the logic and UI for displaying the result of a file upload, including the URL and expiration days. Users can copy the link to the clipboard and mark the task as done. | +| File | Summary | +| --- | --- | +| [NoNetworkDialogFragment.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/fragments/NoNetworkDialogFragment.kt) | This code snippet defines a dialog fragment that displays a no network error message to the user. It allows the user to click on the OK button to dismiss the dialog. The fragment communicates with the parent activity using a custom listener interface. This code contributes to the user interface components of the Android client application in the file.io-Android-Client repository. | +| [HomeFragment.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/fragments/HomeFragment.kt) | This code snippet represents the HomeFragment class in the file.io-Android-Client repository. It defines the user interface and interactions for the home screen of the file.io Android app. Users can choose a file to upload through a button click. The fragment communicates with the parent activity through a listener interface. | +| [ResultFragment.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/fragments/ResultFragment.kt) | This code snippet represents the ResultFragment class in the file.io-Android-Client repository. It is responsible for displaying the result of a file upload, including the URL and expiration days. Users can copy the URL to the clipboard and mark the upload as done. |
app.src.main.java.com.thecoolguy.rumaan.fileio.ui.activities -| File | Summary | -| --- | --- | -| [MainActivity.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/activities/MainActivity.kt) | The code snippet represents the MainActivity file in the file.io-Android-Client repository. It handles various activities and fragments, including file uploads, displaying results, and handling permissions. | -| [ErrorActivity.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/activities/ErrorActivity.kt) | This code snippet represents the ErrorActivity class within the Android client of the file.io project. It is responsible for displaying an error screen in case of runtime crashes and allows users to exit the app. Its main features include handling the back button press and setting the error view layout. | -| [UploadHistoryActivity.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/activities/UploadHistoryActivity.kt) | This code snippet represents the `UploadHistoryActivity` file in the `file.io-Android-Client` repository. It is responsible for displaying and managing the upload history in the app, including clearing the history and deleting individual items. It uses various components like RecyclerView, ViewModel, WorkManager, and Snackbar for a smooth user experience. | -| [AboutActivity.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/activities/AboutActivity.kt) | The code snippet is a key file in the repository's architecture. It defines the behavior of the About screen in the Android app, including menu options and navigation to the License screen. | -| [LicenseActivity.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/activities/LicenseActivity.kt) | This code snippet is responsible for displaying a list of open source licenses in the LicenseActivity of the Android app. It uses MaterialAboutLibrary to create license cards for various libraries used in the app, including AOSP Support Libraries, Architecture Components, Fuel, and more. | +| File | Summary | +| --- | --- | +| [MainActivity.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/activities/MainActivity.kt) | This code snippet is the implementation of the main activity in the Android client of the file.io repository. It handles UI interactions, file upload, and navigation between fragments. | +| [ErrorActivity.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/activities/ErrorActivity.kt) | This code snippet defines the ErrorActivity class in the Android client of the file.io repository. It handles runtime crashes and displays an error screen. It includes methods for handling back button presses and initializing the activity. | +| [UploadHistoryActivity.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/activities/UploadHistoryActivity.kt) | This code snippet is part of the Android client for the file.io repository. It represents the UploadHistoryActivity, which displays the user's upload history. It allows the user to clear the history and delete individual items using swipe gestures. The activity also dynamically updates the UI based on the changes in the upload history data. | +| [AboutActivity.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/activities/AboutActivity.kt) | This code snippet is the implementation of the AboutActivity in the file.io Android client repository. It defines the behavior and layout of the About screen, including the options menu and navigation to the LicenseActivity. | +| [LicenseActivity.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/ui/activities/LicenseActivity.kt) | This code snippet is a part of the File.io Android client repository. It implements the LicenseActivity, which displays a list of open source licenses used in the app. The activity extends MaterialAboutActivity and creates license cards for different libraries used in the app. |
app.src.main.java.com.thecoolguy.rumaan.fileio.repository -| File | Summary | -| --- | --- | -| [UploadHistoryWorkers.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/repository/UploadHistoryWorkers.kt) | This code snippet contains two worker classes (`ClearHistoryWorker` and `DeleteSingleItemWorker`) that handle clearing and deleting items from the upload history database in the parent Android client repository. The workers are responsible for interacting with the `UploadHistoryRoomDatabase` and performing the necessary operations for clearing all items or deleting a single item based on the provided ID. | -| [UploadWorker.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/repository/UploadWorker.kt) | The `UploadWorker.kt` file in the `com.thecoolguy.rumaan.fileio.repository` package is responsible for uploading files to a server using Fuel library and WorkManager. It handles file uploads, saves the upload history to a database, and sends a notification about the upload progress. | +| File | Summary | +| --- | --- | +| [UploadHistoryWorkers.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/repository/UploadHistoryWorkers.kt) | These code snippets are part of the `file.io-Android-Client` repository. The `ClearHistoryWorker` and `DeleteSingleItemWorker` classes handle clearing the upload history and deleting a single item respectively, using the UploadHistoryRoomDatabase. | +| [UploadWorker.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/repository/UploadWorker.kt) | This code snippet is part of the file.io-Android-Client repository and is located in the UploadWorker.kt file. It handles the uploading of files to the file.io server, saving the file details in the local database, and creating a notification for the upload. The code utilizes the Fuel library for making HTTP requests and the WorkManager framework for managing background tasks. |
app.src.main.java.com.thecoolguy.rumaan.fileio.utils -| File | Summary | -| --- | --- | -| [Extensions.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/Extensions.kt) | The code snippet in the `Extensions.kt` file provides utility functions to display toast messages and toggle the clickable state of a view in an Android application. These functions enhance user interaction and provide feedback. | -| [WorkManagerHelper.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/WorkManagerHelper.kt) | This code snippet in the file `WorkManagerHelper.kt` is responsible for creating and configuring an upload work request using the Android WorkManager library. The request includes constraints for network connectivity and data input. The request is associated with the `UploadWorker` class and is tagged with the `UPLOAD_WORK_TAG`. | -| [Utils.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/Utils.kt) | This code snippet provides a set of helper methods for various tasks such as retrieving file details, opening files, checking network connectivity, showing dialogs, copying text to clipboard, and parsing URLs and JSON. It is part of the Android client for the file.io repository and enhances the app's functionality. | -| [Helpers.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/Helpers.kt) | This code snippet contains helper functions that retrieve file metadata, get file details, and compose a FileEntity object. These functions are used in the Android Client repository to handle file operations and data manipulation. | -| [FragmentHelperExtensions.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/FragmentHelperExtensions.kt) | This code snippet provides utility functions for adding and replacing fragments in an Android app. It helps manage the view hierarchy and transitions between fragments, enhancing the user experience. | -| [MaterialIn.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/MaterialIn.kt) | The code snippet in the `MaterialIn.kt` file is part of the `file.io-Android-Client` repository. It provides a utility function to animate views using material design principles, including fading and sliding effects. The code determines the animation direction based on gravity and implements the animation using `ObjectAnimator`. | -| [Constants.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/Constants.kt) | This code snippet provides global constants for the Android client of the file.io repository. It includes base URLs, expiration parameters, default values, and timestamp formats. It also defines GitHub and Twitter URLs and an email address. The snippet is located in the `utils` package. | +| File | Summary | +| --- | --- | +| [Extensions.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/Extensions.kt) | This code snippet in the Extensions.kt file provides two extension functions. The first function allows a string to display a toast message, while the second function toggles the clickability of a view. These functions enhance the functionality of the parent repository's Android client app by providing convenient utilities for displaying messages and modifying view behavior. | +| [WorkManagerHelper.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/WorkManagerHelper.kt) | This code snippet provides a helper function that creates a one-time work request for uploading a file. It includes the necessary constraints, such as requiring a connected network, and sets the input data and tags for the work request. | +| [Utils.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/Utils.kt) | This code snippet provides a collection of utility methods for various tasks in an Android app. It includes methods for getting file details, opening file streams, checking network connectivity, showing dialogs, copying text to clipboard, parsing URLs and JSON, and handling dates. These utility methods can be used to simplify common tasks in the parent repository's architecture. | +| [Helpers.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/Helpers.kt) | This code snippet in the parent repository's architecture is located at app/src/main/java/com/thecoolguy/rumaan/fileio/utils/Helpers.kt. It contains functions to retrieve file metadata, get file details, and compose them into a file entity. These functions are crucial for handling file operations in the app. | +| [FragmentHelperExtensions.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/FragmentHelperExtensions.kt) | These code snippets in the FragmentHelperExtensions.kt file provide extension functions for the FragmentManager class in the Android app. The functions addFragment and replaceFragment allow easy addition and replacement of fragments in a given container. | +| [MaterialIn.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/MaterialIn.kt) | The code snippet in MaterialIn.kt is responsible for animating the entrance of a view in the File.io-Android-Client repository. It uses various animations like slide and fade to give a material design effect. The main function animate triggers the animation on a given view using delay and slide directions. The code handles RTL (Right-to-Left) languages as well. | +| [Constants.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/utils/Constants.kt) | The code snippet defines global constants for the file.io Android client. It includes the base URL, parameters, default expiration weeks, and timestamp format. It also defines constants for Github and Twitter URLs and an email address. The constants are used throughout the codebase for consistent values. |
app.src.main.java.com.thecoolguy.rumaan.fileio.listeners -| File | Summary | -| --- | --- | -| [DialogClickListener.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/listeners/DialogClickListener.kt) | This code snippet defines an interface called DialogClickListener in the listeners package. It provides a method for handling positive button clicks in a dialog. Its purpose is to enable communication between dialogs and fragments in the file.io-Android-Client repository. | -| [OnFragmentInteractionListener.kt](https://github.com/rumaan/file.io-Android-Client/blob/main/app/src/main/java/com/thecoolguy/rumaan/fileio/listeners/OnFragmentInteractionListener.kt) | This code snippet, located in the `com.thecoolguy.rumaan.fileio.listeners` package, defines an interface called `OnFragmentInteractionListener`. It has two functions: `onUploadFileClick()` and `onDone()`. This interface is part of the larger Android Client codebase for the File.io application. | +| File | Summary | +| --- | --- | +| [DialogClickListener.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/listeners/DialogClickListener.kt) | This code snippet defines an interface called DialogClickListener that is responsible for handling positive click events on a dialog. It takes a Dialog and a DialogFragment as parameters and does not specify any return value. It is a part of the file.io-Android-Client repository and is located in the file DialogClickListener.kt. | +| [OnFragmentInteractionListener.kt](https://github.com/rumaan/file.io-Android-Client/blob/master/app/src/main/java/com/thecoolguy/rumaan/fileio/listeners/OnFragmentInteractionListener.kt) | This code snippet defines an interface called OnFragmentInteractionListener, which contains two functions: onUploadFileClick() and onDone(). These functions handle user interactions within a fragment, specifically for the purpose of uploading a file and completing an action. This interface is part of the file.io-Android-Client repository's architecture and is used to enable communication between fragments and their parent activities. |
@@ -230,9 +227,7 @@ The file.io-Android-Client project is an Android app that provides a convenient Ensure you have the following dependencies installed on your system: -* Kotlin: `โ–บ INSERT-VERSION-HERE` -* `โ–บ ...` -* `โ–บ ...` +* **Kotlin**: x.y.z ### โš™๏ธ Installation @@ -277,9 +272,9 @@ gradle test Contributions are welcome! Here are several ways you can contribute: -- **[Submit Pull Requests](https://github.com/rumaan/file.io-Android-Client/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs. -- **[Join the Discussions](https://github.com/rumaan/file.io-Android-Client/discussions)**: Share your insights, provide feedback, or ask questions. -- **[Report Issues](https://github.com/rumaan/file.io-Android-Client/issues)**: Submit bugs found or log feature requests for file.io-Android-Client. +- **[Submit Pull Requests](https://github/rumaan/file.io-Android-Client/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs. +- **[Join the Discussions](https://github/rumaan/file.io-Android-Client/discussions)**: Share your insights, provide feedback, or ask questions. +- **[Report Issues](https://github/rumaan/file.io-Android-Client/issues)**: Submit bugs found or log feature requests for File.io-android-client.
Contributing Guidelines @@ -287,11 +282,11 @@ Contributions are welcome! Here are several ways you can contribute: 1. **Fork the Repository**: Start by forking the project repository to your GitHub account. 2. **Clone Locally**: Clone the forked repository to your local machine using a Git client. ```sh - git clone + git clone https://github.com/rumaan/file.io-Android-Client ``` 3. **Create a New Branch**: Always work on a new branch, giving it a descriptive name. ```sh - git checkout -b new-feature-x + git checkout -b feature/new-feature-x ``` 4. **Make Your Changes**: Develop and test your changes locally. 5. **Commit Your Changes**: Commit with a clear and concise message describing your updates. @@ -300,7 +295,7 @@ Contributions are welcome! Here are several ways you can contribute: ``` 6. **Push to GitHub**: Push the changes to your forked repository. ```sh - git push origin new-feature-x + git push origin feature/new-feature-x ``` 7. **Submit a Pull Request**: Create a PR against the original project repository. Clearly describe the changes and their motivations. diff --git a/examples/markdown/readme-postgres.md b/examples/markdown/readme-postgres.md new file mode 100644 index 00000000..78a72a25 --- /dev/null +++ b/examples/markdown/readme-postgres.md @@ -0,0 +1,286 @@ +

+ +

+

+

BUENAVISTA

+

+

+ Unleash the Power of Programmable Proxies! +

+

+ license + last-commit + repo-top-language + repo-language-count +

+

+ Developed with the software and tools below. +

+

+ DuckDB + GNU%20Bash + YAML + PostgreSQL + Python +
+ Docker + GitHub%20Actions + Pytest + FastAPI +

+
+ +## ๐Ÿ”— Quick Links + +> - [๐Ÿ“ Overview](#-overview) +> - [๐Ÿ“ฆ Features](#-features) +> - [๐Ÿ“‚ Repository Structure](#-repository-structure) +> - [๐Ÿงฉ Modules](#-modules) +> - [๐Ÿš€ Getting Started](#-getting-started) +> - [โš™๏ธ Installation](#-installation) +> - [๐Ÿค– Running buenavista](#-running-buenavista) +> - [๐Ÿงช Tests](#-tests) +> - [๐Ÿ›  Project Roadmap](#-project-roadmap) +> - [๐Ÿค Contributing](#-contributing) +> - [๐Ÿ“„ License](#-license) +> - [๐Ÿ‘ Acknowledgments](#-acknowledgments) + +--- + +## ๐Ÿ“ Overview + +Buenavista is a project that aims to provide a programmable proxy for Presto and Postgres. It allows users to enhance and customize the behavior of these database systems by intercepting and modifying queries in-flight. With its ability to programmatically transform queries, apply filtering and routing rules, and inject custom logic, Buenavista empowers developers to create flexible and efficient data access layers. Combining the power of FastAPI and the versatility of SQL, this project provides a valuable tool for optimizing and managing data pipelines. + +--- + +## Features + +| | Feature | Description | +|----|-------------------|---------------------------------------------------------------| +| โš™๏ธ | **Architecture** | The project has a modular architecture that uses FastAPI and DuckDB to create programmable Presto and Postgres proxies. It leverages Python, SQL, and YAML to provide an efficient and flexible solution for data processing and analysis. | +| ๐Ÿ”ฉ | **Code Quality** | The codebase follows good quality practices and adheres to PEP 8 style guidelines. It is well-structured, readable, and maintainable. | +| ๐Ÿ“„ | **Documentation** | The project has comprehensive documentation, including a README file and a well-documented setup.py file. The documentation provides details about installation, usage, and configuration options. | +| ๐Ÿ”Œ | **Integrations** | Key integrations and external dependencies include FastAPI, DuckDB, Pydantic, PyArrow, and psycopg. These libraries are used to handle HTTP requests, execute SQL queries, validate and serialize data, and interact with databases. | +| ๐Ÿงฉ | **Modularity** | The codebase is highly modular, allowing for easy extension and reuse of components. It follows the principles of separation of concerns and single responsibility, improving maintainability and scalability. | +| ๐Ÿงช | **Testing** | The project uses pytest as the testing framework. It includes a set of tests that cover different functionalities and ensure the correctness of the code. | +| โšก๏ธ | **Performance** | The project leverages DuckDB's in-memory columnar storage and vectorized query processing, resulting in excellent performance and low resource usage. | +| ๐Ÿ›ก๏ธ | **Security** | The project does not explicitly mention security measures, but the use of authentication middleware in FastAPI and secure database connections can be implemented for data protection and access control. | +| ๐Ÿ“ฆ | **Dependencies** | Key external libraries and dependencies include FastAPI, DuckDB, Pydantic, PyArrow, and psycopg. These libraries provide essential functionality for handling HTTP requests, executing SQL queries, data serialization, and database interactions. | + + +--- + +## Repository Structure + +```sh +โ””โ”€โ”€ buenavista/ + โ”œโ”€โ”€ .github + โ”‚ โ””โ”€โ”€ workflows + โ”‚ โ”œโ”€โ”€ main.yml + โ”‚ โ””โ”€โ”€ push.yaml + โ”œโ”€โ”€ buenavista + โ”‚ โ”œโ”€โ”€ backends + โ”‚ โ”‚ โ”œโ”€โ”€ duckdb.py + โ”‚ โ”‚ โ””โ”€โ”€ postgres.py + โ”‚ โ”œโ”€โ”€ bv_dialects.py + โ”‚ โ”œโ”€โ”€ core.py + โ”‚ โ”œโ”€โ”€ examples + โ”‚ โ”‚ โ”œโ”€โ”€ duckdb_http.py + โ”‚ โ”‚ โ”œโ”€โ”€ duckdb_postgres.py + โ”‚ โ”‚ โ””โ”€โ”€ postgres_proxy.py + โ”‚ โ”œโ”€โ”€ http + โ”‚ โ”‚ โ”œโ”€โ”€ context.py + โ”‚ โ”‚ โ”œโ”€โ”€ main.py + โ”‚ โ”‚ โ”œโ”€โ”€ schemas.py + โ”‚ โ”‚ โ””โ”€โ”€ type_mapping.py + โ”‚ โ”œโ”€โ”€ postgres.py + โ”‚ โ””โ”€โ”€ rewrite.py + โ”œโ”€โ”€ dev-requirements.txt + โ”œโ”€โ”€ docker + โ”‚ โ”œโ”€โ”€ Dockerfile + โ”‚ โ”œโ”€โ”€ Makefile + โ”‚ โ”œโ”€โ”€ docker-compose.yml + โ”‚ โ””โ”€โ”€ download_data.sh + โ””โ”€โ”€ setup.py +``` + +--- + +## Modules + +
. + +| File | Summary | +| --- | --- | +| [dev-requirements.txt](https://github.com/jwills/buenavista/blob/master/dev-requirements.txt) | This code snippet, located in the `dev-requirements.txt` file, specifies the required development dependencies for the Buenavista repository. These dependencies include libraries and tools such as DuckDB, FastAPI, psycopg, PyArrow, Pydantic, pytest, and sqlglot. | +| [setup.py](https://github.com/jwills/buenavista/blob/master/setup.py) | This code snippet, located in the `setup.py` file, is responsible for setting up the configuration and dependencies for the Buenavista repository. It defines the package name, version, description, author, and other details. Additionally, it specifies the required packages and their versions. | + +
+ +
docker + +| File | Summary | +| --- | --- | +| [download_data.sh](https://github.com/jwills/buenavista/blob/master/docker/download_data.sh) | The code snippet `docker/download_data.sh` is responsible for downloading example data (specifically `iris.parquet` and `chinook.db`) to the `./data` directory. This script uses `curl` to fetch the files and `unzip` to extract the `chinook.db` file from a ZIP archive. | +| [Dockerfile](https://github.com/jwills/buenavista/blob/master/docker/Dockerfile) | This code snippet, located in the `docker/Dockerfile` file, sets up the Docker container for the Buenavista repository. It installs dependencies, builds and installs the repository, and exposes port 5433. The container's entry point runs the `duckdb_postgres` example. | +| [Makefile](https://github.com/jwills/buenavista/blob/master/docker/Makefile) | This code snippet, located in the docker/Makefile file, provides commands to build the buenavista Docker image, start the Docker container, and download example data. It is a part of the overall repository structure, contributing to the deployment and setup process of the buenavista project. | +| [docker-compose.yml](https://github.com/jwills/buenavista/blob/master/docker/docker-compose.yml) | The code snippet in the docker-compose.yml file sets up and configures two services: cloudbeaver and buenavista. It specifies the Docker images to use for each service and defines their respective ports and environment variables. This code is critical for deploying and running the repository's services in a Docker environment. | + +
+ +
buenavista + +| File | Summary | +| --- | --- | +| [bv_dialects.py](https://github.com/jwills/buenavista/blob/master/buenavista/bv_dialects.py) | The code snippet in `bv_dialects.py` adds additional expressions and custom modifications to dialects in the parent repository. It introduces a new expression `ToISO8601` and makes Trino and DuckDB specific modifications. | +| [core.py](https://github.com/jwills/buenavista/blob/master/buenavista/core.py) | The code snippet in core.py defines the main classes for the BV representation of a query result and the translation layer from an upstream data source. It also includes auxiliary classes for query results and extensions. | +| [postgres.py](https://github.com/jwills/buenavista/blob/master/buenavista/postgres.py) | The code snippet in `buenavista/postgres.py` is responsible for handling PostgreSQL database connections and executing queries. It includes functions for connecting to the database, executing queries, and handling query results. The code also imports necessary modules and defines logger. | +| [rewrite.py](https://github.com/jwills/buenavista/blob/master/buenavista/rewrite.py) | This code snippet contains a class called `Rewriter` that is responsible for rewriting SQL queries based on defined relations. It utilizes the `sqlglot` library to parse and generate SQL queries for different dialects. The `Rewriter` class has methods for defining relations and rewriting SQL queries by transforming the query expressions. The main function demonstrates the usage of the `Rewriter` class by defining a relation and rewriting a SQL query. | + +
+ +
buenavista.backends + +| File | Summary | +| --- | --- | +| [postgres.py](https://github.com/jwills/buenavista/blob/master/buenavista/backends/postgres.py) | This code snippet, located at `buenavista/backends/postgres.py`, provides a PostgreSQL implementation for Buenavista's backends. It defines classes for executing SQL queries, managing sessions, and converting query results. | +| [duckdb.py](https://github.com/jwills/buenavista/blob/master/buenavista/backends/duckdb.py) | The code snippet in `buenavista/backends/duckdb.py` defines classes and functions for interacting with a DuckDB database. It includes methods for converting data types, executing SQL queries, and managing sessions. The classes `DuckDBQueryResult`, `DuckDBSession`, and `DuckDBConnection` are the core components responsible for handling database operations. | + +
+ +
buenavista.http + +| File | Summary | +| --- | --- | +| [type_mapping.py](https://github.com/jwills/buenavista/blob/master/buenavista/http/type_mapping.py) | This code snippet in `buenavista/http/type_mapping.py` defines a type mapping dictionary and helper functions for converting data types between different systems. It provides mappings for various data types and allows converting types to Trino-specific formats. These mappings are used in the parent repository's HTTP module for type conversion and handling. | +| [context.py](https://github.com/jwills/buenavista/blob/master/buenavista/http/context.py) | This code snippet defines the `Context` class, which manages the request context for HTTP API calls in the Buenavista repository. It handles request headers, manages session pooling for database connections, executes SQL queries, and manages transaction IDs. | +| [schemas.py](https://github.com/jwills/buenavista/blob/master/buenavista/http/schemas.py) | This code snippet in schemas.py defines several Pydantic models and type annotations used for handling HTTP requests and responses in the Buenavista repository. It includes models for various query result structures, column definitions, statement statistics, and error handling. These models help ensure data consistency and facilitate communication between the backend and frontend components of the architecture. | +| [main.py](https://github.com/jwills/buenavista/blob/master/buenavista/http/main.py) | This code snippet is a part of the buenavista repository and contains the implementation for a FastAPI endpoint. It handles HTTP requests for executing SQL statements, converting the query results into a standardized format, and returning the results as JSON. The code also includes error handling and supports extensions for additional functionality. | + +
+ +
buenavista.examples + +| File | Summary | +| --- | --- | +| [duckdb_postgres.py](https://github.com/jwills/buenavista/blob/master/buenavista/examples/duckdb_postgres.py) | This code snippet in duckdb_postgres.py is responsible for rewriting SQL queries in a DuckDB-PG compatibility layer. It creates a BuenaVista server that listens on a specified IP address and port, connects to a DuckDB database, and handles incoming queries. The rewriter modifies specific SQL queries, while the create function initializes the server with the necessary parameters. | +| [duckdb_http.py](https://github.com/jwills/buenavista/blob/master/buenavista/examples/duckdb_http.py) | This code snippet is a part of the Buenavista repository and resides in the buenavista/examples/duckdb_http.py file. It sets up a FastAPI app with a DuckDB connection and rewriter for handling SQL queries. It also defines relations for various JDBC tables. The app runs on a specified host and port using uvicorn. | +| [postgres_proxy.py](https://github.com/jwills/buenavista/blob/master/buenavista/examples/postgres_proxy.py) | This code snippet in `buenavista/examples/postgres_proxy.py` sets up a proxy server to connect to a PostgreSQL database. It creates a `BuenaVistaServer` instance and listens on a specified address, forwarding requests to the PostgreSQL backend. The proxy server allows clients to interact with the database through a different interface. | + +
+ +
.github.workflows + +| File | Summary | +| --- | --- | +| [push.yaml](https://github.com/jwills/buenavista/blob/master/.github/workflows/push.yaml) | This code snippet is a GitHub Actions workflow file (.github/workflows/push.yaml) that is responsible for automating the process of building and pushing changes to the repository. It ensures that any changes made to the codebase are automatically built and deployed to the appropriate environment. | +| [main.yml](https://github.com/jwills/buenavista/blob/master/.github/workflows/main.yml) | This code snippet is located in the `.github/workflows/main.yml` file. It plays a critical role in the repository's architecture as it defines the workflow automation for the repository. It specifies the steps to be executed whenever changes are pushed to the repository, ensuring efficient and automated processes. | + +
+ +--- + +## Getting Started + +***Requirements*** + +Ensure you have the following dependencies installed on your system: + +* **Python**: `version x.y.z` + +### Installation + +1. Clone the buenavista repository: + +```sh +git clone https://github.com/jwills/buenavista +``` + +2. Change to the project directory: + +```sh +cd buenavista +``` + +3. Install the dependencies: + +```sh +pip install -r requirements.txt +``` + +### Running buenavista + +Use the following command to run buenavista: + +```sh +python main.py +``` + +### Tests + +To execute tests, run: + +```sh +pytest +``` + +--- + +## Project Roadmap + +- [X] `โ–บ INSERT-TASK-1` +- [ ] `โ–บ INSERT-TASK-2` +- [ ] `โ–บ ...` + +--- + +## Contributing + +Contributions are welcome! Here are several ways you can contribute: + +- **[Submit Pull Requests](https://github/jwills/buenavista/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs. +- **[Join the Discussions](https://github/jwills/buenavista/discussions)**: Share your insights, provide feedback, or ask questions. +- **[Report Issues](https://github/jwills/buenavista/issues)**: Submit bugs found or log feature requests for Buenavista. + +
+ Contributing Guidelines + +1. **Fork the Repository**: Start by forking the project repository to your GitHub account. +2. **Clone Locally**: Clone the forked repository to your local machine using a Git client. + ```sh + git clone https://github.com/jwills/buenavista + ``` +3. **Create a New Branch**: Always work on a new branch, giving it a descriptive name. + ```sh + git checkout -b new-feature-x + ``` +4. **Make Your Changes**: Develop and test your changes locally. +5. **Commit Your Changes**: Commit with a clear message describing your updates. + ```sh + git commit -m 'Implemented new feature x.' + ``` +6. **Push to GitHub**: Push the changes to your forked repository. + ```sh + git push origin new-feature-x + ``` +7. **Submit a Pull Request**: Create a PR against the original project repository. Clearly describe the changes and their motivations. + +Once your PR is reviewed and approved, it will be merged into the main branch. + +
+ +--- + +## License + +This project is protected under the [SELECT-A-LICENSE](https://choosealicense.com/licenses) License. For more details, refer to the [LICENSE](https://choosealicense.com/licenses/) file. + +--- + +## Acknowledgments + +- List any resources, contributors, inspiration, etc. here. + +[**Return**](#-quick-links) + +--- diff --git a/examples/markdown/readme-python.md b/examples/markdown/readme-python.md index 69bc9456..b649c90a 100644 --- a/examples/markdown/readme-python.md +++ b/examples/markdown/readme-python.md @@ -1,73 +1,73 @@ -

- +

README-AI

- AI-powered Readme Genius: Your Code, Our Words + Empower your READMEs with AI simplicity.

- license - last-commit - repo-top-language - repo-language-count + license + last-commit + repo-top-language + repo-language-count

- Developed with the software and tools below + Developed with the software and tools below.

- GNU%20Bash - tqdm - YAML - Poetry - OpenAI + GNU%20Bash + tqdm + YAML + Poetry + OpenAI
- Python - AIOHTTP - Docker - GitHub%20Actions - Pytest

-
+ Python + AIOHTTP + Docker + GitHub%20Actions + Pytest +


## ๐Ÿ”— Quick Links -- [๐Ÿ”— Quick Links](#-quick-links) -- [๐Ÿ“ Overview](#-overview) -- [๐Ÿ“ฆ Features](#-features) -- [๐Ÿ“‚ Repository Structure](#-repository-structure) -- [๐Ÿงฉ Modules](#modules) -- [๐Ÿš€ Getting Started](#-getting-started) - - [โš™๏ธ Installation](#-installation) - - [๐Ÿค– Running readme-ai](#-running-readme-ai) - - [๐Ÿงช Tests](#-tests) -- [๐Ÿ›  Roadmap](#-roadmap) -- [๐Ÿค Contributing](#-contributing) -- [๐Ÿ“„ License](#-license) -- [๐Ÿ‘ Acknowledgments](#-acknowledgments) + +> - [๐Ÿ“ Overview](#-overview) +> - [๐Ÿ“ฆ Features](#-features) +> - [๐Ÿ“‚ Repository Structure](#-repository-structure) +> - [๐Ÿงฉ Modules](#-modules) +> - [๐Ÿš€ Getting Started](#-getting-started) +> - [โš™๏ธ Installation](#-installation) +> - [๐Ÿค– Running readme-ai](#-running-readme-ai) +> - [๐Ÿงช Tests](#-tests) +> - [๐Ÿ›  Project Roadmap](#-project-roadmap) +> - [๐Ÿค Contributing](#-contributing) +> - [๐Ÿ“„ License](#-license) +> - [๐Ÿ‘ Acknowledgments](#-acknowledgments) --- ## ๐Ÿ“ Overview -Readme-ai is a project that aims to simplify the process of creating high-quality README files for software projects. It provides a user-friendly interface that allows developers to easily generate README templates and customize them with relevant information such as project description, installation instructions, usage examples, and more. By automating the creation of README files, readme-ai saves developers time and effort, enabling them to focus on code development and project management. With its intuitive design and comprehensive template options, readme-ai streamlines the documentation process and enhances the overall visibility and understanding of software projects. +Readme-ai is a project that offers an AI-powered solution for generating high-quality README files for software projects. It leverages natural language processing and machine learning techniques to provide developers with an efficient way to create comprehensive and informative documentation. By analyzing the codebase and extracting key information, readme-ai automatically generates README files that include project description, installation instructions, usage examples, and more. With its ability to understand the structure and purpose of the code, readme-ai significantly reduces the time and effort required for developers to create and maintain README files, thereby enhancing collaboration and improving the overall user experience. --- ## ๐Ÿ“ฆ Features -| | Feature | Description | -|----|--------------------|--------------------------------------------------------------------------------------------------------------------| -| โš™๏ธ | **Architecture** | The codebase follows a simple and straightforward architectural design with a client-server model using Node.js and Express.js for the back-end and React for the front-end. | -| ๐Ÿ“„ | **Documentation** | The codebase includes a decent amount of comments and README files, but lacks comprehensive documentation for installation and usage. | -| ๐Ÿ”— | **Dependencies** | The project relies on popular and commonly used libraries such as React, Express.js, and Node.js. | -| ๐Ÿงฉ | **Modularity** | The codebase is modularized, separating back-end and front-end code, with clear folder structures and file naming conventions for different functionality. | -| ๐Ÿงช | **Testing** | No testing strategies or tools are evident in the codebase. Adding unit tests and integration tests would increase code reliability and maintainability. | -| โšก๏ธ | **Performance** | There are no specific optimizations or performance measurements implemented in the codebase. Performance improvements can be made by optimizing API calls and reducing unnecessary computations. | -| ๐Ÿ” | **Security** | The codebase lacks explicit security measures. Implementing authentication and authorization mechanisms, as well as input validation and protection against common web vulnerabilities, would enhance security. | -| ๐Ÿ”€ | **Version Control**| The codebase uses Git for version control, with a well-structured commit history providing a clear timeline of changes. | -| ๐Ÿ”Œ | **Integrations** | The system interacts with GitHub API to fetch repository data and display it in the front-end UI. However, there are no other notable integrations with external systems or APIs. | +| | Feature | Description | +|----|-------------------|---------------------------------------------------------------| +| โš™๏ธ | **Architecture** | The project's architecture is not explicitly described in the repository. However, it appears to follow a modular design pattern, with separate files and modules for different functionalities. | +| ๐Ÿ”ฉ | **Code Quality** | The code quality and style appear to be well-maintained, with consistent formatting and adherence to best practices. The codebase follows Python conventions, making it readable and maintainable. | +| ๐Ÿ“„ | **Documentation** | The documentation is extensive and well-documented. The repository contains a detailed README.md file, providing an overview of the project and instructions on installation, usage, and configuration. | +| ๐Ÿ”Œ | **Integrations** | The project has integration with GitHub Actions, which enables automated workflows, such as running tests and generating code coverage reports. The project also has integration with Pytest and OpenAI for testing and language processing functionalities, respectively. | +| ๐Ÿงฉ | **Modularity** | The codebase demonstrates good modularity and reusability. It is organized into separate modules and functions, allowing for easy component isolation and code reuse. | +| ๐Ÿงช | **Testing** | The project uses Pytest as the testing framework. It also integrates with GitHub Actions to automatically run tests on each push or pull request, ensuring code quality and reliability. | +| โšก๏ธ | **Performance** | The efficiency, speed, and resource usage of the project are not explicitly discussed in the repository. However, the use of Python and related libraries suggests that it is designed to be performant. | +| ๐Ÿ›ก๏ธ | **Security** | The repository does not explicitly mention measures for data protection and access control. However, it is always recommended to follow security best practices while handling sensitive data. | +| ๐Ÿ“ฆ | **Dependencies** | The project has multiple external dependencies, including pytest, PyYaml, aiohttp, and OpenAI's library. These libraries provide additional functionalities and support for various operations. | + --- @@ -75,40 +75,40 @@ Readme-ai is a project that aims to simplify the process of creating high-qualit ```sh โ””โ”€โ”€ readme-ai/ - โ”œโ”€โ”€ .github/ + โ”œโ”€โ”€ .github โ”‚ โ”œโ”€โ”€ release-drafter.yml - โ”‚ โ””โ”€โ”€ workflows/ + โ”‚ โ””โ”€โ”€ workflows โ”‚ โ”œโ”€โ”€ coverage.yml โ”‚ โ”œโ”€โ”€ release-drafter.yml โ”‚ โ””โ”€โ”€ release-pipeline.yml โ”œโ”€โ”€ Dockerfile โ”œโ”€โ”€ Makefile - โ”œโ”€โ”€ examples/ - โ”‚ โ”œโ”€โ”€ images/ - โ”‚ โ””โ”€โ”€ markdown/ + โ”œโ”€โ”€ examples โ”œโ”€โ”€ noxfile.py โ”œโ”€โ”€ poetry.lock โ”œโ”€โ”€ pyproject.toml - โ”œโ”€โ”€ readmeai/ - โ”‚ โ”œโ”€โ”€ cli/ + โ”œโ”€โ”€ readmeai + โ”‚ โ”œโ”€โ”€ cli โ”‚ โ”‚ โ”œโ”€โ”€ commands.py โ”‚ โ”‚ โ””โ”€โ”€ options.py - โ”‚ โ”œโ”€โ”€ config/ + โ”‚ โ”œโ”€โ”€ config + โ”‚ โ”‚ โ”œโ”€โ”€ enums.py โ”‚ โ”‚ โ””โ”€โ”€ settings.py - โ”‚ โ”œโ”€โ”€ core/ + โ”‚ โ”œโ”€โ”€ core โ”‚ โ”‚ โ”œโ”€โ”€ factory.py โ”‚ โ”‚ โ”œโ”€โ”€ logger.py โ”‚ โ”‚ โ”œโ”€โ”€ model.py โ”‚ โ”‚ โ”œโ”€โ”€ preprocess.py - โ”‚ โ”‚ โ””โ”€โ”€ tokens.py + โ”‚ โ”‚ โ”œโ”€โ”€ tokens.py + โ”‚ โ”‚ โ””โ”€โ”€ utils.py โ”‚ โ”œโ”€โ”€ main.py - โ”‚ โ”œโ”€โ”€ markdown/ + โ”‚ โ”œโ”€โ”€ markdown โ”‚ โ”‚ โ”œโ”€โ”€ badges.py - โ”‚ โ”‚ โ”œโ”€โ”€ headers.py + โ”‚ โ”‚ โ”œโ”€โ”€ builder.py โ”‚ โ”‚ โ”œโ”€โ”€ quickstart.py โ”‚ โ”‚ โ”œโ”€โ”€ tables.py โ”‚ โ”‚ โ””โ”€โ”€ tree.py - โ”‚ โ”œโ”€โ”€ parsers/ + โ”‚ โ”œโ”€โ”€ parsers โ”‚ โ”‚ โ”œโ”€โ”€ base_parser.py โ”‚ โ”‚ โ”œโ”€โ”€ docker.py โ”‚ โ”‚ โ”œโ”€โ”€ factory.py @@ -118,31 +118,27 @@ Readme-ai is a project that aims to simplify the process of creating high-qualit โ”‚ โ”‚ โ”œโ”€โ”€ npm.py โ”‚ โ”‚ โ”œโ”€โ”€ python.py โ”‚ โ”‚ โ””โ”€โ”€ rust.py - โ”‚ โ”œโ”€โ”€ services/ + โ”‚ โ”œโ”€โ”€ services โ”‚ โ”‚ โ”œโ”€โ”€ git_metadata.py โ”‚ โ”‚ โ”œโ”€โ”€ git_operations.py โ”‚ โ”‚ โ””โ”€โ”€ git_utilities.py - โ”‚ โ”œโ”€โ”€ settings/ - โ”‚ โ”‚ โ”œโ”€โ”€ config.toml - โ”‚ โ”‚ โ”œโ”€โ”€ dependency_files.toml - โ”‚ โ”‚ โ”œโ”€โ”€ identifiers.toml - โ”‚ โ”‚ โ”œโ”€โ”€ ignore_files.toml - โ”‚ โ”‚ โ”œโ”€โ”€ language_names.toml - โ”‚ โ”‚ โ””โ”€โ”€ language_setup.toml - โ”‚ โ””โ”€โ”€ utils/ - โ”‚ โ””โ”€โ”€ utils.py + โ”‚ โ””โ”€โ”€ settings + โ”‚ โ”œโ”€โ”€ config.toml + โ”‚ โ”œโ”€โ”€ dependency_files.toml + โ”‚ โ”œโ”€โ”€ identifiers.toml + โ”‚ โ”œโ”€โ”€ ignore_files.toml + โ”‚ โ”œโ”€โ”€ language_names.toml + โ”‚ โ””โ”€โ”€ language_setup.toml โ”œโ”€โ”€ requirements.txt - โ”œโ”€โ”€ scripts/ + โ”œโ”€โ”€ scripts โ”‚ โ”œโ”€โ”€ clean.sh โ”‚ โ”œโ”€โ”€ docker.sh โ”‚ โ”œโ”€โ”€ pypi.sh - โ”‚ โ”œโ”€โ”€ run.sh โ”‚ โ”œโ”€โ”€ run_batch.sh โ”‚ โ””โ”€โ”€ test.sh - โ”œโ”€โ”€ setup/ - โ”‚ โ”œโ”€โ”€ environment.yaml - โ”‚ โ””โ”€โ”€ setup.sh - + โ””โ”€โ”€ setup + โ”œโ”€โ”€ environment.yaml + โ””โ”€โ”€ setup.sh ``` --- @@ -151,150 +147,143 @@ Readme-ai is a project that aims to simplify the process of creating high-qualit
. -| File | Summary | -| --- | --- | -| [requirements.txt](https://github.com/eli64s/readme-ai/blob/main/requirements.txt) | The code snippet in the `readme-ai` repository is responsible for generating documentation for software projects. It uses various modules, such as CLI, parsers, and services, to analyze project files and generate markdown documentation. The codebase includes a variety of dependencies for its functionality, listed in the `requirements.txt` file. | -| [Dockerfile](https://github.com/eli64s/readme-ai/blob/main/Dockerfile) | The code snippet is a Dockerfile that sets up a container environment for running the `readmeai` package. It installs necessary dependencies, creates a non-root user, and sets up the command to run the CLI. | -| [Makefile](https://github.com/eli64s/readme-ai/blob/main/Makefile) | This code snippet provides a Makefile with various commands for repository maintenance, including file cleanup, code formatting, linting, building a conda package, and executing tests. It also generates a requirements.txt file for the project's dependencies. | -| [pyproject.toml](https://github.com/eli64s/readme-ai/blob/main/pyproject.toml) | The code snippet is part of the `readme-ai` repository and is responsible for generating beautiful README.md files from the terminal. It utilizes GPT LLM APIs and supports features like markdown, badges, headers, tables, and tree structures. The code is written in Python and uses various dependencies like aiohttp, click, gitpython, and pydantic. The repository follows a well-structured directory layout. | -| [poetry.lock](https://github.com/eli64s/readme-ai/blob/main/poetry.lock) | The code snippet in this repository serves as a Dockerfile and Makefile to build and deploy the project. It also includes example images and markdown files for reference. The code focuses on providing a streamlined development and deployment process. | -| [noxfile.py](https://github.com/eli64s/readme-ai/blob/main/noxfile.py) | This code snippet is responsible for test automation using the `nox` testing framework and `pytest`. It installs dependencies, runs the test suite across multiple Python versions, and generates a coverage report. | +| File | Summary | +| --- | --- | +| [requirements.txt](https://github.com/eli64s/readme-ai/blob/master/requirements.txt) | The `requirements.txt` file specifies the dependencies required by the codebase. It lists various libraries and their compatible versions that need to be installed to run the software successfully. | +| [Dockerfile](https://github.com/eli64s/readme-ai/blob/master/Dockerfile) | The Dockerfile in the repository sets up an environment for running the readmeai package. It installs system dependencies, creates a non-root user, and installs the readmeai package with a pinned version. It then sets the command to run the readmeai CLI. | +| [Makefile](https://github.com/eli64s/readme-ai/blob/master/Makefile) | The `Makefile` in the `readme-ai` repository provides several commands for repository maintenance. It includes cleaning up files, formatting code, linting, building a conda package, executing tests, generating requirements.txt, and searching for a word in the repository. | +| [pyproject.toml](https://github.com/eli64s/readme-ai/blob/master/pyproject.toml) | The code snippet in the `pyproject.toml` file is part of the `readme-ai` repository and defines the project's metadata and dependencies. It specifies the project name, version, description, authors, license, and other details required for building and packaging the project. This file plays a critical role in managing the project's dependencies and configuring the build system. | +| [poetry.lock](https://github.com/eli64s/readme-ai/blob/master/poetry.lock) | This code snippet is a crucial part of the parent repository's architecture. It achieves a specific goal by implementing critical features. To understand its role and impact, it is necessary to review the repository structure and other related materials. | +| [noxfile.py](https://github.com/eli64s/readme-ai/blob/master/noxfile.py) | This code snippet in the `noxfile.py` file automates the testing process using Nox and pytest. It installs the package using Poetry, runs the test suite across different Python versions, and generates a coverage report. |
setup -| File | Summary | -| --- | --- | -| [setup.sh](https://github.com/eli64s/readme-ai/blob/main/setup/setup.sh) | This code snippet is a bash script for setting up the README-AI environment. It checks for dependencies, installs required packages, creates a conda environment, and activates it. The script ensures the environment is ready for the README-AI repository. | -| [environment.yaml](https://github.com/eli64s/readme-ai/blob/main/setup/environment.yaml) | This code snippet, located in the `readmeai` directory, plays a critical role in the architecture of the parent repository. It focuses on various functionalities such as command-line interface, configuration settings, core processing, and parsers for different languages. These features enable the generation and customization of markdown documentation based on project metadata. | +| File | Summary | +| --- | --- | +| [setup.sh](https://github.com/eli64s/readme-ai/blob/master/setup/setup.sh) | The `setup.sh` script is responsible for setting up the README-AI environment. It checks for necessary dependencies such as `tree`, git, and Python 3.8 or higher. If the `readmeai` conda environment doesn't exist, it creates it and installs the required packages from `requirements.txt`. Finally, it activates the `readmeai` environment and sets up the Python path. | +| [environment.yaml](https://github.com/eli64s/readme-ai/blob/master/setup/environment.yaml) | This code snippet, located in the `setup/environment.yaml` file, defines the environment dependencies for the `readme-ai` repository. It specifies the required Python version and pip dependencies using the `requirements.txt` file. |
scripts -| File | Summary | -| --- | --- | -| [run_batch.sh](https://github.com/eli64s/readme-ai/blob/main/scripts/run_batch.sh) | This code snippet is used in the parent repository to generate README files for multiple repositories. It iterates over a list of repositories, randomly selects badge styles, image styles, and alignment for each repository's README file, and uses the `readmeai` module to generate the file. | -| [pypi.sh](https://github.com/eli64s/readme-ai/blob/main/scripts/pypi.sh) | The code snippet is a bash script that automates the deployment of the readmeai package to PyPI. It cleans the distribution files, builds the package, and uploads it to the PyPI repository using Twine. This script is part of the repository's architecture to streamline the release process. | -| [run.sh](https://github.com/eli64s/readme-ai/blob/main/scripts/run.sh) | The code snippet, located in the `run.sh` script, activates the `readmeai` conda environment and runs the `readmeai.cli.commands` Python script. It generates a Markdown file (`readme-ai.md`) by processing a GitHub repository's README file. | -| [clean.sh](https://github.com/eli64s/readme-ai/blob/main/scripts/clean.sh) | The code snippet is a bash script (`clean.sh`) within the parent repository. It provides cleaning functionality by removing build artifacts, Python file artifacts, test and coverage artifacts, backup files, cache files, and VS Code settings. The script accepts command line arguments to specify the type of cleaning. | -| [test.sh](https://github.com/eli64s/readme-ai/blob/main/scripts/test.sh) | The code snippet in the file scripts/test.sh is responsible for running tests and generating a coverage report for the readme-ai repository. It activates the readmeai environment, runs pytest with coverage options, and generates a report with coverage percentages. | -| [docker.sh](https://github.com/eli64s/readme-ai/blob/main/scripts/docker.sh) | This code snippet sets up a Docker image build process for the readme-ai repository. It builds the image, pushes it to a registry, and creates a multi-platform image. | +| File | Summary | +| --- | --- | +| [run_batch.sh](https://github.com/eli64s/readme-ai/blob/master/scripts/run_batch.sh) | The `run_batch.sh` script in the `scripts` directory is responsible for executing a batch process that generates README files for a list of repositories. The script loops over a set of repositories, generates random styles for badges, images, and alignments, and runs the `readme-ai` CLI command with the appropriate options and arguments to generate the README files. | +| [pypi.sh](https://github.com/eli64s/readme-ai/blob/master/scripts/pypi.sh) | This code snippet, located in the `scripts/pypi.sh` file, deploys a new version of the `readmeai` package to PyPI. It cleans any existing distribution files, builds the package, and then uploads the distribution files to the PyPI repository using `twine`. | +| [clean.sh](https://github.com/eli64s/readme-ai/blob/master/scripts/clean.sh) | The `clean.sh` script in the `scripts` directory is responsible for removing various build, test, coverage, and Python artifacts from the project, ensuring a clean state. It provides multiple commands to clean specific artifacts or perform a comprehensive cleanup of the project. | +| [test.sh](https://github.com/eli64s/readme-ai/blob/master/scripts/test.sh) | The code snippet in `scripts/test.sh` activates the `readmeai` conda environment, runs pytest with coverage analysis, and generates a report with coverage percentages. It ensures that the codebase maintains test coverage above 90%. | +| [docker.sh](https://github.com/eli64s/readme-ai/blob/master/scripts/docker.sh) | The code snippet in `scripts/docker.sh` is responsible for building and publishing a Docker image named readme-ai. It utilizes Docker Buildx to create and use a builder, then builds the image and pushes it to a repository. The image is published with a tag of latest and can be used for deployment purposes. |
.github -| File | Summary | -| --- | --- | -| [release-drafter.yml](https://github.com/eli64s/readme-ai/blob/main/.github/release-drafter.yml) | The code snippet provides a release drafter for the parent repository. It follows conventions outlined in `keepachangelog.com` and generates release templates based on labels assigned to the pull requests. It categorizes changes into features, bug fixes, chore, deprecated, removed, security, documentation, and dependency updates. The release template includes information about the changes made. | +| File | Summary | +| --- | --- | +| [release-drafter.yml](https://github.com/eli64s/readme-ai/blob/master/.github/release-drafter.yml) | The code snippet in `.github/release-drafter.yml` is responsible for automatically generating release notes based on the conventional commit messages in the repository. It categorizes changes into features, bug fixes, chores, deprecations, etc., and formats them into a release template. |
.github.workflows -| File | Summary | -| --- | --- | -| [coverage.yml](https://github.com/eli64s/readme-ai/blob/main/.github/workflows/coverage.yml) | The code snippet is responsible for setting up and running tests with coverage for the parent repository. It installs dependencies, sets up the Python environment, runs tests with coverage, and uploads coverage reports to Codecov. | -| [release-pipeline.yml](https://github.com/eli64s/readme-ai/blob/main/.github/workflows/release-pipeline.yml) | The code snippet is part of the parent repository's release pipeline and is responsible for building and deploying the code to PyPI and Docker Hub. It installs the necessary dependencies, builds the package, and publishes it to PyPI. It also builds a Docker image and pushes it to Docker Hub. | -| [release-drafter.yml](https://github.com/eli64s/readme-ai/blob/main/.github/workflows/release-drafter.yml) | The code snippet is a configuration file for Release Drafter, a GitHub action that automatically drafts release notes based on pull requests merged into the main branch. It specifies the event triggers, permissions, and other settings for the action to work effectively. | +| File | Summary | +| --- | --- | +| [coverage.yml](https://github.com/eli64s/readme-ai/blob/master/.github/workflows/coverage.yml) | This code snippet is located in the.github/workflows/coverage.yml file. It is responsible for executing coverage tests in the repository's continuous integration workflow. | +| [release-pipeline.yml](https://github.com/eli64s/readme-ai/blob/master/.github/workflows/release-pipeline.yml) | This code snippet is part of the release pipeline workflow in the parent repository. It handles the automation of the release process, ensuring efficient and reliable deployment of the software. | +| [release-drafter.yml](https://github.com/eli64s/readme-ai/blob/master/.github/workflows/release-drafter.yml) | This code snippet, located in the `.github/workflows/release-drafter.yml` file, is responsible for configuring release drafting workflows within the parent repository. It defines the workflow for automatically generating release notes based on the repository's pull requests and issues. |
readmeai -| File | Summary | -| --- | --- | -| [main.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/main.py) | The code snippet is the main module for the README-AI CLI application. It orchestrates the generation process of the README file based on the repository's structure, dependencies, and user prompts. It utilizes various modules and services to clone the repository, process the files, generate summaries, and build the README markdown file. It also logs the application's settings and handles error cases. | +| File | Summary | +| --- | --- | +| [main.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/main.py) | The `main.py` file is the main module for the README-AI CLI application. It orchestrates the README file generation process, including cloning the repository, parsing dependencies, generating summaries, and building the README.md file. It also handles configuration settings, environment variables, and logging. |
readmeai.settings -| File | Summary | -| --- | --- | -| [ignore_files.toml](https://github.com/eli64s/readme-ai/blob/main/readmeai/settings/ignore_files.toml) | This code snippet is a part of a larger repository called readme-ai. It is responsible for handling the configuration of ignored files and directories within the project. It lists various file extensions and directory names that should be ignored during the execution of the codebase. This feature ensures that irrelevant files and directories are not considered when performing operations on the codebase. | -| [language_names.toml](https://github.com/eli64s/readme-ai/blob/main/readmeai/settings/language_names.toml) | This code snippet is part of the readme-ai repository. It consists of various directories and files that contribute to the overall architecture. One notable file is readmeai/settings/language_names.toml, which contains a mapping of programming language file extensions to their corresponding names. This file helps in identifying and working with different programming languages within the codebase. | -| [identifiers.toml](https://github.com/eli64s/readme-ai/blob/main/readmeai/settings/identifiers.toml) | This code snippet is part of the readme-ai repository and is responsible for providing critical features related to the repository's architecture. It leverages a directory structure, dependencies, and software to support various project types and technologies, including web, mobile, desktop, backend, frontend, game development, data analysis, machine learning, libraries, command-line interfaces, APIs, plugins, and embedded systems. | -| [config.toml](https://github.com/eli64s/readme-ai/blob/main/readmeai/settings/config.toml) | This code snippet plays a crucial role in the parent repository's architecture. It provides core functionalities and features that are essential for the overall system. Its main purpose is to achieve a specific goal without delving into technical details. For more information, refer to the repository layout and directory structure, dependencies, and key file summaries. | -| [dependency_files.toml](https://github.com/eli64s/readme-ai/blob/main/readmeai/settings/dependency_files.toml) | The code snippet is part of the readme-ai repository's architecture. It provides functionality to parse and analyze codebase dependencies across various programming languages. The critical feature is the ability to identify and extract information from different dependency files, such as package.json, requirements.txt, go.mod, and more. | -| [language_setup.toml](https://github.com/eli64s/readme-ai/blob/main/readmeai/settings/language_setup.toml) | The code snippet provides language-specific setup and run instructions for various programming languages, enhancing the parent repository's architecture by enabling easy execution and testing of code in different languages. | +| File | Summary | +| --- | --- | +| [ignore_files.toml](https://github.com/eli64s/readme-ai/blob/master/readmeai/settings/ignore_files.toml) | The code snippet in the `ignore_files.toml` file defines a list of directories, extensions, and files that should be ignored by the repository. This ensures that certain files and directories do not affect the codebase or version control. | +| [language_names.toml](https://github.com/eli64s/readme-ai/blob/master/readmeai/settings/language_names.toml) | This code snippet is located in the `readmeai/settings/language_names.toml` file. It contains a mapping of programming language file extensions to their corresponding names. This information is used in the parent repository's architecture to identify and label the programming languages used in the codebase. | +| [identifiers.toml](https://github.com/eli64s/readme-ai/blob/master/readmeai/settings/identifiers.toml) | The code snippet in the readmeai/settings/identifiers.toml file defines identifiers for various project types such as web, mobile, backend, frontend, game, data, ML, library, CLI, API, plugin, and embedded. These identifiers can be used to recognize and categorize projects based on their file and folder names. | +| [config.toml](https://github.com/eli64s/readme-ai/blob/master/readmeai/settings/config.toml) | This code snippet is a part of the readme-ai repository. It plays a critical role in generating a Markdown file that provides an overview of the repository structure, features, and other elements. The code achieves this by parsing various configuration files and generating different sections of the Markdown file based on the provided templates. | +| [dependency_files.toml](https://github.com/eli64s/readme-ai/blob/master/readmeai/settings/dependency_files.toml) | This code snippet, located at `readmeai/settings/dependency_files.toml`, specifies the file names of programming language dependency files. It lists the common file names of dependency files for various languages. | +| [language_setup.toml](https://github.com/eli64s/readme-ai/blob/master/readmeai/settings/language_setup.toml) | This code snippet, located in the `readmeai/settings/language_setup.toml` file, defines the setup and run instructions for various programming languages used in the parent repository. It provides default installation, run, and test commands for each language, enabling developers to quickly set up and execute code in different environments. |
readmeai.parsers -| File | Summary | -| --- | --- | -| [gomod.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/parsers/gomod.py) | The code snippet is a GoModParser class that parses package dependencies from go.mod files. It extracts package names using regex patterns and returns a list of names. | -| [factory.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/parsers/factory.py) | This code snippet provides an abstract factory for parsers used to extract information from different types of dependency files. It returns a dictionary of file types and their corresponding parser objects. These parsers are crucial for extracting relevant data from various dependency files in the codebase. | -| [docker.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/parsers/docker.py) | The code snippet is a Docker file parser that extracts a list of services from a docker-compose.yaml file. It handles YAML decoding errors and returns an empty list if no services are found. | -| [npm.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/parsers/npm.py) | This code snippet is part of the readme-ai repository and focuses on parsing JSON dependency files. It uses the `json` module to extract package names from specific sections in the file. It returns a list of dependencies. | -| [gradle.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/parsers/gradle.py) | The code snippet provides parsers for extracting package names from Gradle dependency files. It includes parsers for both `build.gradle` and `build.gradle.kts` files. The parsers use regular expressions to extract package names from the files. The extracted package names are then returned as a list. | -| [base_parser.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/parsers/base_parser.py) | This code snippet is a base class for dependency file parsers in the `readme-ai` repository. It defines an abstract method `parse` that extracts package names from dependency files. It also provides a method `log_error` to log error messages when parsing fails. | -| [python.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/parsers/python.py) | This code snippet is part of the `readmeai` codebase and is responsible for parsing different types of dependency files in Python projects. It includes parsers for requirements.txt, TOML, and YAML files, extracting package names from each file type. These parsers handle different build systems and extract the necessary dependencies for the project. | -| [maven.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/parsers/maven.py) | This code snippet is part of the readme-ai repository and is located in the `readmeai/parsers/maven.py` file. It contains the MavenParser class, which is responsible for parsing Maven dependency files in the pom.xml format. The `parse` method extracts package names from the content of the pom.xml file using regular expressions. If the extracted dependencies include any with spring in their name, the spring dependency is added to the list. The method returns a set of unique dependencies. If any exception occurs during the parsing process, an error is logged and an empty list is returned. | -| [rust.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/parsers/rust.py) | This code snippet is a parser for Rust dependency files in the readmeai repository. It extracts package names from Rust TOML files. It utilizes the `toml` library for parsing TOML content. | +| File | Summary | +| --- | --- | +| [gomod.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/parsers/gomod.py) | This code snippet is part of the readme-ai repository and is located at `readmeai/parsers/gomod.py`. It defines the `GoModParser` class, which parses package dependencies from `go.mod` files. The `parse` method extracts the names of the packages from the file's content and returns them as a list. | +| [factory.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/parsers/factory.py) | The `factory.py` file in the `readmeai.parsers` package acts as an abstract factory for creating different file parsers. It provides a dictionary of callable file parser methods based on different file types. These parsers are responsible for parsing specific types of dependency files such as `build.gradle`, `package.json`, `requirements.txt`, and others. | +| [docker.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/parsers/docker.py) | The code snippet is a Docker file parser that extracts a list of services from a docker-compose.yaml file. It uses YAML decoding and handles errors. | +| [npm.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/parsers/npm.py) | The code snippet, located at `readmeai/parsers/npm.py`, is responsible for parsing JSON dependency files in a Node.js project. It extracts the names of the dependencies from the specified sections (`dependencies`, `devDependencies`, and `peerDependencies`) in the JSON file. If there is an error in parsing the file, an error message is logged. | +| [gradle.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/parsers/gradle.py) | This code snippet provides parsers for extracting package names from Gradle dependency files (`build.gradle` and `build.gradle.kts`). It uses regular expressions to find and extract package names from the file content. The parsed package names are returned as a list. | +| [base_parser.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/parsers/base_parser.py) | The code snippet in the file `readmeai/parsers/base_parser.py` is an abstract base class for all dependency file parsers in the readme-ai repository. It provides a method `parse` to extract package names from dependency files and a method `log_error` to log error messages when parsing fails. | +| [python.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/parsers/python.py) | This code snippet resides in the `readmeai/parsers/python.py` file and is part of the larger `readme-ai` repository. It contains parsers for different types of Python dependency files, such as requirements.txt, TOML, and YAML. The code extracts package names from these files while handling various formats and build systems. | +| [maven.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/parsers/maven.py) | The code in `readmeai/parsers/maven.py` is a parser utility for Java-based dependency files in Maven's `pom.xml` format. It extracts package names from these files using regex patterns and returns a set of dependencies. It also handles XML decoding errors and logs any encountered errors. | +| [rust.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/parsers/rust.py) | This code snippet is a parser for Rust dependency files in the readme-ai repository. It extracts package names from Rust TOML files. |
readmeai.core -| File | Summary | -| --- | --- | -| [preprocess.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/core/preprocess.py) | This code snippet is part of the `readme-ai` repository and handles the preprocessing of the input codebase. It analyzes a local or remote git repository, generates file information, extracts dependency file contents, and tokenizes the content of each file. It also maps file extensions to programming languages and extracts the dependencies of the repository. The code achieves these tasks through the `RepoProcessor` class and various helper functions. | -| [tokens.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/core/tokens.py) | This code snippet provides tokenization utilities for the `readme-ai` CLI application. It includes functions for adjusting the maximum number of tokens based on a prompt, counting the number of tokens in a text string, selecting the token encoder to use for the model, and truncating a text string to a maximum number of tokens. These utilities are essential for processing text inputs and ensuring compatibility with the model. | -| [logger.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/core/logger.py) | The code snippet provides a custom implementation of a logger using the colorlog library. It configures the logger and provides methods to log messages at different levels such as info, debug, warning, error, and critical. This logger is used in the readmeai/core/logger.py file within the parent repository. | -| [factory.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/core/factory.py) | The code snippet provides a FileHandler class in the readmeai/core/factory.py file. It serves as a file input/output (I/O) factory, allowing reading and writing of various file formats such as JSON, Markdown, TOML, TXT, and YAML. The class encapsulates methods for reading and writing files in these formats, providing a convenient and unified interface for handling file I/O operations within the codebase.The code supports reading and writing files of different formats, abstracting away the details of the specific file format being used. This promotes code modularity and reusability, as other components in the codebase can rely on the FileHandler class to handle their file I/O needs without needing to directly deal with the intricacies of each file format. | -| [model.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/core/model.py) | The code snippet is part of the readme-ai repository and is responsible for generating text for the README.md file using GPT language models. It includes functions for handling prompts, batching, and generating summaries for code files. The code also implements rate limiting and caching for optimal performance. | +| File | Summary | +| --- | --- | +| [preprocess.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/core/preprocess.py) | The code snippet in `preprocess.py` is responsible for preprocessing the input codebase in the parent repository. It analyzes the codebase, extracts metadata and dependencies, and performs tasks such as tokenizing content and mapping file extensions to programming languages. The code achieves this by generating file information, extracting dependency file contents, and tokenizing the content of each file. | +| [tokens.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/core/tokens.py) | This code snippet, located at `readmeai/core/tokens.py`, provides tokenization utilities for the `readme-ai` CLI application. It includes functions for adjusting the maximum number of tokens, counting tokens in a text, selecting a token encoder, and truncating a text to a specified number of tokens. These utilities facilitate the processing and manipulation of text data within the CLI application. | +| [logger.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/core/logger.py) | The `logger.py` code snippet is a custom logger implementation using `colorlog` for the `readmeai` module in the parent repository. It configures the logger with a colored formatter and provides methods to log messages at different levels. | +| [factory.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/core/factory.py) | This code snippet is a file I/O factory class that provides methods to read and write different file formats such as JSON, Markdown, TOML, TXT, and YAML. It encapsulates the file handling functionality and abstracts the underlying implementation details. The class can read the contents of a file and write content to a file, supporting various file extensions. It also includes exception handling for file read and write operations. | +| [model.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/core/model.py) | This code snippet represents the ModelHandler class in the readmeai.core.model module. It handles the generation of text using the GPT language model API for the README.md file. It provides methods for batch text generation, generating prompts, and generating code summaries. It utilizes HTTP client resources and implements error handling and caching mechanisms. | +| [utils.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/core/utils.py) | This code snippet contains utility functions for the README-AI package. It includes functions for validating URLs, flattening nested lists, formatting text, getting relative paths, retrieving resource paths, removing substrings from strings, and checking if files should be ignored. These functions are critical for various operations within the README-AI package. |
readmeai.config -| File | Summary | -| --- | --- | -| [settings.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/config/settings.py) | This code snippet defines various Pydantic models and enums used for configuring the readme-ai CLI tool. It handles settings related to Git service, badges, images, CLI options, markdown templates, and more. The code also includes a helper class for loading additional configuration files. | +| File | Summary | +| --- | --- | +| [enums.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/config/enums.py) | This code snippet defines several enum classes for the `readmeai` package. It includes the `GitService` enum, which provides API URL and file URL templates for different Git services, and the `BadgeOptions` and `ImageOptions` enums for CLI options related to badges and images in README files. These enums help configure and customize README files generated by the `readmeai` package. | +| [settings.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/config/settings.py) | This code snippet contains the configuration settings for the readme-ai CLI tool. It provides data models and functions for configuring various aspects of the tool, such as the Git repository, file paths, OpenAI LLM API details, Markdown templates, and prompts. It also includes a helper class for loading additional configuration files. |
readmeai.markdown -| File | Summary | -| --- | --- | -| [tree.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/markdown/tree.py) | The code snippet is a TreeGenerator class that generates a formatted directory tree structure for a code repository. It takes the root directory, repository URL, repository name, and maximum depth as inputs, and returns the formatted tree structure as a string. It uses the ConfigHelper class, Logger class, and utils module for configuration and utility functions. | -| [badges.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/markdown/badges.py) | The code snippet in the `readmeai/markdown/badges.py` file generates badges for a README file using various icons from repositories. It formats the badges into HTML `` tags and retrieves the icons from an external source. The badges can be customized based on the project's dependencies and other metadata. | -| [tables.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/markdown/tables.py) | This code snippet is responsible for generating Markdown tables to store text responses in the README file of the parent repository. It takes a list of data and constructs a table with headers and rows. Each row contains a hyperlink to a file, if available. The tables are organized by project sub-directory. | -| [headers.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/markdown/headers.py) | The code snippet is responsible for constructing each section of the README Markdown file in a repository. It formats the contents, including headers, badges, tables, project setup, and more. The code also removes emojis from headers and the Table of Contents if required. | -| [quickstart.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/markdown/quickstart.py) | The code snippet is part of the readme-ai repository and is located in the `readmeai/markdown/quickstart.py` file. It dynamically generates the Quick Start section of the README file, counting the occurrences of each programming language and retrieving setup commands for the top language. The main function, `getting_started`, takes in an `AppConfig` object, a `ConfigHelper` object, and a list of summaries and returns a `ProjectSetup` object with information about using, running, and testing the repository. | - -
- -
readmeai.utils - -| File | Summary | -| --- | --- | -| [utils.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/utils/utils.py) | This code snippet contains utility functions for the README-AI package. It includes functions for validating URLs, flattening nested lists, formatting text, getting relative file paths, accessing package resources, removing substrings from strings, and checking if files should be ignored. These functions are critical for various tasks related to generating and processing README files. | +| File | Summary | +| --- | --- | +| [tree.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/markdown/tree.py) | The code snippet in `readmeai/markdown/tree.py` generates a directory tree structure for a code repository. It takes in the repository name, URL, root directory, and maximum depth as inputs, and returns a formatted tree structure. It iterates over the directories and their children, ignoring certain files based on the configuration settings. | +| [builder.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/markdown/builder.py) | The `builder.py` code snippet is responsible for building different sections of the README Markdown file in the `readme-ai` repository. It generates the header, code summaries, directory tree structure, and Getting Started section. Emojis are also optionally removed from the content. The resulting README file is written to the specified output path. | +| [badges.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/markdown/badges.py) | The `badges.py` code snippet in the `readmeai/markdown` directory is responsible for building and formatting badges in the README.md file. It includes functions for generating dependency badges and metadata badges using shields.io and skill icons. The badges are formatted as HTML and sorted based on color. | +| [tables.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/markdown/tables.py) | The code snippet in `readmeai/markdown/tables.py` generates Markdown tables for storing LLM text responses in a README file. It constructs tables using provided data and creates hyperlinks for each file. The tables are formatted based on the length of the data and grouped by sub-directory. | +| [quickstart.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/markdown/quickstart.py) | The code snippet in `readmeai/markdown/quickstart.py` generates the Quick Start section of a README file dynamically. It counts the occurrences of each language in the summaries and determines the top language. It then retrieves the setup commands for the top language and generates the appropriate information for the Quick Start section. |
readmeai.cli -| File | Summary | -| --- | --- | -| [options.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/cli/options.py) | This code snippet provides command-line interface options for the readme-ai application. It allows users to customize the generation of a README.md file by specifying various parameters such as alignment, badges, emojis, image, model, offline generation, output file name, repository, temperature, max tokens, template, and language. | -| [commands.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/cli/commands.py) | The code snippet is the CLI entry point for the readme-ai repository. It provides command-line options to configure the readme-ai application and calls the main function to execute it. The CLI allows users to generate readme files using the specified options. | +| File | Summary | +| --- | --- | +| [options.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/cli/options.py) | The options.py code snippet in the readmeai/cli module of the readme-ai repository provides command-line interface options for the readme-ai application. It allows users to customize various aspects of generating a README.md file, such as alignment, badges, emojis, image, model, offline mode, output file name, repository link, temperature, max tokens, and template style. | +| [commands.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/cli/commands.py) | This code snippet contains the CLI entry point for the readme-ai tool. It defines the command-line options and parameters, and invokes the main function with the specified arguments. The main function is responsible for executing the desired functionality of the readme-ai tool. |
readmeai.services -| File | Summary | -| --- | --- | -| [git_utilities.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/services/git_utilities.py) | This code snippet provides Git service utilities to retrieve repository metadata. It includes functions to get the URL of a file in the remote repository, get the full name of the repository, and parse the repository URL to return the API URL. | -| [git_operations.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/services/git_operations.py) | This code snippet is responsible for cloning and validating git repositories in a temporary directory. It uses the `git` library to clone the repository and performs error handling to ensure successful cloning. Additionally, it includes functions to find the path to the git executable and validate file permissions of the cloned repository. | -| [git_metadata.py](https://github.com/eli64s/readme-ai/blob/main/readmeai/services/git_metadata.py) | The code snippet provides helper methods to fetch and process metadata for a GitHub repository. It retrieves various details such as repository name, owner, description, statistics, URLs, programming languages, topics, and license information. | +| File | Summary | +| --- | --- | +| [git_utilities.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/services/git_utilities.py) | This code snippet is part of the readme-ai repository and is located in the readmeai/services/git_utilities.py file. It provides utilities for retrieving repository metadata from different Git services. The code includes functions for generating the URL of a file in the remote repository and parsing the repository URL to obtain the API URL. | +| [git_operations.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/services/git_operations.py) | This code snippet provides Git operations for cloning and validating repositories. It includes functions to clone a repository to a temporary directory, find the path to the Git executable, validate file permissions, and validate the path to the Git executable. These operations are crucial for managing and working with Git repositories within the parent repository's architecture. | +| [git_metadata.py](https://github.com/eli64s/readme-ai/blob/master/readmeai/services/git_metadata.py) | This code snippet in `git_metadata.py` fetches metadata for a Git repository, specifically from GitHub. It uses the `fetch_git_api` function to retrieve repository metadata from the Git API and the `process_repo_metadata` function to process the raw data into a `GitHubRepoMetadata` object. The `GitHubRepoMetadata` class stores various details about the repository, such as its name, owner, description, statistics, URLs, programming languages, and license information. Overall, this code provides a way to retrieve and process important information about a GitHub repository. |
@@ -306,35 +295,40 @@ Readme-ai is a project that aims to simplify the process of creating high-qualit Ensure you have the following dependencies installed on your system: -* Python: `โ–บ INSERT-VERSION-HERE` -* `โ–บ ...` -* `โ–บ ...` +* **Python**: `version x.y.z` ### โš™๏ธ Installation 1. Clone the readme-ai repository: + ```sh git clone https://github.com/eli64s/readme-ai ``` 2. Change to the project directory: + ```sh cd readme-ai ``` 3. Install the dependencies: + ```sh pip install -r requirements.txt ``` ### ๐Ÿค– Running readme-ai + Use the following command to run readme-ai: + ```sh python main.py ``` ### ๐Ÿงช Tests + To execute tests, run: + ```sh pytest ``` @@ -353,24 +347,24 @@ pytest Contributions are welcome! Here are several ways you can contribute: -- **[Submit Pull Requests](https://github.com/eli64s/readme-ai/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs. -- **[Join the Discussions](https://github.com/eli64s/readme-ai/discussions)**: Share your insights, provide feedback, or ask questions. -- **[Report Issues](https://github.com/eli64s/readme-ai/issues)**: Submit bugs found or log feature requests for readme-ai. +- **[Submit Pull Requests](https://github/eli64s/readme-ai/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs. +- **[Join the Discussions](https://github/eli64s/readme-ai/discussions)**: Share your insights, provide feedback, or ask questions. +- **[Report Issues](https://github/eli64s/readme-ai/issues)**: Submit bugs found or log feature requests for Readme-ai.
-Contributing Guidelines + Contributing Guidelines 1. **Fork the Repository**: Start by forking the project repository to your GitHub account. 2. **Clone Locally**: Clone the forked repository to your local machine using a Git client. ```sh - git clone + git clone https://github.com/eli64s/readme-ai ``` 3. **Create a New Branch**: Always work on a new branch, giving it a descriptive name. ```sh git checkout -b new-feature-x ``` 4. **Make Your Changes**: Develop and test your changes locally. -5. **Commit Your Changes**: Commit with a clear and concise message describing your updates. +5. **Commit Your Changes**: Commit with a clear message describing your updates. ```sh git commit -m 'Implemented new feature x.' ``` diff --git a/examples/markdown/readme-streamlit.md b/examples/markdown/readme-streamlit.md index 36cf4776..34a36f53 100644 --- a/examples/markdown/readme-streamlit.md +++ b/examples/markdown/readme-streamlit.md @@ -1,150 +1,162 @@ -

- +

README-AI-STREAMLIT

- Streamlining readme generation and AI-powered documentation. + Unleash AI-powered Readme insights with Streamlit

- license - last-commit - repo-top-language - repo-language-count + license + last-commit + repo-top-language + repo-language-count

- + Developed with the software and tools below. +

+

+ GNU%20Bash + Streamlit + Poetry + Python + Pytest

-

-## ๐Ÿ”— Quick Links -- [๐Ÿ”— Quick Links](#-quick-links) -- [๐Ÿ“ Overview](#-overview) -- [๐Ÿ“ฆ Features](#-features) -- [๐Ÿ“‚ Repository Structure](#-repository-structure) -- [๐Ÿงฉ Modules](#-modules) -- [๐Ÿš€ Getting Started](#-getting-started) - - [โš™๏ธ Installation](#๏ธ-installation) - - [๐Ÿค– Running readme-ai-streamlit](#-running-readme-ai-streamlit) - - [๐Ÿงช Tests](#-tests) -- [๐Ÿ›  Project Roadmap](#-project-roadmap) -- [๐Ÿค Contributing](#-contributing) -- [๐Ÿ“„ License](#-license) -- [๐Ÿ‘ Acknowledgments](#-acknowledgments) +## Quick Links + +> - [ Overview](#-overview) +> - [ Features](#-features) +> - [ Repository Structure](#-repository-structure) +> - [ Modules](#-modules) +> - [ Getting Started](#-getting-started) +> - [ Installation](#-installation) +> - [ Running readme-ai-streamlit](#-running-readme-ai-streamlit) +> - [ Tests](#-tests) +> - [ Project Roadmap](#-project-roadmap) +> - [ Contributing](#-contributing) +> - [ License](#-license) +> - [ Acknowledgments](#-acknowledgments) --- -## ๐Ÿ“ Overview +## Overview -The readme-ai-streamlit project is a Streamlit app that serves the readmeai command-line tool. It provides a user-friendly interface for analyzing and extracting information from README files. The project's core functionalities allow users to input a README file, and the app processes the file to generate useful insights such as project description, installation instructions, and relevant links. By leveraging natural language processing techniques, the app simplifies the process of understanding and extracting critical information from README files, making it a valuable tool for developers and project managers. +The readme-ai-streamlit project is a Streamlit application that serves as a user interface for the readmeai command-line tool. Its core functionality is to provide a user-friendly and interactive platform for users to analyze and extract valuable information from README files in software projects. By leveraging natural language processing and machine learning techniques, this project aims to automate the process of understanding and summarizing project documentation. The value proposition lies in saving time and effort for developers and stakeholders by quickly generating insights about project features, dependencies, and usage instructions, ultimately improving the efficiency and effectiveness of software development processes. --- -## ๐Ÿ“ฆ Features +## Features + +| | Feature | Description | +|----|-------------------|---------------------------------------------------------------| +| โš™๏ธ | **Architecture** | The project follows a modular architecture with a clear separation of concerns. It uses Streamlit, a Python library for building interactive web apps, as the main framework. It also utilizes the Readme AI library for generating AI-powered READMEs.| +| ๐Ÿ”ฉ | **Code Quality** | The codebase demonstrates good code quality and adherence to coding standards. It follows a clean and readable coding style, making it easy to understand and maintain.| +| ๐Ÿ“„ | **Documentation** | The project has a decent level of documentation. The README file provides an overview of the project and instructions for installation and usage. However, more detailed documentation on specific code components and functionalities would be beneficial.| +| ๐Ÿ”Œ | **Integrations** | The key integrations include Streamlit, which serves as the main web framework, and Readme AI, which is responsible for generating AI-powered READMEs. There are also dependencies on pytest and other libraries for testing purposes.| +| ๐Ÿงฉ | **Modularity** | The codebase exhibits good modularity and reusability. It follows a modular design pattern, allowing for easy extension and maintenance. The project's functions and components are well-organized and can be used in other applications.| +| ๐Ÿงช | **Testing** | The project uses pytest as the testing framework. It also includes additional tools like pytest-randomly and pytest-cov for improved testing capabilities. Proper test coverage helps ensure the stability and reliability of the codebase.| +| โšก๏ธ | **Performance** | The project's performance is efficient, providing quick response times and minimal resource usage. Streamlit's built-in caching mechanism optimizes code execution and reduces redundant computations.| +| ๐Ÿ›ก๏ธ | **Security** | The project doesn't explicitly address security measures. Additional security measures such as input validation and access control could be implemented to enhance overall security.| +| ๐Ÿ“ฆ | **Dependencies** | Key external libraries and dependencies include Streamlit, Readme AI, and pytest. These libraries are essential for building the web app, generating AI-powered READMEs, and performing testing tasks, respectively.| -| | Feature | Description | -|----|--------------------|--------------------------------------------------------------------------------------------------------------------| -| โš™๏ธ | **Architecture** | The codebase follows a simple client-server architecture with a Streamlit frontend and a Python backend. The frontend sends user inputs to the backend for processing. | -| ๐Ÿ“„ | **Documentation** | The codebase lacks comprehensive documentation. Some function and module-level comments are present, but a more detailed explanation of the code's purpose and usage would be beneficial. | -| ๐Ÿ”— | **Dependencies** | The system relies on several external libraries, including Streamlit, Pandas, and scikit-learn for data processing and visualization. These dependencies are listed in the `requirements.txt` file. | -| ๐Ÿงฉ | **Modularity** | The codebase is organized into several modules that handle different aspects of the application, such as data preprocessing, model training, and streamlit UI. The modularity allows for easy maintenance and future enhancements. | -| ๐Ÿงช | **Testing** | The codebase lacks unit tests or any automated testing strategy. Implementing unit tests using frameworks like pytest would improve code reliability and maintainability. | -| โšก๏ธ | **Performance** | The performance of the system depends on the underlying machine's resources. The codebase efficiently handles data preprocessing and model training, but further optimizations can be done, such as parallelization and memory management, for better performance. | -| ๐Ÿ” | **Security** | There are no apparent security measures implemented in the codebase. Input validation and data sanitization should be added to prevent any security vulnerabilities. --- -## ๐Ÿ“‚ Repository Structure +## Repository Structure ```sh โ””โ”€โ”€ readme-ai-streamlit/ โ”œโ”€โ”€ poetry.lock โ”œโ”€โ”€ pyproject.toml โ”œโ”€โ”€ requirements.txt - โ”œโ”€โ”€ scripts/ + โ”œโ”€โ”€ scripts โ”‚ โ””โ”€โ”€ clean.sh - โ”œโ”€โ”€ src/ - โ”‚ โ””โ”€โ”€ app.py - + โ””โ”€โ”€ src + โ””โ”€โ”€ app.py ``` --- -## ๐Ÿงฉ Modules +## Modules
. -| File | Summary | -| --- | --- | -| [requirements.txt](https://github.com/eli64s/readme-ai-streamlit/blob/main/requirements.txt) | The code snippet in `app.py` is a critical component of the `readme-ai-streamlit` repository. It plays the main role in running the application and is responsible for the core functionality. It utilizes dependencies specified in `requirements.txt`. | -| [pyproject.toml](https://github.com/eli64s/readme-ai-streamlit/blob/main/pyproject.toml) | The code snippet in `app.py` is a Streamlit app that serves the `readmeai` CLI tool. It relies on the Streamlit framework and uses the OpenAI API for natural language processing tasks. The codebase follows the Python project structure convention and includes a `poetry.toml` file for dependency management. | -| [poetry.lock](https://github.com/eli64s/readme-ai-streamlit/blob/main/poetry.lock) | This code snippet, located in the `app.py` file, plays a crucial role in the parent repository's architecture. It accomplishes specific tasks using defined dependencies and software, as outlined in the `poetry.lock` file. | +| File | Summary | +| --- | --- | +| [requirements.txt](https://github.com/eli64s/readme-ai-streamlit/blob/master/requirements.txt) | This code snippet in `requirements.txt` lists the required packages (`readmeai` and `streamlit`) for the `app.py` file in the `readme-ai-streamlit` repository. | +| [pyproject.toml](https://github.com/eli64s/readme-ai-streamlit/blob/master/pyproject.toml) | The code snippet is located in the `src/app.py` file and is part of the `readme-ai-streamlit` repository. It serves as a Streamlit app that utilizes the `readmeai` command-line tool. The main purpose of this code is to provide a user interface for the tool, allowing users to interact with it through a Streamlit interface. | +| [poetry.lock](https://github.com/eli64s/readme-ai-streamlit/blob/master/poetry.lock) | The code snippet in the `poetry.lock` file is critical for managing dependencies and ensuring reproducibility in the parent repository's architecture. It lists the locked versions of all dependencies used in the codebase. |
scripts -| File | Summary | -| --- | --- | -| [clean.sh](https://github.com/eli64s/readme-ai-streamlit/blob/main/scripts/clean.sh) | This code snippet is a shell script that provides cleaning functionalities for the parent repository. It allows the user to remove build, test, coverage, and Python artifacts, as well as backup files and cache directories. The script also includes proper usage instructions and error handling for unknown commands. | +| File | Summary | +| --- | --- | +| [clean.sh](https://github.com/eli64s/readme-ai-streamlit/blob/master/scripts/clean.sh) | This code snippet, located in the scripts directory, provides a bash script to clean various artifacts and files in the repository. The script removes build artifacts, Python file artifacts, test and coverage artifacts, backup files, cache files, and VS Code settings. It offers different commands for different cleaning operations. |
src -| File | Summary | -| --- | --- | -| [app.py](https://github.com/eli64s/readme-ai-streamlit/blob/main/src/app.py) | This code snippet is the main file of a Streamlit application for generating README files using the readme-ai package. It collects user inputs, executes commands, and displays the generated README file. | +| File | Summary | +| --- | --- | +| [app.py](https://github.com/eli64s/readme-ai-streamlit/blob/master/src/app.py) | This code snippet is the main script for a Streamlit application that serves the readme-ai package. It collects user inputs, executes a command to generate a README file, and displays the generated output. The application is powered by GPT and offers configuration options for badge style, emojis, and running offline. |
--- -## ๐Ÿš€ Getting Started +## Getting Started ***Requirements*** Ensure you have the following dependencies installed on your system: -* Text: `โ–บ INSERT-VERSION-HERE` -* `โ–บ ...` -* `โ–บ ...` +* **Python**: `version x.y.z` -### โš™๏ธ Installation +### Installation 1. Clone the readme-ai-streamlit repository: + ```sh git clone https://github.com/eli64s/readme-ai-streamlit ``` 2. Change to the project directory: + ```sh cd readme-ai-streamlit ``` 3. Install the dependencies: + ```sh -โ–บ INSERT-TEXT-HERE +pip install -r requirements.txt ``` -### ๐Ÿค– Running readme-ai-streamlit +### Running readme-ai-streamlit + Use the following command to run readme-ai-streamlit: + ```sh -โ–บ INSERT-TEXT-HERE +streamlit run src/app.py ``` -### ๐Ÿงช Tests +### Tests + To execute tests, run: + ```sh -โ–บ INSERT-TEXT-HERE +pytest ``` --- -## ๐Ÿ›  Project Roadmap +## Project Roadmap - [X] `โ–บ INSERT-TASK-1` - [ ] `โ–บ INSERT-TASK-2` @@ -152,28 +164,28 @@ To execute tests, run: --- -## ๐Ÿค Contributing +## Contributing Contributions are welcome! Here are several ways you can contribute: -- **[Submit Pull Requests](https://github.com/eli64s/readme-ai-streamlit/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs. -- **[Join the Discussions](https://github.com/eli64s/readme-ai-streamlit/discussions)**: Share your insights, provide feedback, or ask questions. -- **[Report Issues](https://github.com/eli64s/readme-ai-streamlit/issues)**: Submit bugs found or log feature requests for readme-ai-streamlit. +- **[Submit Pull Requests](https://github/eli64s/readme-ai-streamlit/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs. +- **[Join the Discussions](https://github/eli64s/readme-ai-streamlit/discussions)**: Share your insights, provide feedback, or ask questions. +- **[Report Issues](https://github/eli64s/readme-ai-streamlit/issues)**: Submit bugs found or log feature requests for Readme-ai-streamlit.
-Contributing Guidelines + Contributing Guidelines 1. **Fork the Repository**: Start by forking the project repository to your GitHub account. 2. **Clone Locally**: Clone the forked repository to your local machine using a Git client. ```sh - git clone + git clone https://github.com/eli64s/readme-ai-streamlit ``` 3. **Create a New Branch**: Always work on a new branch, giving it a descriptive name. ```sh git checkout -b new-feature-x ``` 4. **Make Your Changes**: Develop and test your changes locally. -5. **Commit Your Changes**: Commit with a clear and concise message describing your updates. +5. **Commit Your Changes**: Commit with a clear message describing your updates. ```sh git commit -m 'Implemented new feature x.' ``` @@ -189,13 +201,13 @@ Once your PR is reviewed and approved, it will be merged into the main branch. --- -## ๐Ÿ“„ License +## License This project is protected under the [SELECT-A-LICENSE](https://choosealicense.com/licenses) License. For more details, refer to the [LICENSE](https://choosealicense.com/licenses/) file. --- -## ๐Ÿ‘ Acknowledgments +## Acknowledgments - List any resources, contributors, inspiration, etc. here. diff --git a/examples/markdown/readme-typescript.md b/examples/markdown/readme-typescript.md index ff37b82d..da1908d8 100644 --- a/examples/markdown/readme-typescript.md +++ b/examples/markdown/readme-typescript.md @@ -1,228 +1,244 @@ -

- +

+ChatGPT-App-React-Native-TypeScript

-

-

CHATGPT-APP-REACT-NATIVE-TYPESCRIPT

+

+

CHATGPT-APP-REACT-NATIVE-TYPESCRIPT

-

- ChatGPT: React Native. Powerful. Seamless. Conversational. +

+ ChatGPT: Conversations Perfected in Your Palm

-

-

-

- Developed with the software and tools below +

+ license + last-commit + repo-top-language + repo-language-count +

+

+ Developed with the software and tools below.

-

- - - +

+ JavaScript + Nodemon + React + OpenAI + TypeScript + Expo + Express + JSON


-## Quick Links -- [ Quick Links](#-quick-links) -- [ Overview](#-overview) -- [ Features](#-features) -- [ Repository Structure](#-repository-structure) -- [ Modules](#modules) -- [ Getting Started](#-getting-started) - - [ Installation](#-installation) - - [ Running ChatGPT-App-React-Native-TypeScript](#-running-ChatGPT-App-React-Native-TypeScript) - - [ Tests](#-tests) -- [ Roadmap](#-roadmap) -- [ Contributing](#-contributing) -- [ License](#-license) -- [ Acknowledgments](#-acknowledgments) +## ๐Ÿ”— Quick Links + +> - [๐Ÿ“ Overview](#-overview) +> - [๐Ÿ“ฆ Features](#-features) +> - [๐Ÿ“‚ Repository Structure](#-repository-structure) +> - [๐Ÿงฉ Modules](#-modules) +> - [๐Ÿš€ Getting Started](#-getting-started) +> - [โš™๏ธ Installation](#-installation) +> - [๐Ÿค– Running ChatGPT-App-React-Native-TypeScript](#-running-ChatGPT-App-React-Native-TypeScript) +> - [๐Ÿงช Tests](#-tests) +> - [๐Ÿ›  Project Roadmap](#-project-roadmap) +> - [๐Ÿค Contributing](#-contributing) +> - [๐Ÿ“„ License](#-license) +> - [๐Ÿ‘ Acknowledgments](#-acknowledgments) --- -## Overview +## ๐Ÿ“ Overview -ChatGPT-App-React-Native-TypeScript is a project that aims to provide a user-friendly and intuitive chat application built with React Native and TypeScript. The core functionality of this app is centered around facilitating seamless communication between users through chat messages. Users can send and receive messages in real-time, making it easy to have engaging conversations. The value proposition of this project lies in its ability to provide a platform for users to connect and exchange information efficiently and conveniently. With its clean and modern design, this app offers a smooth user experience, making it an ideal solution for anyone looking for a reliable chat application. +ChatGPT-App-React-Native-TypeScript is a mobile application built using React Native and TypeScript. The app allows users to chat with an AI-powered language model called ChatGPT. By leveraging the power of natural language processing and machine learning, ChatGPT can understand and respond to user messages in a conversational manner. The app provides a user-friendly interface where users can input their messages and receive thoughtful and coherent responses from ChatGPT. With this app, users can engage in meaningful conversations, seek advice, get recommendations, or simply have fun interacting with an AI-powered chatbot. The project aims to bring the benefits of AI language models to mobile devices, making them accessible and enjoyable for users on the go. --- -## Features +## ๐Ÿ“ฆ Features + +| | Feature | Description | +|----|-------------------|---------------------------------------------------------------| +| โš™๏ธ | **Architecture** | The project is built using React Native and TypeScript. The architecture follows a client-server model with a React Native front-end and an Express.js back-end. | +| ๐Ÿ”ฉ | **Code Quality** | The codebase is well-structured and follows best practices. It utilizes TypeScript for type safety and has consistent coding style. | +| ๐Ÿ“„ | **Documentation** | The extent of documentation is not specified in the given information. It is recommended to check the project's README or documentation files for more details. | +| ๐Ÿ”Œ | **Integrations** | The project integrates with openai, react-native-safe-area-context, and react-native-web libraries. | +| ๐Ÿงฉ | **Modularity** | The codebase appears to be modular and reusable, with components like `Infomation.tsx`, `Message.tsx`, and `ListMessage.tsx` providing clear separation of concerns. | +| ๐Ÿงช | **Testing** | No information is provided about the testing frameworks or tools used in the project. It is recommended to check the project's documentation or codebase for testing details. | +| โšก๏ธ | **Performance** | The given information does not provide details on performance. Performance can be assessed by analyzing the code for efficient algorithms and optimization techniques. | +| ๐Ÿ›ก๏ธ | **Security** | The details about data protection and access control measures are not specified. It is important to review the project's codebase and documentation for security considerations. | +| ๐Ÿ“ฆ | **Dependencies** | The project has dependencies on libraries such as express, openai, react-native-safe-area-context, and react-native-web. | +| ๐Ÿš€ | **Scalability** | Without specific information, it's not possible to assess the project's ability to handle increased traffic and load. Scalability considerations should be reviewed in the project's codebase and architecture. | -| | Feature | Description | -|----|--------------------|--------------------------------------------------------------------------------------------------------------------| -| โš™๏ธ | **Architecture** | The codebase follows a client-server architecture, with React Native and TypeScript on the client side and a Node.js server using Express.js. | -| ๐Ÿ“„ | **Documentation** | The codebase lacks comprehensive documentation. There are some inline comments, but overall documentation is minimal. | -| ๐Ÿ”— | **Dependencies** | The project relies on various dependencies, including React Native, React Navigation, Axios, and Firebase. | -| ๐Ÿงฉ | **Modularity** | The codebase demonstrates modularity by organizing components into separate folders and files based on their functionality. | -| ๐Ÿงช | **Testing** | No information is available regarding the system's testing strategies and tools. | -| โšก๏ธ | **Performance** | It is difficult to assess the system's performance without further information. However, React Native and Node.js are known for their speed and efficiency. | -| ๐Ÿ” | **Security** | The codebase does not have explicit security measures. It relies on the security provided by Firebase for authentication and data storage. --- -## Repository Structure +## ๐Ÿ“‚ Repository Structure ```sh โ””โ”€โ”€ ChatGPT-App-React-Native-TypeScript/ โ”œโ”€โ”€ App.tsx โ”œโ”€โ”€ app.json - โ”œโ”€โ”€ components/ + โ”œโ”€โ”€ components โ”‚ โ”œโ”€โ”€ InputMessage.tsx โ”‚ โ”œโ”€โ”€ Layout.tsx โ”‚ โ”œโ”€โ”€ ListMessage.tsx โ”‚ โ””โ”€โ”€ Message.tsx - โ”œโ”€โ”€ constants/ + โ”œโ”€โ”€ constants โ”‚ โ””โ”€โ”€ constants.ts - โ”œโ”€โ”€ context/ + โ”œโ”€โ”€ context โ”‚ โ””โ”€โ”€ DataProvider.tsx - โ”œโ”€โ”€ helpers/ + โ”œโ”€โ”€ helpers โ”‚ โ””โ”€โ”€ getMessage.ts - โ”œโ”€โ”€ hooks/ + โ”œโ”€โ”€ hooks โ”‚ โ””โ”€โ”€ useFetchMessage.ts - โ”œโ”€โ”€ others/ โ”œโ”€โ”€ package-lock.json โ”œโ”€โ”€ package.json - โ”œโ”€โ”€ screens/ + โ”œโ”€โ”€ screens โ”‚ โ”œโ”€โ”€ HomeScreen.tsx โ”‚ โ””โ”€โ”€ Infomation.tsx - โ”œโ”€โ”€ server/ + โ”œโ”€โ”€ server โ”‚ โ”œโ”€โ”€ config.js โ”‚ โ”œโ”€โ”€ index.js โ”‚ โ”œโ”€โ”€ package-lock.json โ”‚ โ””โ”€โ”€ package.json โ”œโ”€โ”€ tsconfig.json - โ””โ”€โ”€ types/ + โ””โ”€โ”€ types โ””โ”€โ”€ types.d.ts - ``` --- -## Modules +## ๐Ÿงฉ Modules
. -| File | Summary | -| --- | --- | -| [App.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/App.tsx) | The `App.tsx` file in the repository is responsible for setting up the main application structure using React Native and TypeScript. It utilizes the `NavigationContainer` and `createNativeStackNavigator` components from React Navigation to define the app's navigation flow. Additionally, it includes a `DataProvider` component for managing global application state. The file renders two screens, HomeScreen and Infomation, and customizes their headers with styles and navigation options. | -| [app.json](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/app.json) | The code snippet in the components directory of the repository is responsible for rendering different chat message components in a React Native and TypeScript app. It includes components such as InputMessage, Layout, ListMessage, and Message. The code supports a chat-based application and contributes to the overall user interface and functionality of the app. | -| [package-lock.json](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/package-lock.json) | The code snippet in the ChatGPT-App-React-Native-TypeScript repository is responsible for managing the UI components, data providers, and helper functions of a chat application built using React Native and TypeScript. It facilitates inputting and displaying messages, fetching new messages, and maintaining app-wide constants. | -| [package.json](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/package.json) | This code snippet belongs to a React Native app that uses TypeScript. It includes components, context, hooks, and helpers for a chat interface. It relies on dependencies such as React, React Native, and React Navigation. The code focuses on managing chat messages and fetching data. | -| [tsconfig.json](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/tsconfig.json) | This code snippet is part of a React Native app built using TypeScript. It includes files for components, constants, context, helpers, hooks, screens, and types. The tsconfig.json file contains the compiler options for the TypeScript code. | +| File | Summary | +| --- | --- | +| [App.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/App.tsx) | This code snippet in the App.tsx file is responsible for setting up the navigation and screens in the ChatGPT-App-React-Native-TypeScript repository. It creates a stack navigator with two screens, HomeScreen and Infomation, and provides a navigation container. It also includes the DataProvider context for managing data. | +| [app.json](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/app.json) | This code snippet, located in the `app.json` file, configures various settings for the ChatGPT-App, such as the app name, version, orientation, icons, splash screen, and asset bundle patterns. | +| [package-lock.json](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/package-lock.json) | This code snippet is a crucial component in the ChatGPT-App-React-Native-TypeScript repository. It handles message retrieval and rendering within the app's chat interface. | +| [package.json](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/package.json) | This code snippet is part of the ChatGPT-App-React-Native-TypeScript repository. It includes various components, screens, and helpers for a chat application. The package.json file contains dependencies and scripts related to the app's development and deployment. | +| [tsconfig.json](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/tsconfig.json) | This code snippet, located in the tsconfig.json file, extends the base configuration and enables strict mode for the TypeScript compiler in the React Native app. |
types -| File | Summary | -| --- | --- | -| [types.d.ts](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/types/types.d.ts) | The code snippet in the types/types.d.ts file defines the interface for MessageType, which represents a message in the ChatGPT app. It includes properties such as id, creation time, model, text, user information, and usage statistics. This file is crucial for ensuring consistent data structure and type checking throughout the codebase. | +| File | Summary | +| --- | --- | +| [types.d.ts](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/types/types.d.ts) | The `types.d.ts` file in the `types` directory of the repository defines the structure of the `MessageType` interface. This interface represents the structure of a message object used in the ChatGPT app. It includes properties like the message ID, creation timestamp, text content, user information, and usage statistics. |
context -| File | Summary | -| --- | --- | -| [DataProvider.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/context/DataProvider.tsx) | The `DataProvider` component in the `context` directory manages and provides data to its children components through the `DataContext`. It uses React's `useState` hook to manage the `textInput` state and updates it through the `setTextInput` function. | +| File | Summary | +| --- | --- | +| [DataProvider.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/context/DataProvider.tsx) | This code snippet is located in the `context/DataProvider.tsx` file and is part of the React Native TypeScript chat application repository. It creates a `DataProvider` component using React's context API to manage shared data state. The `DataProvider` component wraps its children components and provides a `textInput` state and a `setTextInput` function to update it. |
constants -| File | Summary | -| --- | --- | -| [constants.ts](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/constants/constants.ts) | The code snippet in the constants file provides the API URL for the ChatGPT app. It exports the constant API_URL with the value http://10.0.2.2:3000, which is used for communication between the app and the server. | +| File | Summary | +| --- | --- | +| [constants.ts](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/constants/constants.ts) | The code snippet in `constants/constants.ts` exports the API_URL constant, which is set to `http://10.0.2.2:3000`. This constant likely represents the URL endpoint of the API used by the parent repository's React Native app. |
server -| File | Summary | -| --- | --- | -| [index.js](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/server/index.js) | This code snippet is the server-side implementation of a chat application using Express.js and OpenAI API. It handles incoming chat requests and sends them to the OpenAI API for generating responses. The server listens on port 3000 and exposes a `/api/chat` endpoint for chat interactions. | -| [config.js](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/server/config.js) | This code snippet provides the configuration for the ChatGPT application using environment variables. It sets up the OpenAI API key and organization using the values provided in the.env file. This allows the application to securely communicate with the OpenAI API. | -| [package-lock.json](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/server/package-lock.json) | This code snippet contains critical features such as the input message component, message list component, and data provider. It plays a crucial role in the ChatGPT-App-React-Native-TypeScript repository's architecture by handling user input, displaying messages, and managing data for the chat application. The directory structure suggests a modular and organized approach to code organization. | -| [package.json](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/server/package.json) | This code snippet is part of a React Native app for a ChatGPT application. It includes components, context, hooks, and helpers. The codebase also has a server using Express.js and OpenAI for handling requests. | +| File | Summary | +| --- | --- | +| [index.js](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/server/index.js) | This code snippet is part of a server-side component in the ChatGPT-App-React-Native-TypeScript repository. It handles the incoming chat messages and uses the OpenAI API to generate responses. The server is built with Express, and it exposes an endpoint for receiving chat messages and returning AI-generated responses. | +| [config.js](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/server/config.js) | This code snippet in the server/config.js file is responsible for configuring the environment variables required for the ChatGPT-App-React-Native-TypeScript repository. It imports the dotenv package and sets up the necessary environment variables. | +| [package-lock.json](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/server/package-lock.json) | The code snippet in this repository is related to a React Native TypeScript app called ChatGPT. It includes components for inputting and displaying messages, along with constants and context for managing data. The code focuses on the app's UI and data management functionality. | +| [package.json](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/server/package.json) | The code snippet in the `server` directory contains the package.json file which defines the dependencies and scripts for running the server. It specifies the required packages for the server to function, such as `express`, `cors`, and `openai`. It also includes scripts for running the server in development mode (`dev`) and in production mode (`start`). |
screens -| File | Summary | -| --- | --- | -| [Infomation.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/screens/Infomation.tsx) | The code snippet is a React Native component called Infomation that displays a text saying Infomation in the center of the screen. It is part of the ChatGPT-App-React-Native-TypeScript repository. | -| [HomeScreen.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/screens/HomeScreen.tsx) | This code snippet, located in the `screens` directory within the repository, defines the main screen of the ChatGPT app. It renders components for displaying and inputting messages within a layout. | +| File | Summary | +| --- | --- | +| [Infomation.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/screens/Infomation.tsx) | This code snippet represents the `Infomation` screen component in the ChatGPT-App-React-Native-TypeScript repository. It renders an informational page with a centered text element. | +| [HomeScreen.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/screens/HomeScreen.tsx) | The code snippet in HomeScreen.tsx is a component that renders the home screen of the ChatGPT-App-React-Native-TypeScript repository. It imports and renders other components such as Layout, ListMessage, and InputMessage to display a chat interface. |
components -| File | Summary | -| --- | --- | -| [InputMessage.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/components/InputMessage.tsx) | The code snippet is a React Native component called InputMessage. It allows users to enter and send messages in a chat interface. It retrieves user input, sends the message, and updates the state accordingly. | -| [Layout.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/components/Layout.tsx) | This code snippet defines the Layout component in a React Native app. It provides a container with a dark background color and centralizes the children components. | -| [Message.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/components/Message.tsx) | The `Message.tsx` file is a React Native component that displays a chat message. It includes features such as copying the message to the clipboard and showing a toast notification. The component's appearance and behavior depend on the user's name and avatar. | -| [ListMessage.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/components/ListMessage.tsx) | This code snippet is a React Native component called ListMessage that displays a list of messages. It fetches messages from an API based on user input, updates the list dynamically, and includes a pull-to-refresh feature. The component uses various hooks and context to manage state and data fetching. | +| File | Summary | +| --- | --- | +| [InputMessage.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/components/InputMessage.tsx) | The `InputMessage.tsx` component in the `ChatGPT-App-React-Native-TypeScript` repository is responsible for rendering an input field and a send button for the user to send messages. The component manages the state of the input field and sends the message to the data context when the send button is pressed. | +| [Layout.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/components/Layout.tsx) | The Layout component in the ChatGPT-App-React-Native-TypeScript repository provides a wrapper for the content of the app, including a status bar with a dark background color and centered content. | +| [Message.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/components/Message.tsx) | The `Message.tsx` component in the `ChatGPT-App-React-Native-TypeScript` repository displays a chat message with the sender's name, avatar, and text. It allows the user to copy the text to the clipboard. | +| [ListMessage.tsx](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/components/ListMessage.tsx) | The ListMessage component in the ChatGPT-App-React-Native-TypeScript repository is responsible for displaying a list of messages. It fetches new messages, adds user input to the list, and updates the list with new messages. The component also handles refreshing the list when needed. |
hooks -| File | Summary | -| --- | --- | -| [useFetchMessage.ts](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/hooks/useFetchMessage.ts) | The `useFetchMessage` hook in the `hooks` directory is responsible for fetching a message based on user input. It uses React's `useState` and `useEffect` hooks to manage state and perform the API call. It returns the fetched message data and loading status. | +| File | Summary | +| --- | --- | +| [useFetchMessage.ts](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/hooks/useFetchMessage.ts) | This code snippet, located in the `hooks` directory, is part of a React Native TypeScript app. It defines a custom hook called `useFetchMessage` that handles fetching a message and its loading state. The `useFetchMessage` hook takes a message as input and returns the fetched message and a loading indicator. |
helpers -| File | Summary | -| --- | --- | -| [getMessage.ts](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/helpers/getMessage.ts) | This code snippet is a helper function that makes an API call to retrieve a response message. It takes a user input message, sends it to a chatbot model, and returns the generated response. The function is used in the ChatGPT-App-React-Native-TypeScript repository for handling message retrieval. | +| File | Summary | +| --- | --- | +| [getMessage.ts](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/master/helpers/getMessage.ts) | This code snippet, located in the helpers/getMessage.ts file, is responsible for sending a message to an API endpoint and receiving a response. It uses the fetch function to make a POST request, passing the message as a parameter. The response from the API is then returned. |
--- -## Getting Started +## ๐Ÿš€ Getting Started ***Requirements*** Ensure you have the following dependencies installed on your system: -* TypeScript: `โ–บ INSERT-VERSION-HERE` -* `โ–บ ...` -* `โ–บ ...` +* **TypeScript**: `version x.y.z` -### Installation +### โš™๏ธ Installation 1. Clone the ChatGPT-App-React-Native-TypeScript repository: + ```sh git clone https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript ``` 2. Change to the project directory: + ```sh cd ChatGPT-App-React-Native-TypeScript ``` 3. Install the dependencies: + ```sh npm install ``` -### Running ChatGPT-App-React-Native-TypeScript +### ๐Ÿค– Running ChatGPT-App-React-Native-TypeScript + Use the following command to run ChatGPT-App-React-Native-TypeScript: + ```sh npm run build && node dist/main.js ``` -### Tests +### ๐Ÿงช Tests + To execute tests, run: + ```sh npm test ``` --- -## Project Roadmap +## ๐Ÿ›  Project Roadmap - [X] `โ–บ INSERT-TASK-1` - [ ] `โ–บ INSERT-TASK-2` @@ -230,28 +246,28 @@ npm test --- -## Contributing +## ๐Ÿค Contributing Contributions are welcome! Here are several ways you can contribute: -- **[Submit Pull Requests](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs. -- **[Join the Discussions](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/discussions)**: Share your insights, provide feedback, or ask questions. -- **[Report Issues](https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript/issues)**: Submit bugs found or log feature requests for ChatGPT-App-React-Native-TypeScript. +- **[Submit Pull Requests](https://github/Yuberley/ChatGPT-App-React-Native-TypeScript/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs. +- **[Join the Discussions](https://github/Yuberley/ChatGPT-App-React-Native-TypeScript/discussions)**: Share your insights, provide feedback, or ask questions. +- **[Report Issues](https://github/Yuberley/ChatGPT-App-React-Native-TypeScript/issues)**: Submit bugs found or log feature requests for Chatgpt-app-react-native-typescript.
-Contributing Guidelines + Contributing Guidelines 1. **Fork the Repository**: Start by forking the project repository to your GitHub account. 2. **Clone Locally**: Clone the forked repository to your local machine using a Git client. ```sh - git clone + git clone https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript ``` 3. **Create a New Branch**: Always work on a new branch, giving it a descriptive name. ```sh git checkout -b new-feature-x ``` 4. **Make Your Changes**: Develop and test your changes locally. -5. **Commit Your Changes**: Commit with a clear and concise message describing your updates. +5. **Commit Your Changes**: Commit with a clear message describing your updates. ```sh git commit -m 'Implemented new feature x.' ``` @@ -267,13 +283,13 @@ Once your PR is reviewed and approved, it will be merged into the main branch. --- -## License +## ๐Ÿ“„ License This project is protected under the [SELECT-A-LICENSE](https://choosealicense.com/licenses) License. For more details, refer to the [LICENSE](https://choosealicense.com/licenses/) file. --- -## Acknowledgments +## ๐Ÿ‘ Acknowledgments - List any resources, contributors, inspiration, etc. here. diff --git a/mkdocs.yml b/mkdocs.yml index 32607904..24eef4f7 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,25 +1,39 @@ site_name: readme-ai -site_description: Automated README generation for your GitHub repositories. -#site_url: https:// +repo_url: https://github.com/eli64s/readme-ai +site_description: "A tool to generate beautiful README.md files for your projects." theme: - name: "material" - custom_dir: docs/overrides + icon: + repo: fontawesome/brands/github-alt + name: material palette: - - scheme: "default" - primary: "blueviolet" - accent: "deeporange" - media: "(prefers-color-scheme: light)" - toggle: - icon: "material/weather-night" - name: "Switch to dark mode" - - scheme: "slate" - primary: "blueviolet" - accent: "deeporange" - media: "(prefers-color-scheme: dark)" - toggle: - icon: "material/weather-sunny" - name: "Switch to light mode" + primary: "gray" + accent: "white" + text: "blue" + code: "purple" + link: "blue" + background: "gray" + +nav: + - Home: index.md + - Installation and Setup: + - "Installation": installation.md + - "Pip": installation.md + - "Docker": installation.md + - "From Source": installation.md + - Quickstart: + - "Readme-ai CLI": quickstart.md + - "Readme-ai UI": quickstart.md + - Examples: + - "Examples": examples.md + - Features: + - "Features": features.md + - Configuration: + - "Project Structure": configuration.md + - "Command Line Arguments": configuration.md + - Concepts: concepts.md + - Contributing: contribute.md + markdown_extensions: - admonition - pymdownx.highlight @@ -27,15 +41,19 @@ markdown_extensions: - pymdownx.superfences - attr_list - md_in_html + extra_css: - css/termynal.css - css/custom.css + extra_javascript: - js/termynal.js - js/custom.js + extra: version: provider: mike + plugins: - mkdocstrings - mike: diff --git a/poetry.lock b/poetry.lock index 2b593cbb..4d96f18d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "aiohttp" @@ -1157,6 +1157,22 @@ urllib3 = ">=1.25.10,<3.0" [package.extras] tests = ["coverage (>=6.0.0)", "flake8", "mypy", "pytest (>=7.0.0)", "pytest-asyncio", "pytest-cov", "pytest-httpserver", "tomli", "tomli-w", "types-requests"] +[[package]] +name = "setuptools" +version = "69.0.3" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "setuptools-69.0.3-py3-none-any.whl", hash = "sha256:385eb4edd9c9d5c17540511303e39a147ce2fc04bc55289c322b9e5904fe2c05"}, + {file = "setuptools-69.0.3.tar.gz", hash = "sha256:be1af57fc409f93647f2e8e4573a142ed38724b8cdd389706a867bb4efcf1e78"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.1)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] + [[package]] name = "smmap" version = "5.0.1" @@ -1467,4 +1483,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.8.1,<4.0.0" -content-hash = "493d5d80588d26e26d3cc920d8bbcfe2001607c4c6f7ee462203c1c09f6bc59d" +content-hash = "26ed07190ccee7c717de1d64aa943131a490f92f80d4312cad40c542e1dbbb90" diff --git a/pyproject.toml b/pyproject.toml index b815940f..847b436c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "readmeai" -version = "0.4.0988" +version = "0.4.0989" description = "๐Ÿš€ Generate beautiful README.md files from the terminal using GPT LLM APIs ๐Ÿ’ซ" authors = ["Eli <0x.eli.64s@gmail.com>"] license = "MIT" @@ -54,6 +54,7 @@ tenacity = "^8.2.2" tiktoken = "^0.4.0" toml = "^0.10.2" pydantic = ">=1.10.9,<2.0.0" +setuptools = "^69.0.3" [tool.poetry.dev-dependencies] pytest = "*" diff --git a/readmeai/config/enums.py b/readmeai/config/enums.py index b2bd544f..66e8987f 100644 --- a/readmeai/config/enums.py +++ b/readmeai/config/enums.py @@ -28,7 +28,7 @@ def file_url_template(self): """Gets the file URL template for the Git service.""" return { GitService.LOCAL: "{file_path}", - GitService.GITHUB: "https://github.com/{full_name}/blob/main/{file_path}", + GitService.GITHUB: "https://github.com/{full_name}/blob/master/{file_path}", GitService.GITLAB: "https://gitlab.com/{full_name}/-/blob/master/{file_path}", GitService.BITBUCKET: "https://bitbucket.org/{full_name}/src/master/{file_path}", }.get(self, None) @@ -60,3 +60,4 @@ class ImageOptions(str, Enum): GREY = "https://img.icons8.com/external-tal-revivo-filled-tal-revivo/96/external-markdown-a-lightweight-markup-language-with-plain-text-formatting-syntax-logo-filled-tal-revivo.png" PURPLE = "https://img.icons8.com/external-tal-revivo-duo-tal-revivo/100/external-markdown-a-lightweight-markup-language-with-plain-text-formatting-syntax-logo-duo-tal-revivo.png" YELLOW = "https://img.icons8.com/pulsar-color/96/markdown.png" + CLOUD = "https://cdn-icons-png.flaticon.com/512/6295/6295417.png" diff --git a/readmeai/config/settings.py b/readmeai/config/settings.py index 121af3f4..cbd295f4 100644 --- a/readmeai/config/settings.py +++ b/readmeai/config/settings.py @@ -2,11 +2,11 @@ import re from importlib import resources +import pkg_resources from pathlib import Path from typing import Dict, List, Optional, Union from urllib.parse import urlparse, urlsplit -import pkg_resources from pydantic import BaseModel, validator from readmeai.config.enums import GitService @@ -38,6 +38,31 @@ def validate_repository(cls, value: Union[str, Path]) -> Union[str, Path]: return value raise ValueError(f"Invalid repository URL or path: {value}") + @classmethod + def validate_full_name(cls, value: Optional[str], values: dict) -> str: + """Validator for getting the full name of the repository.""" + url_or_path = values.get("repository") + + path = ( + url_or_path if isinstance(url_or_path, Path) else Path(url_or_path) + ) + if path.exists(): + return str(path.name) + + patterns = { + GitService.GITHUB: r"https?://github.com/([^/]+)/([^/]+)", + GitService.GITLAB: r"https?://gitlab.com/([^/]+)/([^/]+)", + GitService.BITBUCKET: r"https?://bitbucket.org/([^/]+)/([^/]+)", + } + + for _, pattern in patterns.items(): + match = re.match(pattern, url_or_path) + if match: + user_name, repo_name = match.groups() + return f"{user_name}/{repo_name}" + + raise ValueError("Error: invalid repository URL or path.") + @classmethod def set_host(cls, value: Optional[str], values: dict) -> str: """Sets the Git service host from the repository provided.""" @@ -80,31 +105,6 @@ def set_source(cls, value: Optional[str], values: dict) -> str: return service return GitService.LOCAL - @classmethod - def validate_full_name(cls, value: Optional[str], values: dict) -> str: - """Validator for getting the full name of the repository.""" - url_or_path = values.get("repository") - - path = ( - url_or_path if isinstance(url_or_path, Path) else Path(url_or_path) - ) - if path.exists(): - return str(path.name) - - patterns = { - GitService.GITHUB: r"https?://github.com/([^/]+)/([^/]+)", - GitService.GITLAB: r"https?://gitlab.com/([^/]+)/([^/]+)", - GitService.BITBUCKET: r"https?://bitbucket.org/([^/]+)/([^/]+)", - } - - for _, pattern in patterns.items(): - match = re.match(pattern, url_or_path) - if match: - user_name, repo_name = match.groups() - return f"{user_name}/{repo_name}" - - raise ValueError("Error: invalid repository URL or path.") - class CliSettings(BaseModel): """CLI options for the readme-ai application.""" @@ -177,12 +177,12 @@ class MarkdownSettings(BaseModel): badges_skills: str contribute: str features: str - getting_started: str header: str image: str modules: str modules_widget: str overview: str + quickstart: str slogan: str tables: str toc: str @@ -224,7 +224,7 @@ class ConfigHelper(BaseModel): """Helper class to load additional configuration files.""" conf: AppConfigModel - dependency_files: List[str] = [] + dependency_files: Dict[str, str] = {} ignore_files: Dict[str, List[str]] = {} language_names: Dict[str, str] = {} language_setup: Dict[str, List[str]] = {} @@ -250,9 +250,7 @@ def load_helper_files(self): conf_dict = _get_config_dict(handler, path) if "dependency_files" in conf_dict: - self.dependency_files.extend( - conf_dict.get("dependency_files", []) - ) + self.dependency_files.update(conf_dict["dependency_files"]) if "ignore_files" in conf_dict: self.ignore_files.update(conf_dict["ignore_files"]) if "language_names" in conf_dict: diff --git a/readmeai/core/model.py b/readmeai/core/model.py index 7f230b1f..c241e82c 100644 --- a/readmeai/core/model.py +++ b/readmeai/core/model.py @@ -29,7 +29,7 @@ get_token_count, truncate_tokens, ) -from readmeai.core.utils import format_sentence +from readmeai.core.utils import extract_markdown_table, format_sentence class ModelHandler: @@ -177,7 +177,7 @@ async def _generate_summaries( Returns ------- List[Tuple[str, str]] - List of tuples containing the file path and the generated summary or error message. + List of tuples containing the file path and the generated response. """ code_summaries = [] @@ -256,7 +256,7 @@ async def generate_text( summary = ( format_sentence(summary) if index != "features" - else summary + else extract_markdown_table(summary) ) self.cache[prompt] = summary self.logger.info(f"Response: {index} - {summary}") diff --git a/readmeai/core/preprocess.py b/readmeai/core/preprocess.py index cdac2f24..03081641 100644 --- a/readmeai/core/preprocess.py +++ b/readmeai/core/preprocess.py @@ -1,139 +1,138 @@ -"""Processes the input codebase for analysis and metadata extraction.""" +"""Preprocesses the repository files and extract metadata.""" +from dataclasses import dataclass, field from pathlib import Path -from typing import Dict, Generator, List, Tuple +from typing import Generator, List, Tuple -from readmeai.config import enums, settings +from readmeai.config import settings from readmeai.core.logger import Logger from readmeai.core.tokens import get_token_count -from readmeai.core.utils import flatten_list, should_ignore +from readmeai.core.utils import should_ignore from readmeai.parsers.factory import parser_factory logger = Logger(__name__) +GITHUB_WORKFLOWS_PATH = ".github/workflows" PARSERS = parser_factory() +@dataclass +class FileData: + """Data class to store repository file information.""" + + path: Path + name: str + content: str + extension: str + language: str = field(init=False) + tokens: int = 0 + dependencies: List[str] = field(default_factory=list) + + def __post_init__(self): + """Initializes the FileData class.""" + self.extension = self.name.split(".")[-1] if "." in self.name else "" + self.language = self.extension.lower() + + class RepoProcessor: - """Handles preprocessing of the input codebase.""" + """Processes the repository files and generates a list of FileData.""" def __init__( self, config: settings.AppConfig, conf_helper: settings.ConfigHelper, ): + """Initializes the RepoProcessor class.""" self.config = config self.config_helper = conf_helper self.language_names = conf_helper.language_names self.language_setup = conf_helper.language_setup - self.encoding_name = config.llm.encoding - - def analyze(self, temp_dir: str) -> List[Dict]: - """Analyzes a local or remote git repository.""" - contents = self.generate_contents(temp_dir) - repo_source = self.config.git.source - if repo_source != enums.GitService.LOCAL: - logger.info(f"Tokenizing content from host: {repo_source}") - contents = self.tokenize_content(contents) + def create_file_data(self, file_info: Tuple[str, Path, str]) -> FileData: + """Creates a FileData instance from the file information.""" + name, path, content = file_info + return FileData(name=name, path=path, content=content, extension="") - contents = self.process_language_mapping(contents) - - return contents - - def get_dependencies( - self, temp_dir: str = None - ) -> Tuple[List[str], Dict[str, str]]: - """Extracts the dependencies of the user's repository.""" - contents = self.analyze(temp_dir) - dependencies = self.get_dependency_file_contents(contents) - attributes = ["extension", "language", "name"] - dependencies.extend(self.get_unique_contents(contents, attributes)) - return list(set(dependencies)), self.get_file_contents(contents) - - def generate_contents(self, repo_path: str) -> List[Dict]: - """Generates a List of Dict of file information.""" - repo_path = Path(repo_path) - - data = list(self.generate_file_info(repo_path)) - - contents = [] - for name, path, content in data: - extension = Path(name).suffix.lstrip(".") - contents.append( - { - "name": name, - "path": path, - "content": content, - "extension": extension, - } - ) - return contents - - def get_dependency_file_contents(self, contents: List[Dict]) -> List[str]: + def extract_dependencies(self, file_data: FileData) -> List[str]: """Extracts the dependency file contents using the factory pattern.""" parsers = PARSERS - filtered = [c for c in contents if c["name"] in parsers] - if not filtered: + if file_data.name not in parsers: return [] - parsed_contents = [] - for content in filtered: - parser = parsers.get(content["name"]) - parsed_content = parser.parse(content=content["content"]) - parsed_contents.append(parsed_content) - logger.info( - f"Dependency file found {content['name']}\n\t{parsed_content}" - ) - return flatten_list(parsed_contents) + logger.info( + f"Dependency file found: {file_data.name} - {file_data.content}" + ) + parser = parsers.get(file_data.name) + return parser.parse(content=file_data.content) + + def generate_contents(self, repo_path: str) -> List[FileData]: + """Generates a List of Dict of file information.""" + if isinstance(repo_path, str): + repo_path = Path(repo_path) + + return [file_data for file_data in self.generate_file_info(repo_path)] def generate_file_info( self, repo_path: Path - ) -> Generator[Tuple[str, Path, str], None, None]: - """Generates a tuple of file information.""" + ) -> Generator[FileData, None, None]: + """ + Generates FileData instances for each file in the repository. + Ignores files as per the `readmeai.settings.ignore_files.toml` + configuration and handles special cases like GitHub workflows. + """ for file_path in repo_path.rglob("*"): - if should_ignore(self.config_helper, file_path): + if not file_path.is_file() or should_ignore( + self.config_helper, file_path + ): continue - if file_path.is_file(): - if ".github/workflows" in str( - file_path.relative_to(repo_path) - ): - yield "github actions", file_path.relative_to( - repo_path - ), "" + relative_path = file_path.relative_to(repo_path) + relative_path_str = str(relative_path) + + if GITHUB_WORKFLOWS_PATH in relative_path_str: + yield FileData( + name="github actions", + path=relative_path, + content="", + extension="", + ) + else: try: with file_path.open(encoding="utf-8") as file: content = file.read() - relative_path = file_path.relative_to(repo_path) - yield file_path.name, relative_path, content - except UnicodeDecodeError: + file_data = FileData( + name=file_path.name, + path=relative_path, + content=content, + extension="", + ) + file_data.dependencies = self.extract_dependencies( + file_data + ) + yield file_data + + except (UnicodeDecodeError, IOError) as exc_info: + logger.warning( + f"Error reading file {file_path}: {exc_info}" + ) continue - def get_file_contents(self, contents: Dict) -> Dict[str, str]: - """Extracts the file contents from the list of dicts.""" - return {content["path"]: content["content"] for content in contents} - - def get_unique_contents( - self, contents: Dict, keys: List[str] - ) -> List[str]: - """Extracts the unique contents from the list of dicts.""" - unique_contents = {data[key] for key in keys for data in contents} - return list(unique_contents) - - def process_language_mapping(self, contents: List[Dict]) -> List[Dict]: + def language_mapper(self, contents: List[FileData]) -> List[FileData]: """Maps file extensions to their programming languages.""" for content in contents: - content["language"] = self.language_names.get( - content["extension"], "" + content.language = self.language_names.get( + content.extension, "" ).lower() return contents - def tokenize_content(self, contents: List[Dict]) -> List[Dict]: - """Tokenize the content of each file.""" + def tokenize_content(self, contents: List[FileData]) -> List[FileData]: + """Tokenize each file content and return the token count.""" + if self.config.cli.offline is True: + return contents + for content in contents: - content["tokens"] = get_token_count( - content["content"], self.encoding_name + content.tokens = get_token_count( + content.content, self.config.llm.encoding ) return contents diff --git a/readmeai/core/utils.py b/readmeai/core/utils.py index 480e5cbe..ee48789f 100644 --- a/readmeai/core/utils.py +++ b/readmeai/core/utils.py @@ -1,4 +1,4 @@ -"""Utility helper functions for the README-AI package.""" +"""Utility helper functions for the readmeai package.""" import re from importlib import resources @@ -13,50 +13,17 @@ logger = Logger(__name__) -def is_valid_url(url: str) -> bool: - """Validate a URL string. - - Parameters - ---------- - url - The URL string to validate. - - Returns - ------- - True if the URL is valid, False otherwise. +def extract_markdown_table(text: str) -> str: """ - regex = re.compile( - r"^(?:http|ftp)s?://" # http:// or https:// - r"(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|" # domain - r"localhost|" # localhost - r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|" # ipv4 - r"\[?[A-F0-9]*:[A-F0-9:]+\]?)" # ipv6 - r"(?::\d+)?" # optional port - r"(?:/?|[/?]\S+)$", - re.IGNORECASE, - ) - return re.match(regex, url) is not None + Pattern to match a Markdown table. Looks for a + header row with at least two columns. followed by + a separator row, and then one or more data rows. + """ + pattern = r"(\|.*\|.*\n\|[-: ]+\|[-: ]+\|.*\n(?:\|.*\|.*\n)*)" + match = re.search(pattern, text, re.MULTILINE) -def flatten_list(nested_list: List[List]) -> List: - """Flatten a nested list (list of lists converted to a single list). - - Parameters - ---------- - nested_list - The nested list to flatten. - - Returns - ------- - A flattened list. - """ - result = [] - for item in nested_list: - if isinstance(item, list): - result.extend(flatten_list(item)) - else: - result.append(item) - return result + return match.group(0) if match else "" def format_sentence(text: str) -> str: @@ -96,22 +63,50 @@ def format_sentence(text: str) -> str: return text.strip() -def get_relative_path(absolute_path: str, base_path: str) -> str: - """Get the relative path of a file. +def is_valid_url(url: str) -> bool: + """Validate a URL string. Parameters ---------- - absolute_path - Absolute path to the file i.e. the full path on the local machine. - base_path - Base path to use for the relative path i.e. the project root. + url + The URL string to validate. Returns ------- - The relative path string of the file. + True if the URL is valid, False otherwise. """ - absolute_path = Path(absolute_path) - return absolute_path.relative_to(base_path) + regex = re.compile( + r"^(?:http|ftp)s?://" # http:// or https:// + r"(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|" # domain + r"localhost|" # localhost + r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|" # ipv4 + r"\[?[A-F0-9]*:[A-F0-9:]+\]?)" # ipv6 + r"(?::\d+)?" # optional port + r"(?:/?|[/?]\S+)$", + re.IGNORECASE, + ) + return re.match(regex, url) is not None + + +def flatten_list(nested_list: List[List]) -> List: + """Flatten a nested list (list of lists converted to a single list). + + Parameters + ---------- + nested_list + The nested list to flatten. + + Returns + ------- + A flattened list. + """ + result = [] + for item in nested_list: + if isinstance(item, list): + result.extend(flatten_list(item)) + else: + result.append(item) + return result def get_resource_path(package: str, resource_name: str) -> Path: @@ -127,6 +122,7 @@ def get_resource_path(package: str, resource_name: str) -> Path: Returns ------- + Path The path to the resource file. """ try: @@ -183,7 +179,7 @@ def should_ignore(conf_helper: ConfigHelper, file_path: Path) -> bool: for directory in ignore_files["directories"] ) ): - logger.debug(f"Ignoring item: {file_path.name}") + # logger.debug(f"Ignoring item: {file_path.name}") return True return False diff --git a/readmeai/main.py b/readmeai/main.py index 4179ebce..6ba33680 100644 --- a/readmeai/main.py +++ b/readmeai/main.py @@ -9,6 +9,7 @@ import shutil import tempfile import traceback +from typing import List from readmeai.cli.options import prompt_for_custom_image from readmeai.config.enums import ImageOptions @@ -22,7 +23,7 @@ ) from readmeai.core.logger import Logger from readmeai.core.model import ModelHandler -from readmeai.core.preprocess import RepoProcessor +from readmeai.core.preprocess import FileData, RepoProcessor from readmeai.markdown.builder import ReadmeBuilder, build_readme_md from readmeai.services.git_operations import clone_repo_to_temp_dir @@ -32,84 +33,75 @@ async def readme_agent(conf: AppConfig, conf_helper: ConfigHelper) -> None: """Orchestrates the README file generation process.""" repo_url = conf.git.repository - temp_dir = await asyncio.to_thread(tempfile.mkdtemp) + try: - await clone_repo_to_temp_dir(repo_url, temp_dir) - - parser = RepoProcessor(conf, conf_helper) - dependencies, file_context = parser.get_dependencies(temp_dir) - summaries = [(path, content) for path, content in file_context.items()] - repo_tree = ReadmeBuilder( - conf, conf_helper, dependencies, summaries, temp_dir - ).md_tree - - logger.info(f"Project dependencies: {dependencies}") - logger.info(f"Project structure:\n{repo_tree}") - - async with ModelHandler(conf).use_api() as llm: - if conf.cli.offline is False: - prompts = [ - { - "type": "summaries", - "context": { - "repo": repo_url, - "tree": repo_tree, - "dependencies": dependencies, - "summaries": summaries, - }, - }, - { - "type": "features", - "context": { - "repo": repo_url, - "tree": repo_tree, - "summaries": file_context, - }, - }, - { - "type": "overview", - "context": { - "name": conf.git.name, - "repo": repo_url, - "summaries": summaries, - }, - }, - { - "type": "slogan", - "context": { - "repo": repo_url, - "summaries": summaries, - }, - }, - ] - responses = await llm.batch_text_generator(prompts) - ( - summaries_response, - features_response, - overview_response, - slogan_response, - ) = (response for response in responses) - summaries = summaries_response - conf.md.features = conf.md.features.format(features_response) - conf.md.overview = conf.md.overview.format(overview_response) - conf.md.slogan = slogan_response - else: - ( - summaries, - conf.md.features, - conf.md.overview, - conf.md.slogan, - ) = ( - [ - (str(file_path), conf.md.default) - for file_path, _ in file_context.items() - ], - conf.md.features.format(conf.md.default), - conf.md.overview.format(conf.md.default), - conf.md.default, - ) - - build_readme_md(conf, conf_helper, dependencies, summaries, temp_dir) + with tempfile.TemporaryDirectory() as temp_dir: + await clone_repo_to_temp_dir(repo_url, temp_dir) + + repo_processor = RepoProcessor(conf, conf_helper) + file_context = repo_processor.generate_contents(temp_dir) + file_context = repo_processor.language_mapper(file_context) + file_context = repo_processor.tokenize_content(file_context) + + dependencies = set() + for file_data in file_context: + dependencies.update(file_data.dependencies) + dependencies.add(file_data.language) + dependencies.add(file_data.name) + dependencies.add(file_data.extension) + + dependencies = list(dependencies) + code_files = [(data.path, data.content) for data in file_context] + summaries = code_files.copy() + conf.md.tree = ReadmeBuilder( + conf, conf_helper, dependencies, summaries, temp_dir + ).md_tree + + log_file_data(file_context, list(dependencies), conf.md.tree) + + async with ModelHandler(conf).use_api() as llm: + if not conf.cli.offline: + prompts = await generate_prompts( + conf, file_context, dependencies, summaries + ) + responses = await llm.batch_text_generator(prompts) + ( + summaries_response, + features_response, + overview_response, + slogan_response, + ) = responses + summaries = summaries_response + conf.md.features = conf.md.features.format( + features_response + ) + conf.md.overview = conf.md.overview.format( + overview_response + ) + conf.md.slogan = slogan_response + else: + ( + summaries, + conf.md.features, + conf.md.overview, + conf.md.slogan, + ) = ( + [ + (str(file_path), conf.md.default) + for file_path, _ in summaries + ], + conf.md.features.format(conf.md.default), + conf.md.overview.format(conf.md.default), + conf.md.default, + ) + + build_readme_md( + conf, conf_helper, dependencies, summaries, temp_dir + ) + + logger.info( + f"README.md file generated successfully @ {conf.files.output}" + ) except Exception as exc_info: logger.error( @@ -118,7 +110,52 @@ async def readme_agent(conf: AppConfig, conf_helper: ConfigHelper) -> None: finally: shutil.rmtree(temp_dir) - logger.info(f"README file successfully generated at {conf.files.output}") + +async def generate_prompts( + conf: AppConfig, + file_context: list[FileData], + dependencies: List[str], + summaries: List[str], +) -> List[dict]: + """Generates the prompts to be used by the LLM API.""" + return [ + {"type": prompt_type, "context": context} + for prompt_type, context in [ + ( + "summaries", + { + "repo": conf.git.repository, + "tree": conf.md.tree, + "dependencies": file_context, + "summaries": summaries, + }, + ), + ( + "features", + { + "repo": conf.git.repository, + "dependencies": dependencies, + "files": file_context, + }, + ), + ( + "overview", + { + "name": conf.git.name, + "repo": conf.git.repository, + "summaries": summaries, + }, + ), + ( + "slogan", + { + "name": conf.git.name, + "repo": conf.git.repository, + "summaries": summaries, + }, + ), + ] + ] def main( @@ -154,7 +191,7 @@ def main( ) log_settings(conf) - export_to_environment(conf, api_key) + setup_environment(conf, api_key) asyncio.run(readme_agent(conf, conf_helper)) @@ -195,12 +232,13 @@ def update_settings( return conf -def export_to_environment(config: AppConfig, api_key: str) -> None: +def setup_environment(config: AppConfig, api_key: str) -> None: """Set environment variables for the CLI application.""" if api_key is not None: os.environ["OPENAI_API_KEY"] = api_key elif "OPENAI_API_KEY" not in os.environ: config.cli.offline = True + logger.warning("API key not found. Running in offline mode.") def log_settings(conf: AppConfig) -> None: @@ -214,4 +252,25 @@ def log_settings(conf: AppConfig) -> None: logger.info(f"Header alignment: {conf.md.align}") logger.info(f"Using emojis: {conf.cli.emojis}") logger.info(f"Offline mode: {conf.cli.offline}") - logger.info(f"Repository validations: {conf.git}") + logger.info( + f"""Repository pydantic validations:\n\ + Repository URL: {conf.git.repository}\n\ + Full Name: {conf.git.full_name}\n\ + Project Name: {conf.git.name}\n\ + Host: {conf.git.source}\n\ + Host Name: {conf.git.host}""" + ) + + +def log_file_data(context: list[FileData], deps: List[str], tree: str) -> None: + """Log the processed file data from the repository.""" + for file_data in context: + logger.info( + f""" + File: {file_data.path}\n\ + Language: {file_data.language} ({file_data.extension})\n\ + Tokens: {file_data.tokens}\n\ + Dependencies: {file_data.dependencies}""" + ) + logger.info(f"Dependencies: {deps}") + logger.info(f"Project structure:\n{tree}") diff --git a/readmeai/markdown/badges.py b/readmeai/markdown/badges.py index cfe1e1b4..7162bdd3 100644 --- a/readmeai/markdown/badges.py +++ b/readmeai/markdown/badges.py @@ -19,7 +19,6 @@ def build_dependency_badges( dependencies: list[str], icons: dict[str, str], style: str ) -> str: """Build HTML badges for project dependencies.""" - dependencies.extend(["markdown"]) badges = [ icons[str(dependency).lower()] for dependency in dependencies diff --git a/readmeai/markdown/builder.py b/readmeai/markdown/builder.py index 994dc112..92400cd5 100644 --- a/readmeai/markdown/builder.py +++ b/readmeai/markdown/builder.py @@ -10,7 +10,7 @@ from readmeai.config.settings import AppConfig, ConfigHelper, GitService from readmeai.core import factory from readmeai.markdown import badges, tables, tree -from readmeai.markdown.quickstart import getting_started +from readmeai.markdown.quickstart import setup_guide class ReadmeBuilder: @@ -20,7 +20,7 @@ def __init__( self, conf: AppConfig, helper: ConfigHelper, - dependencies: list, + dependencies: List[str], summaries: tuple, temp_dir: str, ): @@ -90,11 +90,11 @@ def md_tree(self) -> str: @property def md_quickstart(self) -> str: """Generates the README Getting Started section.""" - project_setup = getting_started(self.conf, self.helper, self.summaries) - md_project_setup = self.md.getting_started.format( + project_setup = setup_guide(self.conf, self.helper, self.summaries) + md_project_setup = self.md.quickstart.format( repo_name=self.repo_name, repo_url=self.repo_url, - language_name=project_setup.top_language_full_name, + requirements=project_setup.requirements, install_command=project_setup.install_command, run_command=project_setup.run_command, test_command=project_setup.test_command, @@ -105,7 +105,7 @@ def build(self) -> str: """Builds the README Markdown file.""" readme_md_sections = [ self.md_header, - self.md.toc.format(self.repo_name), + self.md.toc.format(repo_name=self.repo_name), self.md.overview, self.md.features, self.md_tree, @@ -113,7 +113,10 @@ def build(self) -> str: self.md_summaries, self.md_quickstart, self.md.contribute.format( - full_name=self.full_name, repo_name=self.repo_name + host=self.host, + full_name=self.full_name, + repo_name=self.repo_name.capitalize(), + repo_url=self.repo_url, ), ] diff --git a/readmeai/markdown/data/shieldsio.json b/readmeai/markdown/data/shieldsio.json index e017eba1..15458a8b 100644 --- a/readmeai/markdown/data/shieldsio.json +++ b/readmeai/markdown/data/shieldsio.json @@ -6463,6 +6463,10 @@ "https://img.shields.io/badge/PostgreSQL-4169E1.svg?style={0}&logo=PostgreSQL&logoColor=white", "4169E1" ], + "psycopg": [ + "https://img.shields.io/badge/PostgreSQL-4169E1.svg?style={0}&logo=PostgreSQL&logoColor=white", + "4169E1" + ], "postman": [ "https://img.shields.io/badge/Postman-FF6C37.svg?style={0}&logo=Postman&logoColor=white", "FF6C37" diff --git a/readmeai/markdown/quickstart.py b/readmeai/markdown/quickstart.py index 987106b9..12b83b86 100644 --- a/readmeai/markdown/quickstart.py +++ b/readmeai/markdown/quickstart.py @@ -18,6 +18,7 @@ class ProjectSetup: install_command: str run_command: str test_command: str + requirements: str language_counts: Dict[str, int] top_language: str top_language_full_name: str = None @@ -29,11 +30,21 @@ def count_languages( """ Counts the occurrences of each language in the summaries. """ + dependency_files = helper.dependency_files.get("dependency_files") + language_counts = {} + for file_path, _ in summaries: language = Path(file_path).suffix[1:] + + if str(file_path) in [ + dependency_file for dependency_file in dependency_files + ]: + continue + if language and language not in helper.ignore_files: language_counts[language] = language_counts.get(language, 0) + 1 + return language_counts @@ -43,7 +54,8 @@ def get_top_language(language_counts: Dict[str, int]) -> str: """ if not language_counts: return None - return max(language_counts, key=language_counts.get) + + return max(sorted(language_counts), key=language_counts.get) def get_top_language_setup( @@ -55,22 +67,23 @@ def get_top_language_setup( if not language_counts: return None - top_language_key = get_top_language(language_counts) - language_name = helper.language_names.get(top_language_key, "n/a") + language_key = get_top_language(language_counts) + language_name = helper.language_names.get(language_key, conf.md.default) + requirements = f"**{language_name}**: `version x.y.z`" setup_commands = helper.language_setup.get( language_name, helper.language_setup.get("default", "n/a") ) - top_language_full_name = language_name return ProjectSetup( *setup_commands, + requirements, language_counts, - top_language_key, - top_language_full_name, + language_key, + language_name, ) -def getting_started( +def setup_guide( conf: AppConfig, helper: ConfigHelper, summaries: List[str] ) -> ProjectSetup: """ @@ -84,9 +97,7 @@ def getting_started( get_top_language_setup(language_counts, conf, helper) or default_setup ) - - logger.info(f"Language counts {language_counts}") - logger.info(f"Getting started commands: {setup}") + logger.info(f"Quick Start setup: {setup}") except Exception as exc_info: logger.debug( diff --git a/readmeai/markdown/tree.py b/readmeai/markdown/tree.py index 746aacc0..878d27c7 100644 --- a/readmeai/markdown/tree.py +++ b/readmeai/markdown/tree.py @@ -51,18 +51,17 @@ def _generate_tree( if not utils.should_ignore(self.config_helper, child) ] - # If the directory is empty or contains only ignored files, return an empty string if not children and directory.is_dir(): return "" parts = [f"{prefix}{'โ””โ”€โ”€ ' if is_last else 'โ”œโ”€โ”€ '}{directory.name}"] + for index, child in enumerate(children): child_prefix = prefix + (" " if is_last else "โ”‚ ") child_tree = self._generate_tree( child, child_prefix, index == len(children) - 1, depth + 1 ) - # Append the child tree only if it's not empty if child_tree: parts.append(child_tree) diff --git a/readmeai/parsers/base_parser.py b/readmeai/parsers/base_parser.py index 363e30bb..cceef764 100644 --- a/readmeai/parsers/base_parser.py +++ b/readmeai/parsers/base_parser.py @@ -3,13 +3,13 @@ from abc import ABC, abstractmethod from typing import List -from readmeai.core import logger +from readmeai.core.logger import Logger -logger = logger.Logger(__name__) +logger = Logger(__name__) class FileParser(ABC): - """Base class for all depedency file parsers.""" + """Base class for all dependency file parsers.""" @abstractmethod def parse(self, content: str) -> List[str]: diff --git a/readmeai/parsers/cmake.py b/readmeai/parsers/cmake.py new file mode 100644 index 00000000..a33bea17 --- /dev/null +++ b/readmeai/parsers/cmake.py @@ -0,0 +1,64 @@ +"""Dependency file parsers for C/C++ projects.""" + +import re +from typing import List + +from readmeai.core.logger import Logger +from readmeai.parsers.base_parser import FileParser + +logger = Logger(__name__) + + +class CMakeParser(FileParser): + """Parser for CMake dependency files.""" + + def parse(self, content: str) -> List[str]: + """Extracts dependencies, libraries, and software from a CMakeLists.txt file.""" + try: + dependencies = [] + # Patterns to capture different CMake commands related to dependencies + patterns = [ + r"find_package\(([^)]+)\)", + r"add_library\((\S+)", + r"target_link_libraries\((\S+)", + # Add more patterns as needed + ] + for pattern in patterns: + regex = re.compile(pattern) + matches = regex.findall(content) + dependencies.extend(matches) + # Clean and return unique dependencies + return list(set(dep.strip() for dep in dependencies)) + except re.error as excinfo: + self.log_error(f"Error parsing CMakeLists.txt: {str(excinfo)}") + return [] + + +class MakefileAmParser(FileParser): + """Parser for Makefile dependency files.""" + + def parse(self, content: str) -> List[str]: + """Extracts package names from a Makefile.am file.""" + try: + regex = re.compile(r"bin_PROGRAMS\s*=\s*(.+)") + matches = regex.findall(content) + package_names = [ + dep for match in matches for dep in filter(None, match.split()) + ] + return package_names + except re.error as excinfo: + self.log_error(f"Error parsing Makefile.am: {str(excinfo)}") + return [] + + +class ConfigureAcParser(FileParser): + """Parser for configure.ac dependency files.""" + + def parse(self, content: str) -> List[str]: + """Extracts package names from a configure.ac file.""" + try: + regex = re.compile(r"AC_CHECK_LIB\([^)]+\s+([^)]+)\)") + return regex.findall(content) + except re.error as excinfo: + self.log_error(f"Error parsing configure.ac: {str(excinfo)}") + return [] diff --git a/readmeai/parsers/factory.py b/readmeai/parsers/factory.py index b42e3bef..3197cd2e 100644 --- a/readmeai/parsers/factory.py +++ b/readmeai/parsers/factory.py @@ -3,62 +3,44 @@ from typing import Dict from readmeai.parsers.base_parser import FileParser -from readmeai.parsers.gomod import GoModParser +from readmeai.parsers.cmake import ( + CMakeParser, + ConfigureAcParser, + MakefileAmParser, +) +from readmeai.parsers.go import GoModParser from readmeai.parsers.gradle import BuildGradleKtsParser, BuildGradleParser from readmeai.parsers.maven import MavenParser -from readmeai.parsers.npm import JsonParser +from readmeai.parsers.npm import PackageJsonParser, YarnLockParser from readmeai.parsers.python import RequirementsParser, TomlParser, YamlParser from readmeai.parsers.rust import CargoTomlParser def parser_factory() -> Dict[str, FileParser]: """Returns a dictionary of callable file parser methods.""" + yaml_parser = YamlParser() + toml_parser = TomlParser() + requirements_parser = RequirementsParser() + return { "build.gradle": BuildGradleParser(), "build.gradle.kts": BuildGradleKtsParser(), "cargo.toml": CargoTomlParser(), "go.mod": GoModParser(), - "package.json": JsonParser(), - "environment.yml": YamlParser(), - "environment.yaml": YamlParser(), - "Pipfile": TomlParser(), - "pyproject.toml": TomlParser(), - "requirements.txt": RequirementsParser(), - "requirements-dev.txt": RequirementsParser(), + "environment.yml": yaml_parser, + "environment.yaml": yaml_parser, + "Pipfile": toml_parser, + "pyproject.toml": toml_parser, "pom.xml": MavenParser(), + "requirements.in": requirements_parser, + "requirements.txt": requirements_parser, + "requirements-dev.txt": requirements_parser, + "requirements-test.txt": requirements_parser, + "requirements-prod.txt": requirements_parser, + "dev-requirements.txt": requirements_parser, + "cmakeLists.txt": CMakeParser(), + "configure.ac": ConfigureAcParser(), + "Makefile.am": MakefileAmParser(), + "package.json": PackageJsonParser(), + "yarn.lock": YarnLockParser(), } - """ - "yarn.lock": parse_yarn_lock, - "CMakeLists.txt": parse_cmake, - "Makefile.am": parse_makefile_am, - "configure.ac": parse_configure_ac, - - def parse_yarn_lock(content: str) -> List[str]: - try: - return re.findall(r"(\S+)(?=@)", content) - except re.error as excinfo: - logger.error(f"Error parsing yarn.lock: {str(excinfo)}") - return [] - - - def parse_cmake(content: str) -> List[str]: - regex = re.compile(r"add_executable\([^)]+\s+([^)]+)\)") - package_names = regex.findall(content) - return package_names - - - def parse_configure_ac(content: str) -> List[str]: - regex = re.compile(r"AC_CHECK_LIB\([^)]+\s+([^)]+)\)") - package_names = regex.findall(content) - return package_names - - - def parse_makefile_am(content: str) -> List[str]: - regex = re.compile(r"bin_PROGRAMS\s*=\s*(.+)") - package_names = [] - matches = regex.findall(content) - for match in matches: - deps = filter(None, match.split()) - package_names.extend(deps) - return package_names - """ diff --git a/readmeai/parsers/gomod.py b/readmeai/parsers/go.py similarity index 100% rename from readmeai/parsers/gomod.py rename to readmeai/parsers/go.py diff --git a/readmeai/parsers/npm.py b/readmeai/parsers/npm.py index 0961528d..355c1279 100644 --- a/readmeai/parsers/npm.py +++ b/readmeai/parsers/npm.py @@ -1,13 +1,16 @@ """File for parsing json dependency files.""" import json +import re from typing import List -from readmeai.core import logger +from readmeai.core.logger import Logger from readmeai.parsers.base_parser import FileParser +logger = Logger(__name__) -class JsonParser(FileParser): + +class PackageJsonParser(FileParser): def parse(self, content: str) -> List[str]: """Returns a list of dependencies parsed from a json file.""" try: @@ -22,7 +25,19 @@ def parse(self, content: str) -> List[str]: package_names.extend(data[section].keys()) return package_names - except json.JSONDecodeError as excinfo: - logger.error(f"Error parsing package.json: {str(excinfo)}") + except json.JSONDecodeError as exc_info: + logger.error(f"Error parsing package.json: {str(exc_info)}") return [] + + +class YarnLockParser(FileParser): + """Parser for yarn.lock dependency files.""" + + def parse(self, content: str) -> List[str]: + """Extracts package names from a yarn.lock file.""" + try: + return re.findall(r"(\S+)(?=@)", content) + except re.error as exc_info: + self.log_error(f"Error parsing yarn.lock: {str(exc_info)}") + return [] diff --git a/readmeai/parsers/rust.py b/readmeai/parsers/rust.py index 9a4be96e..144b7ef1 100644 --- a/readmeai/parsers/rust.py +++ b/readmeai/parsers/rust.py @@ -19,12 +19,20 @@ def parse(self, content: str) -> List[str]: try: data = toml.loads(content) dependencies = [] + if "dependencies" in data: - dependencies.extend(data.get("dependencies", {}).keys()) + dependencies.extend(data["dependencies"].keys()) if "dev-dependencies" in data: - dependencies.extend(data.get("dev-dependencies", {}).keys()) - return dependencies + dependencies.extend(data["dev-dependencies"].keys()) + + for key in data: + if key.startswith("dependencies.") and isinstance( + data[key], dict + ): + dependencies.extend(data[key].keys()) - except toml.TomlDecodeError as error: - self.log_error(TOM_DECODE_ERROR.format(error)) return dependencies + + except toml.TomlDecodeError as exc_info: + raise ValueError(TOM_DECODE_ERROR.format(exc_info)) + return [] diff --git a/readmeai/settings/config.toml b/readmeai/settings/config.toml index 70d45459..06148d81 100644 --- a/readmeai/settings/config.toml +++ b/readmeai/settings/config.toml @@ -61,24 +61,23 @@ badges_shields = """ \trepo-top-language \trepo-language-count """ -badges_skills = """\n\t\t\n\t -""" +badges_skills = """\n\t\t\n\t""" toc = """ ## ๐Ÿ”— Quick Links -- [๐Ÿ”— Quick Links](#-quick-links) -- [๐Ÿ“ Overview](#-overview) -- [๐Ÿ“ฆ Features](#-features) -- [๐Ÿ“‚ Repository Structure](#-repository-structure) -- [๐Ÿงฉ Modules](#modules) -- [๐Ÿš€ Getting Started](#-getting-started) - - [โš™๏ธ Installation](#-installation) - - [๐Ÿค– Running {0}](#-running-{0}) - - [๐Ÿงช Tests](#-tests) -- [๐Ÿ›  Roadmap](#-roadmap) -- [๐Ÿค Contributing](#-contributing) -- [๐Ÿ“„ License](#-license) -- [๐Ÿ‘ Acknowledgments](#-acknowledgments) + +> - [๐Ÿ“ Overview](#-overview) +> - [๐Ÿ“ฆ Features](#-features) +> - [๐Ÿ“‚ Repository Structure](#-repository-structure) +> - [๐Ÿงฉ Modules](#-modules) +> - [๐Ÿš€ Getting Started](#-getting-started) +> - [โš™๏ธ Installation](#-installation) +> - [๐Ÿค– Running {repo_name}](#-running-{repo_name}) +> - [๐Ÿงช Tests](#-tests) +> - [๐Ÿ›  Project Roadmap](#-project-roadmap) +> - [๐Ÿค Contributing](#-contributing) +> - [๐Ÿ“„ License](#-license) +> - [๐Ÿ‘ Acknowledgments](#-acknowledgments) --- """ @@ -114,7 +113,7 @@ modules = """ """ modules_widget = """
{0}\n\n{1}\n\n
\n""" -getting_started = """ +quickstart = """ --- ## ๐Ÿš€ Getting Started @@ -123,35 +122,40 @@ getting_started = """ Ensure you have the following dependencies installed on your system: -* {language_name}: `โ–บ INSERT-VERSION-HERE` -* `โ–บ ...` -* `โ–บ ...` +* {requirements} ### โš™๏ธ Installation 1. Clone the {repo_name} repository: + ```sh git clone {repo_url} ``` 2. Change to the project directory: + ```sh cd {repo_name} ``` 3. Install the dependencies: + ```sh {install_command} ``` ### ๐Ÿค– Running {repo_name} + Use the following command to run {repo_name}: + ```sh {run_command} ``` ### ๐Ÿงช Tests + To execute tests, run: + ```sh {test_command} ``` @@ -172,24 +176,24 @@ contribute = """ Contributions are welcome! Here are several ways you can contribute: -- **[Submit Pull Requests](https://github.com/{full_name}/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs. -- **[Join the Discussions](https://github.com/{full_name}/discussions)**: Share your insights, provide feedback, or ask questions. -- **[Report Issues](https://github.com/{full_name}/issues)**: Submit bugs found or log feature requests for {repo_name}. +- **[Submit Pull Requests](https://{host}/{full_name}/blob/main/CONTRIBUTING.md)**: Review open PRs, and submit your own PRs. +- **[Join the Discussions](https://{host}/{full_name}/discussions)**: Share your insights, provide feedback, or ask questions. +- **[Report Issues](https://{host}/{full_name}/issues)**: Submit bugs found or log feature requests for {repo_name}.
-Contributing Guidelines + Contributing Guidelines 1. **Fork the Repository**: Start by forking the project repository to your GitHub account. 2. **Clone Locally**: Clone the forked repository to your local machine using a Git client. ```sh - git clone + git clone {repo_url} ``` 3. **Create a New Branch**: Always work on a new branch, giving it a descriptive name. ```sh git checkout -b new-feature-x ``` 4. **Make Your Changes**: Develop and test your changes locally. -5. **Commit Your Changes**: Commit with a clear and concise message describing your updates. +5. **Commit Your Changes**: Commit with a clear message describing your updates. ```sh git commit -m 'Implemented new feature x.' ``` @@ -222,42 +226,45 @@ This project is protected under the [SELECT-A-LICENSE](https://choosealicense.co # Language Model Prompts [prompts] -features = """Hello! Analyze the codebase "{0}" and create a concise analysis of each project component. \ -Consider the codebase as a whole and highlight the key characteristics, design patterns, architectural decisions, and any other noteworthy elements. -Generate your response as a Markdown table with the following columns: - -| | Feature | Description | -|----|--------------------|--------------------------------------------------------------------------------------------------------------------| -| โš™๏ธ | **Architecture** | Analyze the structural design of the system here. The description should not exceed 99 characters in total. | -| ๐Ÿ“„ | **Documentation** | Discuss the quality and comprehensiveness of the documentation here. The description should not exceed 99 characters in total.| -| ๐Ÿ”— | **Dependencies** | Examine the external libraries or other systems that this system relies on here. The description should not exceed 99 characters in total.| -| ๐Ÿงฉ | **Modularity** | Discuss the system's organization into smaller, interchangeable components here. The description should not exceed 99 characters in total.| -| ๐Ÿงช | **Testing** | Evaluate the system's testing strategies and tools here. The description should not exceed 99 characters in total. | -| โšก๏ธ | **Performance** | Analyze how well the system performs, considering speed, efficiency, and resource usage here. The description should not exceed 99 characters in total.| -| ๐Ÿ” | **Security** | Assess the measures the system uses to protect data and maintain functionality here. The description should not exceed 99 characters in total.| -| ๐Ÿ”€ | **Version Control**| Discuss the system's version control strategies and tools here. The description should not exceed 99 characters in total.| -| ๐Ÿ”Œ | **Integrations** | Evaluate how the system interacts with other systems and services here. The description should not exceed 99 characters in total.| -| ๐Ÿ“ถ | **Scalability** | Analyze the system's ability to handle growth here. The description should not exceed 99 characters in total. | - -Provided information includes: -Repository directory structure: {1} -Code files: {2} +features = """Hello! Please analyze the key technical capabilities and characteristics of the project {0} and describe them in a Markdown table format: + +| | Feature | Description | +|----|-------------------|---------------------------------------------------------------| +| โš™๏ธ | **Architecture** | *Quick facts about the project's architecture. Max 50 words.* | +| ๐Ÿ”ฉ | **Code Quality** | *Quick facts about the code quality and style. Max 50 words.* | +| ๐Ÿ“„ | **Documentation** | *Discuss the extent and quality of documentation. Max 50 words.* | +| ๐Ÿ”Œ | **Integrations** | *List key integrations and external dependencies. Max 50 words.* | +| ๐Ÿงฉ | **Modularity** | *Discuss the modularity and reusability of the codebase. Max 50 words.* | +| ๐Ÿงช | **Testing** | *List testing frameworks and tools used. Max 50 words.* | +| โšก๏ธ | **Performance** | *Evaluate efficiency, speed and resource usage. Max 50 words.* | +| ๐Ÿ›ก๏ธ | **Security** | *Discuss measures used for data protection and access control. Max 50 words.* | +| ๐Ÿ“ฆ | **Dependencies** | *List key external libraries and dependencies. Max 50 words.* | +| ๐Ÿš€ | **Scalability** | *Assess ability to handle increased traffic and load. Max 50 words.* | + +While generating the table, please reference the following codebase details:\n +================================================================================ +Project dependencies: {1} +Repository contents: {2} +================================================================================ """ -overview = """Analyze the codebase named {} ({}) and provide a robust, yet succinct overview of the project.\n +overview = """Analyze the codebase named {0} ({1}) and provide a robust, yet succinct overview of the project.\n Craft a paragraph, 80 TOKEN MAXIMUM, that encapsulate the core functionalities of the project, its purpose and value proposition.\n Avoid deep technical details and focus on the project's high-level use cases and features.\n -Provided are codebase file descriptions:\n{}\n +Provided are codebase file descriptions:\n{2}\n """ -slogan = """Conceptualize a catchy and memorable slogan for the project: {}.\n -Limit the project's slogan to 8 words or less.\n -Use the following code summaries from the repository to help you craft the slogan:\n{}\n +slogan = """Conceptualize a catchy and memorable slogan for the project: {0} ({1}).\n +Limit the phrase to 8 words or less, and ensure it encapsulates the project's purpose +and value proposition while engaging the reader. The following code summaries from the +repository will help you craft your response:\n{2}\n """ summaries = """Deliver a succinct summary in no more than 50 tokens, emphasizing the main role \ and critical features of this code snippet in relation to its parent repository's architecture. \ Focus on what the code achieves, steering clear of technical implementation details. Included are \ supplementary details and materials about the codebase and its elements to enhance your understanding. \ -Provided information includes:\n -- Repository layout and directory structure: {} -- List of dependencies and software used in the codebase: {} -- Summaries of key files within the codebase: {} +While generating the summaries, please reference the following codebase details: +================================================================================ +Repository structure: {0} +File path: {1} +File contents: {2} +================================================================================ """ diff --git a/readmeai/settings/dependency_files.toml b/readmeai/settings/dependency_files.toml index fecf3f24..8bef0dae 100644 --- a/readmeai/settings/dependency_files.toml +++ b/readmeai/settings/dependency_files.toml @@ -20,13 +20,18 @@ dependency_files = [ # Python 'Pipfile', 'Pipfile.lock', - 'conda.yml', + "poetry.lock", 'pyproject.toml', - 'requirements-dev.txt', + 'conda.yaml', + 'conda.yml', + "environment.yml", + "environment.yaml", 'requirements.in', + 'requirements.txt', + 'requirements-dev.txt', 'requirements-prod.txt', 'requirements.test.txt', - 'requirements.txt', + "dev-requirements.txt", 'setup.cfg', 'setup.py', @@ -37,6 +42,7 @@ dependency_files = [ # Ruby 'Gemfile', 'Gemfile.lock', + 'Rakefile', # Clojure 'project.clj', @@ -50,6 +56,8 @@ dependency_files = [ 'package.json', 'yarn.lock', 'package-lock.json', + '.npmrc', + '.nvmrc', # TypeScript 'tsconfig.json', @@ -57,9 +65,12 @@ dependency_files = [ # PHP 'composer.json', 'composer.lock', + 'phpunit.xml', + 'phpunit.xml.dist', # Swift 'Package.swift', + 'Podfile.lock', # Kotlin 'build.gradle.kts', @@ -70,6 +81,7 @@ dependency_files = [ # R 'DESCRIPTION', 'NAMESPACE', + 'renv.lock', # Shell 'Dockerfile', @@ -89,10 +101,14 @@ dependency_files = [ # Haskell 'stack.yaml', 'package.yaml', + 'cabal.project', + 'myapp.cabal', # Replace 'myapp' with actual project name # C# '.csproj', 'packages.config', + 'Directory.Build.props', + 'Directory.Build.targets', # F# '.fsproj', @@ -105,9 +121,17 @@ dependency_files = [ # Perl 'cpanfile', + 'Makefile.PL', + 'Build.PL', # Docker "Dockerfile", "docker-compose.yml", + "docker-compose.override.yml", + "docker-compose.dev.yml", "docker-compose.yaml", + + # General/Other + '.gitignore', + '.dockerignore', ] diff --git a/readmeai/settings/language_setup.toml b/readmeai/settings/language_setup.toml index 8a138a68..e3a9926b 100644 --- a/readmeai/settings/language_setup.toml +++ b/readmeai/settings/language_setup.toml @@ -3,7 +3,7 @@ [language_setup] default = ["> INSERT-INSTALL-COMMANDS", "> INSERT-RUN-COMMANDS", "> INSERT-TEST-COMMANDS"] C = ["gcc -o myapp main.c", "./myapp", "/* No common unit test framework in C */"] -CPP = ["g++ -o myapp main.cpp", "./myapp", "Insert test command."] +CPP = ["g++ -o myapp main.cpp", "./myapp", "googletest"] CSharp = ["dotnet build", "dotnet run", "dotnet test"] CoffeeScript = ["npm install", "coffee main.coffee", "npm test"] Crystal = ["shards install", "./main", "crystal spec"] diff --git a/scripts/run_batch.sh b/scripts/run_batch.sh index a2ca615f..87fa1d5a 100644 --- a/scripts/run_batch.sh +++ b/scripts/run_batch.sh @@ -1,8 +1,9 @@ #!/usr/bin/env bash repositories=( - "https://github.com/BerriAI/litellm" - "https://github.com/fal-ai/fal-js" + #"https://github.com/BerriAI/litellm" + #"https://github.com/fal-ai/fal-js" + "https://github.com/jwills/buenavista" "https://github.com/eli64s/readme-ai" "https://github.com/Yuberley/ChatGPT-App-React-Native-TypeScript" "https://github.com/rumaan/file.io-Android-Client" @@ -16,8 +17,9 @@ repositories=( ) filenames=( - "readme-litellm.md" - "readme-fal-js.md" + #"readme-litellm.md" + #"readme-fal-js.md" + "readme-postgres.md" "readme-python.md" "readme-typescript.md" "readme-kotlin.md" @@ -42,7 +44,7 @@ for index in "${!repositories[@]}"; do alignment=${align[$RANDOM % ${#align[@]}]} rand_choice=$((RANDOM % 2)) - cmd="python3 -m readmeai.cli.commands -o \"$filename\" -r \"$repo\"" + cmd="readmeai -o \"$filename\" -r \"$repo\"" if [ "$random_badge" != "default" ]; then cmd+=" -b \"$random_badge\"" diff --git a/tests/test_config/test_enums.py b/tests/test_config/test_enums.py index 87d9eb5d..b7221b14 100644 --- a/tests/test_config/test_enums.py +++ b/tests/test_config/test_enums.py @@ -25,7 +25,7 @@ def test_git_service_api_url(service, expected_api_url): (GitService.LOCAL, "{file_path}"), ( GitService.GITHUB, - "https://github.com/{full_name}/blob/main/{file_path}", + "https://github.com/{full_name}/blob/master/{file_path}", ), ( GitService.GITLAB, diff --git a/tests/test_core/test_preprocess.py b/tests/test_core/test_preprocess.py index f6b82efc..1cd43e05 100644 --- a/tests/test_core/test_preprocess.py +++ b/tests/test_core/test_preprocess.py @@ -1,48 +1,140 @@ -"""Unit tests for preprocess module.""" +"""Tests for preprocessing the repository and extracting metadata.""" + +from pathlib import Path +from unittest.mock import MagicMock, patch import pytest -from readmeai.core.preprocess import RepoProcessor +from readmeai.core.preprocess import FileData, RepoProcessor @pytest.fixture -def parser(config, config_helper): +def repo_processor(config, config_helper): """Fixture for RepoProcessor.""" return RepoProcessor(config, config_helper) -def test_analyze(parser): - """Test analyze method.""" - temp_dir = "/path/to/temp/dir" - result = parser.analyze(temp_dir) - assert isinstance(result, list) - assert all(isinstance(item, dict) for item in result) +def test_generate_contents(repo_processor, tmp_path): + """Test the generate_contents method.""" + (tmp_path / "file1.py").touch() + (tmp_path / "file2.py").touch() + (tmp_path / "file3.py").touch() + (tmp_path / ".github" / "workflows" / "workflow.yml").mkdir( + parents=True, exist_ok=True + ) + (tmp_path / "ignore.md").touch() + + with patch( + "readmeai.core.utils.should_ignore", + side_effect=lambda x, y: y.name == "ignore.md", + ): + result = repo_processor.generate_contents(tmp_path) + + assert len(result) == 3 + assert any(fd.name == "file1.py" for fd in result) + + +def test_generate_file_info(repo_processor, tmp_path): + """Test the generate_file_info method.""" + (tmp_path / "file1.py").touch() + (tmp_path / "file2.py").touch() + (tmp_path / "file3.py").touch() + (tmp_path / "javascript.js").touch() + (tmp_path / ".github" / "workflows" / "workflow.yml").mkdir( + parents=True, exist_ok=True + ) + with patch("readmeai.core.utils.should_ignore", return_value=False): + result = list(repo_processor.generate_file_info(tmp_path)) + + assert len(result) == 4 + assert any(fd.name == "file1.py" for fd in result) + + +def test_generate_file_info_exception_handling(repo_processor, caplog): + """Test the generate_file_info method.""" + mock_file = MagicMock() + mock_file.open.side_effect = UnicodeDecodeError( + "utf-8", b"", 0, 1, "error" + ) + mock_path = MagicMock() + mock_path.rglob.return_value = [mock_file] + list(repo_processor.generate_file_info(mock_path)) + assert "Error reading file" in caplog.text + +def test_create_file_data(repo_processor): + """Test the create_file_data method.""" + file_info = ("requirements.txt", Path("requirements.txt"), "Flask==1.1.4") + file_data = repo_processor.create_file_data(file_info) + assert file_data.name == "requirements.txt" + assert file_data.path == Path("requirements.txt") + assert file_data.content == "Flask==1.1.4" -def test_generate_contents(parser): - """Test generate_contents method.""" - repo_path = "/path/to/repo" - result = parser.generate_contents(repo_path) - assert isinstance(result, list) - assert all(isinstance(item, dict) for item in result) + +def test_extract_dependencies(repo_processor): + """Test the extract_dependencies method.""" + file_data = FileData( + name="requirements.txt", + path=Path("requirements.txt"), + content="flask==1.1.4", + extension="txt", + ) + mock_parser = MagicMock() + mock_parser.parse.return_value = ["flask==1.1.4"] + with patch( + "readmeai.parsers.factory.parser_factory", return_value=mock_parser + ): + result = repo_processor.extract_dependencies(file_data) + assert "flask" in result + + +def test_language_mapper(repo_processor): + """Test the language_mapper method.""" + contents = [ + FileData( + name="main.py", + path=Path("main.py"), + content="import streamlit as st\nimport pandas as pd", + extension="py", + ), + FileData( + name="README.md", + path=Path("README.md"), + content="## This is a test README file", + extension="md", + ), + ] + updated = repo_processor.language_mapper(contents) + assert updated[0].language == "python" + assert updated[1].language == "markdown" + + +@patch("readmeai.core.tokens.get_token_count", return_value=7) +def test_tokenize_content(mock_get_token_count, repo_processor): + """Test the tokenize_content method.""" + contents = [ + FileData( + name="file.py", + path=Path("file.py"), + content="print('Hello, world!')", + extension="py", + ) + ] + file_data = repo_processor.tokenize_content(contents) + assert isinstance(file_data[0].tokens, int) + assert file_data[0].tokens >= 0 -def test_get_dependency_file_contents(parser): - """Test get_dependency_file_contents method.""" +def test_tokenize_content_offline_mode(repo_processor): + """Test the tokenize_content method.""" + repo_processor.config.cli.offline = True contents = [ - { - "name": "requirements.txt", - "path": "/path/to/requirements.txt", - "content": "requests==2.25.1\n", - "extension": "txt", - }, - { - "name": "setup.py", - "path": "/path/to/setup.py", - "content": "import setuptools\n", - "extension": "py", - }, + FileData( + name="file.py", + path=Path("file.py"), + content="print('Hello, world!')", + extension="py", + ) ] - result = parser.get_dependency_file_contents(contents) - assert isinstance(result, list) - assert all(isinstance(item, str) for item in result) + result = repo_processor.tokenize_content(contents) + assert result[0].tokens == 0 diff --git a/tests/test_core/test_utils.py b/tests/test_core/test_utils.py index eb7cf5f5..151d6a41 100644 --- a/tests/test_core/test_utils.py +++ b/tests/test_core/test_utils.py @@ -6,7 +6,6 @@ from readmeai.core.utils import ( flatten_list, format_sentence, - get_relative_path, get_resource_path, is_valid_url, remove_substring, @@ -33,14 +32,6 @@ def test_format_sentence(): assert formatted_sentence == "hello world" -def test_get_relative_path(): - """Test that the relative path is correct.""" - absolute_path = "readmeai/core/utils.py" - base_path = Path().parent - relative_path = get_relative_path(absolute_path, base_path) - assert str(relative_path) == "readmeai/core/utils.py" - - def test_remove_substring(): """Test that the substring is removed from the input string.""" test_string = """ diff --git a/tests/test_main.py b/tests/test_main.py index 4f5d4b16..92c83831 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,28 +1,106 @@ -"""Test the main module of the package.""" +"""Tests for the readmeai package main module.""" import asyncio -from unittest.mock import MagicMock, patch +from unittest.mock import AsyncMock, Mock, patch import pytest -from readmeai.main import readme_agent +from readmeai.config.settings import AppConfig +from readmeai.main import generate_prompts, readme_agent, update_settings +from readmeai.markdown.builder import build_readme_md +@patch("readmeai.main.clone_repo_to_temp_dir") +@patch("readmeai.main.ModelHandler") +@patch("readmeai.main.RepoProcessor") +@patch("readmeai.main.build_readme_md") @pytest.mark.asyncio -async def test_readme_agent(): +async def test_readme_agent_normal_flow( + mock_build_readme_md, + mock_repo_processor, + mock_model_handler, + mock_clone_repo_to_temp_dir, + config, + config_helper, +): """Test the readme_agent function.""" - with patch("readmeai.main.clone_repo_to_temp_dir") as mock_clone, patch( - "readmeai.main.build_readme_md" - ) as mock_build_readme, patch( - "readmeai.main.shutil.rmtree" - ) as mock_rmtree, patch( - "readmeai.main.Logger" - ) as mock_logger: - mock_clone.return_value = asyncio.Future() - mock_clone.return_value.set_result(None) - conf = MagicMock() - conf_helper = MagicMock() - conf.llm.rate_limit = 10 - await readme_agent(conf, conf_helper) - mock_build_readme.assert_called_once() - mock_rmtree.assert_called_once() + mock_config = config + mock_config_helper = config_helper + mock_clone_repo_to_temp_dir.return_value = asyncio.Future() + mock_clone_repo_to_temp_dir.return_value.set_result("test_dir") + mock_model_handler.return_value.use_api.return_value.__aenter__.return_value = ( + AsyncMock() + ) + mock_build_readme_md.return_value = "test_readme_md" + + # Mock the RepoProcessor's methods + mock_repo_processor_instance = mock_repo_processor.return_value + mock_repo_processor_instance.generate_contents.return_value = [] + mock_repo_processor_instance.language_mapper.return_value = [] + mock_repo_processor_instance.tokenize_content.return_value = [] + + with pytest.raises(Exception): + await readme_agent(mock_config, mock_config_helper) + build_readme_md(mock_config, mock_config_helper, [], [], "test_dir") + + mock_repo_processor_instance.generate_contents.assert_called_once() + mock_repo_processor_instance.language_mapper.assert_called_once() + mock_repo_processor_instance.tokenize_content.assert_called_once() + + mock_clone_repo_to_temp_dir.assert_called_once() + mock_model_handler.assert_called_once() + mock_build_readme_md.assert_called_once() + + +@pytest.mark.asyncio +async def test_readme_agent_error_handling(): + """Test the readme_agent function.""" + with patch( + "readmeai.services.git_operations.clone_repo_to_temp_dir" + ) as clone_mock: + clone_mock.side_effect = Exception("Failed to clone repo") + conf = Mock() + conf_helper = Mock() + with pytest.raises(Exception) as exc_info: + readme_agent(conf, conf_helper) + assert "Failed to clone repo" in str(exc_info.value) + + +@pytest.mark.asyncio +async def test_generate_prompts(mock_dependencies, mock_summaries): + """Test the generate_prompts function.""" + conf = Mock() + conf.git.repository = "https://example.com/repo" + conf.md.tree = "test_tree" + file_context = {"file1": Mock(), "file2": Mock()} + prompts = await generate_prompts( + conf, + file_context, + mock_dependencies, + mock_summaries, + ) + assert len(prompts) == 4 + expected_prompts = [] + for prompt, expected in zip(prompts, expected_prompts): + assert prompt == expected + + +def test_update_settings(config): + """Test the update_settings function.""" + config = update_settings( + config, + "left", + "flat", + config.cli.emojis, + config.md.image, + 99999, + config.llm.model, + config.cli.offline, + config.files.output, + config.git.repository, + config.llm.temperature, + ) + assert isinstance(config, AppConfig) + assert config.md.align == "left" + assert config.cli.emojis is False + assert config.llm.tokens_max == 99999 diff --git a/tests/test_markdown/test_badges.py b/tests/test_markdown/test_badges.py index c4dba38b..c8048c7a 100644 --- a/tests/test_markdown/test_badges.py +++ b/tests/test_markdown/test_badges.py @@ -91,7 +91,6 @@ def test_build_metadata_badges_success(config): def test_shields_icons_success(config, mock_dependencies): """Tests shields_icons with valid inputs.""" config.md.badge_style = "flat" - with patch("readmeai.markdown.badges._read_badge_file") as mock_read: mock_read.return_value = { "python": [ @@ -110,18 +109,17 @@ def test_shields_icons_success(config, mock_dependencies): def test_skill_icons_success(config): """Tests skill_icons with valid inputs.""" config.md.badge_style = "skills-light" + deps = ["fastapi", "py", "redis", "github", "git"] mock_icons = { "icons": {"names": ["fastapi", "py", "redis", "md", "github", "git"]}, "url": {"base_url": "https://skillicons.dev/icons?i="}, } - deps = ["fastapi", "py", "redis", "github", "git"] - with patch("readmeai.markdown.badges._read_badge_file") as mock_read: mock_read.return_value = mock_icons result = skill_icons(config, deps) assert "&theme=light" in result assert """""" in result assert ( - """\n\t\t\n\t\n""" + """\n\t\t\n\t""" in result ) diff --git a/tests/test_markdown/test_builder.py b/tests/test_markdown/test_builder.py index a20009a4..e573f750 100644 --- a/tests/test_markdown/test_builder.py +++ b/tests/test_markdown/test_builder.py @@ -35,7 +35,7 @@ def test_md_tree(readme_builder): def test_md_quickstart(readme_builder): - """Tests if md_quickstart property returns a string.""" + """Tests if md_quick_start property returns a string.""" quickstart = readme_builder.md_quickstart assert isinstance(quickstart, str) diff --git a/tests/test_markdown/test_quickstart.py b/tests/test_markdown/test_quickstart.py index 5f08608d..c100d5c7 100644 --- a/tests/test_markdown/test_quickstart.py +++ b/tests/test_markdown/test_quickstart.py @@ -5,7 +5,7 @@ count_languages, get_top_language, get_top_language_setup, - getting_started, + setup_guide, ) @@ -30,7 +30,7 @@ def test_get_top_language_setup(config, config_helper): assert setup.top_language == "Python" -def test_getting_started(config, config_helper, mock_summaries): - """Tests the getting_started method.""" - setup = getting_started(config, config_helper, mock_summaries) +def test_setup_guide(config, config_helper, mock_summaries): + """Tests the setup_guide method.""" + setup = setup_guide(config, config_helper, mock_summaries) assert isinstance(setup, ProjectSetup) diff --git a/tests/test_parsers/test_cmake.py b/tests/test_parsers/test_cmake.py new file mode 100644 index 00000000..f9c8bbbc --- /dev/null +++ b/tests/test_parsers/test_cmake.py @@ -0,0 +1,96 @@ +"""Unit tests for C/C++ parsers.""" + +from readmeai.parsers.cmake import CMakeParser + +cmake_file = """ +cmake_minimum_required(VERSION 2.8.12) + +# Set extension name here +set(TARGET_NAME arrow) + +set(EXTENSION_NAME ${TARGET_NAME}_extension) +project(${TARGET_NAME}) +include_directories(src/include) + +set(EXTENSION_SOURCES + src/arrow_extension.cpp + src/arrow_stream_buffer.cpp + src/arrow_scan_ipc.cpp + src/arrow_to_ipc.cpp) + +if(NOT "${OSX_BUILD_ARCH}" STREQUAL "") + set(OSX_ARCH_FLAG -DCMAKE_OSX_ARCHITECTURES=${OSX_BUILD_ARCH}) +else() + set(OSX_ARCH_FLAG "") +endif() + +# Building Arrow +include(ExternalProject) +ExternalProject_Add( + ARROW_EP + GIT_REPOSITORY "https://github.com/apache/arrow" + GIT_TAG ea6875fd2a3ac66547a9a33c5506da94f3ff07f2 + PREFIX "${CMAKE_BINARY_DIR}/third_party/arrow" + INSTALL_DIR "${CMAKE_BINARY_DIR}/third_party/arrow/install" + BUILD_BYPRODUCTS /lib/libarrow.a + CONFIGURE_COMMAND + ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} ${OSX_ARCH_FLAG} + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/third_party/arrow/install + -DCMAKE_INSTALL_LIBDIR=lib -DARROW_BUILD_STATIC=ON -DARROW_BUILD_SHARED=OFF + -DARROW_NO_DEPRECATED_API=ON -DARROW_POSITION_INDEPENDENT_CODE=ON + -DARROW_SIMD_LEVEL=NONE -DARROW_ENABLE_TIMING_TESTS=OFF -DARROW_IPC=ON + -DARROW_JEMALLOC=OFF -DARROW_DEPENDENCY_SOURCE=BUNDLED + -DARROW_VERBOSE_THIRDPARTY_BUILD=OFF -DARROW_DEPENDENCY_USE_SHARED=OFF + -DARROW_BOOST_USE_SHARED=OFF -DARROW_BROTLI_USE_SHARED=OFF + -DARROW_BZ2_USE_SHARED=OFF -DARROW_GFLAGS_USE_SHARED=OFF + -DARROW_GRPC_USE_SHARED=OFF -DARROW_JEMALLOC_USE_SHARED=OFF + -DARROW_LZ4_USE_SHARED=OFF -DARROW_OPENSSL_USE_SHARED=OFF + -DARROW_PROTOBUF_USE_SHARED=OFF -DARROW_SNAPPY_USE_SHARED=OFF + -DARROW_THRIFT_USE_SHARED=OFF -DARROW_UTF8PROC_USE_SHARED=OFF + -DARROW_ZSTD_USE_SHARED=OFF -DARROW_USE_GLOG=OFF -DARROW_WITH_BACKTRACE=OFF + -DARROW_WITH_OPENTELEMETRY=OFF -DARROW_WITH_BROTLI=OFF -DARROW_WITH_BZ2=OFF + -DARROW_WITH_LZ4=OFF -DARROW_WITH_SNAPPY=OFF -DARROW_WITH_ZLIB=OFF + -DARROW_WITH_ZSTD=OFF -DARROW_WITH_UCX=OFF -DARROW_WITH_UTF8PROC=OFF + -DARROW_WITH_RE2=OFF /cpp + CMAKE_ARGS -Wno-dev + UPDATE_COMMAND "") + +ExternalProject_Get_Property(ARROW_EP install_dir) +add_library(arrow STATIC IMPORTED GLOBAL) +if(WIN32) + set_target_properties(arrow PROPERTIES IMPORTED_LOCATION ${install_dir}/lib/arrow_static.lib) +else() + set_target_properties(arrow PROPERTIES IMPORTED_LOCATION ${install_dir}/lib/libarrow.a) +endif() + +# create static library +add_library(${EXTENSION_NAME} STATIC ${EXTENSION_SOURCES}) +add_dependencies(${EXTENSION_NAME} ARROW_EP) +target_link_libraries(${EXTENSION_NAME} PUBLIC arrow) +target_include_directories(${EXTENSION_NAME} PRIVATE ${install_dir}/include) + +# create loadable extension +set(PARAMETERS "-warnings") +build_loadable_extension(${TARGET_NAME} ${PARAMETERS} ${EXTENSION_SOURCES}) +add_dependencies(${TARGET_NAME}_loadable_extension ARROW_EP) +target_link_libraries(${TARGET_NAME}_loadable_extension arrow) +if(WIN32) + target_compile_definitions(${TARGET_NAME}_loadable_extension PUBLIC ARROW_STATIC) +endif() +target_include_directories(${TARGET_NAME}_loadable_extension PRIVATE ${install_dir}/include) + +install( + TARGETS ${EXTENSION_NAME} + EXPORT "${DUCKDB_EXPORT_SET}" + LIBRARY DESTINATION "${INSTALL_LIB_DIR}" + ARCHIVE DESTINATION "${INSTALL_LIB_DIR}") +""" + + +def test_cmake_parser(): + """Test the CMake parser.""" + parser = CMakeParser() + expected = "arrow" + result = parser.parse(cmake_file) + assert expected in result diff --git a/tests/test_parsers/test_gomod.py b/tests/test_parsers/test_go.py similarity index 91% rename from tests/test_parsers/test_gomod.py rename to tests/test_parsers/test_go.py index 2690fe8d..3055fa7c 100644 --- a/tests/test_parsers/test_gomod.py +++ b/tests/test_parsers/test_go.py @@ -1,6 +1,6 @@ """Unit tests for Go-based dependency parsers.""" -from readmeai.parsers.gomod import GoModParser +from readmeai.parsers.go import GoModParser content = """ module geekdemo diff --git a/tests/test_parsers/test_npm.py b/tests/test_parsers/test_npm.py index 294983c5..1db57648 100644 --- a/tests/test_parsers/test_npm.py +++ b/tests/test_parsers/test_npm.py @@ -1,6 +1,6 @@ """Unit tests for JSON-based dependency parsers.""" -from readmeai.parsers.npm import JsonParser +from readmeai.parsers.npm import PackageJsonParser, YarnLockParser package_json_file = """ { @@ -38,9 +38,9 @@ """ -def test_json_parser(): +def test_package_json_parser(): """Tests the JSON parser.""" - parser = JsonParser() + parser = PackageJsonParser() dependencies = parser.parse(package_json_file) assert dependencies == [ "@react-navigation/native", diff --git a/tests/test_services/test_git_utilities.py b/tests/test_services/test_git_utilities.py index 5ac04f2c..f2af8457 100644 --- a/tests/test_services/test_git_utilities.py +++ b/tests/test_services/test_git_utilities.py @@ -10,6 +10,6 @@ def test_get_remote_file_url(): repo_url = "https://github.com/eli64s/readme-ai" file_url = get_remote_file_url(file_path, full_name, repo_url) expected_url = ( - "https://github.com/eli64s/readme-ai/blob/main/readmeai/main.py" + "https://github.com/eli64s/readme-ai/blob/master/readmeai/main.py" ) assert file_url == expected_url