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

Uploaded Source

Built Distribution

flatten_codebase-1.0-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flatten-codebase-1.0.tar.gz
  • Upload date:
  • Size: 2.5 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.0.tar.gz
Algorithm Hash digest
SHA256 beaee8e0afe8a001f600633a7e7d42bfdfcb5649b5088daae565113b7c3ba9f6
MD5 420587927e6874ce75de921ba281bd40
BLAKE2b-256 78a2af0092d3f5b7d096ce454de6671c9989595b9224d506c82e455c1561ee61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for flatten_codebase-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae5b7450b6fac669fde9db53f24a925e59e8f28be0057966b6504fc00917e964
MD5 012732d6823274e1a72bf1d7a6523fda
BLAKE2b-256 a0cbf143e5eac6a3f6a89f31aea07ac8c6b99a2c86ba3cbc3884457961a22d71

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