copit
Copy reusable source code from GitHub repos, HTTP URLs, and ZIP archives into your project.
Inspired by shadcn/ui — instead of installing opaque packages, copit copies source code directly into your codebase. The code is yours: readable, modifiable, and fully owned. No hidden abstractions, no dependency lock-in. Override anything, keep what you need.
Use cases
-
Quickly copy and own code — Pull files from GitHub repos, HTTP URLs, or ZIP archives directly into your project. No forks, no submodules — just your own copy to read, modify, and maintain.
-
Build frameworks with injectable components — Create a core library as a traditional package, then offer optional components that users copy into their projects via copit. Think of how shadcn/ui is built on top of Tailwind and Radix UI: the base libraries are installed as dependencies, while UI components are copied in and fully owned. Apply the same pattern to any ecosystem — a LangChain-style core as a library, with community integrations (OpenAI, Anthropic, etc.) as injectable source code that users can customize freely.
Installation
Standalone (recommended)
# macOS / Linux
|
You can specify a version or install directory:
COPIT_VERSION=v0.1.0 |
# Custom install location
INSTALL_DIR=/usr/local/bin |
From PyPI
# or
From Cargo
Uninstall
If installed via the standalone script:
|
If installed to a custom directory:
INSTALL_DIR=/usr/local/bin |
For PyPI: pip uninstall copit. For Cargo: cargo uninstall copit.
Quick start
# Initialize a copit.toml in your project
# Copy a file from a GitHub repo
# Copy a file from a raw URL
# Copy from a ZIP archive
Usage
copit init
Creates a copit.toml config file in the current directory with a default target directory (vendor).
copit add <source>...
Fetches source code and copies it into your project.
Usage: copit add [OPTIONS] [SOURCES]...
Arguments:
[SOURCES]... Source(s) to add (e.g., github:owner/repo@ref/path, https://...)
Options:
--to <TO> Target directory to copy files into
--overwrite Overwrite existing files without prompting
--skip Skip existing files without prompting
--backup Save .orig copy of new version for excluded modified files
Source formats
| Format | Example |
|---|---|
| GitHub | github:owner/repo@ref/path/to/file (alias: gh:) |
| HTTP URL | https://example.com/file.txt |
| ZIP archive | https://example.com/archive.zip#inner/path |
copit update <path>...
Re-fetches specific tracked source(s) by path (as shown in copit.toml). Always overwrites non-excluded files.
# Re-fetch a specific tracked source
# Re-fetch with a new version
# Re-fetch with backup for excluded modified files
Options:
--ref <version>— Override the version ref for this update (updates the source string and ref field)--backup— Save.origcopy of new version for excluded modified files
copit sync
Re-fetches all tracked sources in copit.toml.
# Re-fetch all tracked sources
# Re-fetch all with backup for excluded modified files
Options:
--ref <version>— Override the version ref (errors if multiple sources are tracked)--backup— Save.origcopy of new version for excluded modified files
copit remove <path>... (alias: rm)
Removes previously copied files from disk and their entries from copit.toml.
# Remove a specific file
# Remove multiple files
# Remove all tracked sources
Config file
copit.toml tracks your project's target directory and all copied sources:
[]
= "vendor"
[[]]
= "vendor/prek-identify"
= "github:j178/prek@master/crates/prek-identify"
= "master"
= "abc123def456..."
= "2026-03-07T08:46:51Z"
= ["Cargo.toml", "src/lib.rs"]
ref: The user-specified version string (branch/tag/sha)commit: Resolved commit SHA from GitHub API (optional, GitHub sources only)exclude_modified: List of relative paths (within source folder) to skip on re-add. With--backup, the new version is saved as<file>.orig.
License
MIT