Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Continuous Integration

on:
push:
branches:
- develop

jobs:
run_tests:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e .[dev]

- name: Run tests
run: pytest
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish to TestPyPI

on:
push:
tags:
- 'v*' # Triggers on any tag starting with v, like v0.0.3

jobs:
build_and_publish:
runs-on: ubuntu-latest
permissions:
id-token: write # Required for trusted publishing
contents: read # Required to read the repository content

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install uv
run: pipx install uv

- name: Build distributions
run: uv build

- name: Publish to PyPI
run: uv publish
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.1] - 2025-08-30

### Added
- Configured a GitHub Actions pipeline for automated testing and releases.
- `-v` and `--version` to scriber app
- The `--config` flag now accepts a path to a `pyproject.toml` file, providing more flexibility for monorepo configurations.

### Fixed
- Refined the default exclusion list in `DEFAULT_CONFIG`.

## [1.0.0] - 2025-08-28

### Initial Release
- **Project Structure Mapping**: Implemented smart file and folder structure mapping.
- **Gitignore Support**: Added logic to respect `.gitignore` files, automatically excluding specified files and directories from the mapping process.
- **Code Analysis**: Included functionality to analyze Python source code.
- **Clipboard Integration**: Enabled copying the generated project structure to the clipboard.
- **Command-Line Interface**: Created a command-line tool with a configurable `init` command for saving settings to `pyproject.toml`.
- **Configuration**: Introduced `pyproject.toml` as the single source of truth for project metadata and configuration.
- **Testing**: Added a test suite using `pytest` to ensure core functionality and CLI commands work as expected.
147 changes: 85 additions & 62 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,76 @@
# Introduction

<p align="center">
<img src="https://raw.githubusercontent.com/SunneV/ProjectScriber/main/assets/scriber_logo.svg" alt="ProjectScriber Logo" width="420">
<img src="https://raw.githubusercontent.com/SunneV/ProjectScriber/main/assets/scriber_logo.svg" alt="ProjectScriber Logo" width="300">
<br>
<img src="https://raw.githubusercontent.com/SunneV/ProjectScriber/main/assets/scriber_name.svg" alt="ProjectScriber Name" width="250">
</p>
<p align="center">
<img src="https://raw.githubusercontent.com/SunneV/ProjectScriber/main/assets/scriber_name.svg" alt="ProjectScriber Name" width="300">
<a href="https://github.com/SunneV/ProjectScriber/releases"><img src="https://img.shields.io/github/v/release/SunneV/ProjectScriber?style=flat&label=latest%20version" alt="Latest Version"></a>
<a href="https://pypi.org/project/project-scriber/"><img src="https://img.shields.io/pypi/v/project-scriber?style=flat" alt="PyPI Version"></a>
</p>

A command-line tool to intelligently map and compile your entire project's source code into a single, context-optimized
text file for Large Language Models (LLMs).
A command-line tool to intelligently map and compile your project's source code into a single, context-optimized text
file for Large Language Models (LLMs).

ProjectScriber scans your project directory, respects `.gitignore` rules, applies custom filters, and bundles all
relevant code into a clean, readable format. It's the perfect way to provide a complete codebase to an AI for analysis,
documentation, or refactoring.
---

-----
## Why ProjectScriber?

When working with LLMs, providing the full context of a codebase is crucial for getting accurate analysis,
documentation, or refactoring suggestions. Manually copying and pasting files is tedious and error-prone. *
*ProjectScriber** automates this process. It scans your project, respects `.gitignore` rules, applies custom filters,
and bundles all relevant code into a clean, readable format perfect for any AI model.

## Key Features

- **🌳 Smart Project Mapping:** Generates a clear and intuitive tree view of your project's structure.
- **⚙️ Intelligent Filtering:** Automatically respects `.gitignore` rules and supports custom `include` and `exclude`
patterns via a `.scriber.json` file for fine-grained control.
- **📊 In-depth Code Analysis:** Provides a summary with total file size, estimated token count (using `cl100k_base`),
and a language breakdown for a quick overview of your codebase.
- **✨ Interactive Setup:** A simple `scriber init` command walks you through creating a configuration file tailored to
* **🌳 Smart Project Mapping:** Generates a clear and intuitive tree view of your project's structure.
* **⚙️ Intelligent Filtering:** Automatically respects `.gitignore` rules and supports custom `include` and `exclude`
patterns for fine-grained control.
* **📊 In-depth Code Analysis:** Provides a summary with total file size, estimated token count (using `cl100k_base`),
and a language breakdown.
* **✨ Interactive Setup:** A simple `scriber init` command walks you through creating a configuration file tailored to
your project.
- **📋 Clipboard Integration:** Use the `--copy` flag to automatically copy the entire consolidated output to your
clipboard, ready to be pasted into any application.
- **🔧 Flexible Configuration:** Manage your settings globally in a `pyproject.toml` file or per-project with a
`.scriber.json` file.
* **📋 Clipboard Integration:** Use the `--copy` flag to automatically copy the entire output to your clipboard.
* **🔧 Flexible Configuration:** Manage settings in a `pyproject.toml` or a project-specific `.scriber.json` file.

-----
---

## Getting Started

### Prerequisites

- Python 3.10 or higher.

### Installation

