src2one

0.1.0 • Public • Published

src2one

[[TOC]]

Overview

This simple TypeScript script copies the contents of source files into a single file. This can be useful for uploading to online services like ChatGPT, Perplexity, Claude, etc. It's designed for quick use, speeding up development alongside AI. Just run src2one, and voila! All your sources are in one file, ready to be uploaded.

Dependencies

Installation

  1. Install Bun (see dependencies)
  2. Clone the repository git clone https://github.com/monnef/src2one.git
  3. cd src2one
  4. Install dependencies with bun i
  5. Build the project with bun run build
  6. Setup the alias

Build

Build the project with the following command:

$ bun run build

This will create a dist/src2one executable in the project directory.

$ dist/src2one --version
0.1.0

Alias

Adding an alias is strongly recommended. The rest of this document (and the script itself) assumes the alias has been added.

Run the following command in this project's directory:

$ bun start alias

Then follow the instructions in the output.

Usage

To generate a config file for a given project, run the following command in the project directory:

$ src2one init

Then, to generate the sources file, run the following command in the project directory:

$ src2one
Found 2 file(s) to process, 0 file(s) ignored.
Writing file contents into sources.txt...
Processing done.
$ cat sources.txt
Generated on: 2025-03-23T14:04:23.185Z
Full project path: /mnt/dev/typescript/src2one/test/yaml/nested

==== /mnt/dev/typescript/src2one/test/yaml/nested/src/nested/nested-file.txt ====
nested

==== /mnt/dev/typescript/src2one/test/yaml/nested/src/a.txt ====
a

Configuration

The script looks for configuration in the following files, in order of precedence:

  • src2one.yaml
  • src2one.json

If no configuration file is found, the script will terminate with an error.

Configuration File Structure

The configuration file should contain the following keys:

  • fileName: The name of the output file (default: sources.txt).
  • inputNames: An array of directories or files to include (default: ['.']).
  • ignorePatterns: An array of JavaScript regular expressions to ignore (default: ['^sources.txt$', '^src2one.yaml$']).

Example src2one.yaml:

fileName: 'sources.txt'
inputNames:
  - 'src'
  - 'lib'
ignorePatterns:
  - '^sources.txt$'

License

AGPLv3

Readme

Keywords

none

Package Sidebar

Install

npm i src2one

Weekly Downloads

3

Version

0.1.0

License

AGPL-3.0-or-later

Unpacked Size

93.8 MB

Total Files

24

Last publish

Collaborators

  • monnef