Skip to main content

Flatten Codebase simplifies codebase preparation for Language Models by converting it into a single Markdown file, making it easier for the developer to provide the codebase to the LM

Project description

Flatten Codebase

Overview

Flatten Codebase is a utility tool designed to simplify the process of preparing a codebase for analysis or processing by Language Models (LMs). It achieves this by flattening the entire codebase into a single Markdown (.md) file, making it easier for the developer to provide the codebase to the LM for various tasks such as code analysis, generation, or other natural language processing (NLP) activities.

Table of Contents

Purpose

The primary goal of this tool is to streamline the workflow involved in providing a codebase to a LM for various tasks such as code analysis, generation, or other natural language processing (NLP) activities. By converting the codebase into a flat structure within a Markdown document, it allows developers to easily provide the codebase to the LM without the need for complex file handling or processing.

Suggested system instructions

The file system_instructions.txt located on the project repository contains a suggestion of system instructions to be provided to the language model when using the codebase.md file generated by this tool. Feel free to modify it to better fit your needs.

Features

  • Directory Structure Representation: Generates a structured representation of each specified folder's contents, including all nested directories and files.
  • File Content Extraction: Extracts and includes the content of each file within the specified folders, facilitating direct analysis or processing by LMs.
  • Output in Markdown Format: Outputs the flattened codebase in a Markdown file, ensuring compatibility with a wide range of tools and platforms that support Markdown.

Getting Started

Prerequisites

Ensure you have Python installed on your system. This tool requires Python 3.x.

Installation

This project is intended to be run directly without installation. Simply clone the repository and navigate to the project directory.

Usage

Run the script with the --folders argument followed by the paths to the base folders you wish to process. For example: python3 flatten_codebase.py --folders /path/to/folder1 /path/to/folder2

This will create a codebase.md file containing the flattened structure and content of the specified folders.

Contributing

Contributions to improve the tool's functionality, performance, or documentation are welcome. Please feel free to submit pull requests or issues through the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flatten-codebase-1.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

flatten_codebase-1.2-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file flatten-codebase-1.2.tar.gz.

File metadata

  • Download URL: flatten-codebase-1.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for flatten-codebase-1.2.tar.gz
Algorithm Hash digest
SHA256 babd4ac890a25079f21bb91e763fc0e475766f4b9bd43af4d1af4b132b08eb9e
MD5 2cc72f00061de8f55abf698af42ed575
BLAKE2b-256 46ed5e762bdb4b51806d831494a214748aa52997fab6ef499f08e179e9a369f6

See more details on using hashes here.

File details

Details for the file flatten_codebase-1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for flatten_codebase-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6ff82db468bf5e4a5d4893bdeb1202c6094b328955cef2ea6ba32895266decc8
MD5 74dabc6f1757c3e839d25194a7d2c978
BLAKE2b-256 28bf25b8528ea0c9bc2db9a7c5c22436b6812d947cbbc6e17e44ba326a82ea25

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page