Install the package from the source using pip. For development, include the optional dependencies.
Install the package directly from the [Python Package Index (PyPI)](https://pypi.org/project/project-scriber/).

```shell
# Navigate to the project root directory
pip install .[dev]
```

This will install `ProjectScriber` and make the `scriber` command available in your terminal.
pip install project-scriber
````

-----

## Usage

### 1\. Basic Scan
#### 1\. Basic Scan

To run ProjectScriber on the current directory, simply execute the `scriber` command. This will generate a
`scriber_output.txt` file in the same directory.
Run `scriber` in your project's root directory. It will generate a `scriber_output.txt` file.

```shell
scriber
```

To target a different project directory:
To target a different directory:

```shell
scriber /path/to/your/project
```

### 2\. First-Time Configuration
#### 2\. First-Time Configuration

For a new project, run the interactive `init` command to create a `.scriber.json` configuration file. This will guide
you through setting up rules for ignoring files and respecting `.gitignore`.
For a new project, run the interactive `init` command to create a `.scriber.json` configuration file.

```shell
scriber init
```

### 3\. Advanced Example
#### 3\. Advanced Example

Scan a different project, specify a custom output file, and copy the result to the clipboard all in one command.
Scan another project, specify a custom output file, and copy the result to the clipboard in one command.

```shell
scriber ../my-other-project --output custom_map.txt --copy
Expand All @@ -89,23 +80,31 @@ scriber ../my-other-project --output custom_map.txt --copy

## Commands and Options

You can customize ProjectScriber's behavior with the following commands and options.

| Command/Option | Alias | Description |
|:----------------------|:-----:|:-------------------------------------------------------------------------------|
| `scriber [path]` | | Targets a specific directory. Defaults to the current working directory. |
| `init` | | Starts the interactive process to create a `.scriber.json` configuration file. |
| `--output [filename]` | `-o` | Specifies a custom name for the output file. |
| `--copy` | `-c` | Copies the final output directly to the clipboard. |
| `--tree-only` | | Generates only the folder structure map, excluding all file contents. |
| `--config [path]` | | Specifies the path to a custom configuration file. |
| Command/Option | Alias | Description |
|:----------------------|:-----:|:-----------------------------------------------------------------------------|
| `scriber [path]` | | Targets a specific directory. Defaults to the current working directory. |
| `init` | | Starts the interactive process to create a configuration file. |
| `--help` | `-h` | Displays the help message. |
| `--version` | `-v` | Displays the current version of ProjectScriber. |
| `--output [filename]` | `-o` | Specifies a custom name for the output file. |
| `--copy` | `-c` | Copies the final output directly to the clipboard. |
| `--tree-only` | | Generates only the folder structure map, excluding all file contents. |
| `--config [path]` | | Specifies a path to a custom `.json` or `pyproject.toml` configuration file. |

-----

## Configuration

You can control ProjectScriber's behavior by placing a `.scriber.json` file in your project's root, which can be easily
created with the `scriber init` command.
ProjectScriber uses the following order of precedence for loading configurations:

1. **`--config [path]` flag**: Highest priority. If you provide a path to a `.json` or `pyproject.toml` file, its
settings will be used.
2. **`.scriber.json`**: If no `--config` flag is used, Scriber looks for a `.scriber.json` file in the project's root.
This file's settings will override any found in `pyproject.toml`.
3. **`pyproject.toml`**: If neither of the above is found, it looks for a `[tool.scriber]` section in a `pyproject.toml`
file in the project's root.
4. **Default Config**: If no configuration is found, `scriber` will create a default `.scriber.json` on its first run in
a directory.

**Example `.scriber.json`:**

Expand All @@ -132,18 +131,42 @@ use_gitignore = true
exclude = [
"__pycache__",
"node_modules",
"*.log",
"*.log"
]
include = [
"*.py",
"*.js",
"*.js"
]
```

- **`use_gitignore`**: If `true`, all patterns in your `.gitignore` file will be used for exclusion.
- **`exclude`**: A list of file or folder name patterns to explicitly ignore.
- **`include`**: If provided, *only* files matching these patterns will be included in the output, overriding other
rules.
-----

## For Developers

### Prerequisites

* Python 3.10 or higher.

### Development Installation

Clone the repository and install it in editable mode with all development dependencies.

```shell
git clone [https://github.com/SunneV/ProjectScriber.git](https://github.com/SunneV/ProjectScriber.git)
cd ProjectScriber
pip install -e .[dev]
```

### Running Tests

Run the test suite using `pytest`.

```shell
pytest
```

-----

## Contributing

Settings can also be placed in your `pyproject.toml` file under the `[tool.scriber]` section. If a `.scriber.json` file
is present, it will take precedence over the `pyproject.toml` configuration.
Contributions are welcome\! If you have a suggestion or find a bug, please open an issue to discuss it.
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "project-scriber"
version = "1.0.0"
version = "1.0.1"
authors = [
{ name="SunneV (Wojciech Mariusz Cichoń)", email="wojciech.m.cichon@gmail.com" },
]
Expand Down Expand Up @@ -44,4 +44,9 @@ requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["src/scriber"]
packages = ["src/scriber"]

[tool.pytest.ini_options]
pythonpath = [
"."
]
Loading