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. The argument --system_instructions can also be used to display these instructions in the terminal. Feel free to modify them 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

Install the CLI tool with pip:

pip install flatten-codebase

Usage

Run the CLI with the --folders argument followed by the paths to the base folders you wish to process. For example: flatten-codebase --folders /path/to/folder1 /path/to/folder2

This will create a codebase.md file in the current directory containing the flattened structure and the 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.3.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

flatten_codebase-1.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flatten-codebase-1.3.tar.gz
  • Upload date:
  • Size: 3.9 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.3.tar.gz
Algorithm Hash digest
SHA256 31251f733bdc2f6bf0e20705d940a2ffed6d0c881eea848abc325c0af053194a
MD5 73b8a4233ba0fbb79d3a6e6bb33b43cc
BLAKE2b-256 37068c3a17df07b5d589201f587602c9d15489c1b56884866abc3bf0cbb5892b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flatten_codebase-1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a1a8b5dc24506269f0e84222653c746df3a8fe412ecf760500fc166c3ce0fbd1
MD5 bfd0cf120d05c17df8de56956915da0c
BLAKE2b-256 ce7227fa88ec870969ea431b05553b20122a6619eb2f9c9432b5b2cf6921cf8c

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