Claude2Project (C2P) is a standalone bash utility designed to streamline the process of converting monolithic artefacts generated by the Claude.ai chatbot into a clean, structured project in seconds.
- 🏗️ Artefact Parsing and Change Management: Processes content across multiple files, intelligently creating, updating, or modifying them to integrate AI-generated code seamlessly into your project structure.
- 🍃 Local Git Workflow: Provides a pull request style review flow locally to manage and integrate iterative code updates. Compare changes, selectively apply updates, and manage modifications without affecting your current branch.
- Say goodbye to copy-pasting code. Simplifies integrating Claude-generated artefacts into your projects.
- Keeps your active branch safe and unaltered during reviews.
- Ensures a tidy workspace, leaving no residual clutter after merging changes.
C2P is designed for developers who want a practical, efficient way to integrate Claude-generated code into their projects, without switching to anagenetic editor like "Cursor", "v0" etc.
Read on to see how it fits into your workflow!
While there isn't a stable release just yet, you can easily install the development build using the installation script.
-
Clone the repo:
git clone git@github.com:souravray/Claude2Project.git
Or download the code zip. -
Navigate to the project directory:
cd /.../download_path../Claude2Project
-
Give execution permissions to the installer:
chmod +x installer.sh
-
Run the installer in dev mode:
./installer.sh --dev
The script will copy the /src
files to /usr/local/lib/c2p
(or the equivalent folder based on your OS), and create a symlink in /usr/local/bin
. After that, you should be able to run c2p --help
from anywhere.
If the user doesn't have permission to write to the
bin
folder, the script will prompt you to run it withsudo
.
C2P has minimal external dependencies, most of which come pre-installed on *nix systems. It supports git
, grep
, and sed
. If any one is missing, the installer will prompt you to install them.
The code is currently tested on macOS (Darwin) with an Intel processor but should work on most Linux and BSD distributions. It can also run on Cygwin on Windows.
This project is licensed under the 2-Clause BSD License – use, modify, and share freely, just give credit where it’s due! 🍻
Using C2P is straightforward! Here's the basic command syntax:
c2p [--option] <input_file> [destination_directory]
-
--auto-add-new
: Automatically stages a new file during review without prompting. Use this option if you want new files generated by Claude's artefacts to be automatically staged during the review process. -
--auto-skip-new
: Automatically skips a new file during review without prompting. Use this option to ignore new files during the review process without any prompts
- Process a file and specify a destination directory
c2p my_artefacts.json /my/project/directory
This will parse the input file and apply the changes to the specified directory.This will parse the input file and apply the changes to the specified directory. 2. Auto-add new files during a review
c2p --auto-add-new my_artefacts.json /my/project/directory
This automatically stages any new files for inclusion during the review process without asking for manual confirmation. 3. Skip adding new files during a review
c2p --auto-skip-new my_artefacts.json /my/project/directory
This will skip all newly generated files and only focus on reviewing changes to existing ones. C2P is designed to seamlessly integrate into your workflow, simplifying the review and integration of AI-generated artefacts.
C2P adapts based on the state of your project directory. The program will automatically select the appropriate workflow for you:
- Initialisation Workflow
-
Triggered when the project directory is empty, and Git is not initialised.
-
All files will be created, staged, and committed directly to the main branch—no review required in this flow.
-
This provides a quick and hassle-free way to kickstart your project.
- Update Workflow
-
Triggered when the project directory has an initialised Git repository and a clean working tree.
-
Changes are applied on a review branch, where you can review modifications and select or reject changes, before they are merged back to the original branch.
During the update workflow, a review option is presented for you to choose:
-
User can chose one of the tool depending on it's availability:
- VS Code
- VIM/NeoVIM
- Default Git Diff Tool: this will be there even when other tools are not available
-
Choose which code to keep or discard during the review. This is particularly useful for selectively applying partial code generated by Claude.
-
All changes are made on a separate review branch, ensuring that the main branch remains untouched until the changes are finalised.
For more details on Git-related operations, check out the Git Workflow section.
The Git branching strategy in C2P ensures that code changes are systematically reviewed, staged, merged, and cleaned up to maintain a tidy and conflict-free repository. Borrowing from tried-and-tested Git methodologies, such as feature branching and pull-request workflows. It streamlines the workflow for you to minimizes the need for manualy executing git commands.
The workflow revolves around a review branch pattern, creating temporary branches to isolate and validate changes before merging into the last working branch.
- Working Branch: Serves as the stable branch, housing the final, polished code. All merges funnel back here after careful review.
- Review Branch: A dynamically named branch (e.g.,
review-branch/{incremental_number}
) where proposed changes are staged, reviewed, and finalised. This branch is created for every new update action and deleted after the merge process.
During the update process:
- Changes generated by Claude are staged in the review branch for inspection.
- Users review file modifications using their preferred diff tool, such as VS Code, VIM, or the default Git diff viewer.
- After review:
- Accepted changes are staged.
- Rejected and unstaged partial changes are reverted, ensuring the working tree reflects only the desired updates.
By maintaining a clean staging area, the workflow avoids accidental inclusion of unwanted changes.
Once reviewed, changes in the review branch are merged into the main branch.
- Fast-Forward Merges: Used if no other changes have been introduced in the main branch since the review branch was created.
- Three-Way Merges: Used when concurrent changes in the main branch require conflict resolution.
git mergetool
, is integrated int the flow to automate and simplify the process. Once conflicts are resolved, the merge is committed with a descriptive message.
After a successful merge, C2P ensures the repository remains tidy:
- Review Branch Deletion: The temporary review branch is deleted locally and, if applicable, from the remote repository.
- Workspace Cleanup: Untracked files and other temporary artifacts are removed using:
git clean -fd
This cleanup prevents clutter and keeps the repository ready for future actions.
The workflow balances structure with flexibility:
- Isolated Changes: By staging all updates in review branches, the workflow minimizes disruptions to the main branch.
- Granular Control: The review process enables selective integration of changes, essential for iterative code generation.
- Automated Cleanupn: A clean repository ensures clarity and reduces the likelihood of errors in future updates.
Every contribution helps improve C2P, whether it’s fixing bugs, adding features, or refining documentation.
Start by reviewing the Contribution Guidelines for details on how to get involved.
Encounter a bug? Open an issue to bring it to attention.
Have an idea to enhance C2P? Suggest a feature by creating an issue.