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.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

flatten_codebase-1.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flatten-codebase-1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 c4be2a3bf26f56050bd9b24467f64455f8c741f822d06b1156d7eb90dc0435c6
MD5 2bdab73d8edb9bf7e94b5d1b3bf8c2fe
BLAKE2b-256 09f3f716683528e475f3c3c7ea789e0d0cdb16bdd1021ebb89114e12fddbc54d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flatten_codebase-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ad6f83c000014f82c351735e8ce5c95e89a275075e8dee5f655aa6527649634a
MD5 d8c58bf7541d4a50b8eb414d47592552
BLAKE2b-256 51815a20f6d3b44de093e8785bee57dbda1e0987248bd3c303cba2279ced665c

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