Manage Git worktrees as disposable AI coding sandboxes.
Project description
codeshard
codeshard manages Git worktrees as disposable AI coding sandboxes. It is designed to be run from an anchor clone and creates sibling worktree directories for isolated sessions.
Requirements
- Python 3.12+
- macOS or Linux
Install (local dev)
uv run codeshard --help
Usage
uv run codeshard new ABC-123
uv run codeshard new ABC-123 --open-ide --ide-cmd 'code "{path}"'
uv run codeshard new ABC-123 --open-ai --ai-cmd 'wezterm start --cwd "{path}" -- codex'
uv run codeshard ls
uv run codeshard rm ABC-123
uv run codeshard rm ABC-123 --delete-branch
uv run codeshard config set ide_cmd 'code "{path}"'
uv run codeshard config set ai_cmd 'codex'
uv build
Tip: if you want a shorter command, you can add alias cs="codeshard" to your shell profile.
Behavior
- The anchor repo is discovered via
git rev-parse --show-toplevel(or--repo). - Worktrees live under a sibling directory:
<anchor_parent>/<anchor_name>-wt, unless overridden by--rootorWT_ROOT. codeshard newdefaults its base ref to the current branch of the anchor repo.
Configuration
Config is stored in:
$XDG_CONFIG_HOME/codeshard/config.tomlifXDG_CONFIG_HOMEis set- otherwise
~/.config/codeshard/config.toml
Config keys:
ide_cmd: command template to open an IDE at{path}ai_cmd: command template to launch an AI tool (uses{path}if present, otherwise relies oncwd)ide_enabled_default: default for--open-ideai_enabled_default: default for--open-aiallow_shell: opt-in to execute IDE/AI commands through a shell (default false)
Environment variables override config:
CODESHARD_IDE_CMDCODESHARD_AI_CMD
Recommended command templates
IDE command examples (must include {path}):
- VS Code:
code "{path}" - Cursor:
cursor "{path}" - IntelliJ IDEA:
idea "{path}"
AI command examples (may include {path}; otherwise uses the worktree as cwd):
- Simple CLI in current terminal:
codex - WezTerm (new window):
wezterm start --cwd "{path}" -- codex - Kitty (new window):
kitty --directory "{path}" codex - macOS Terminal (new window):
open -a Terminal "{path}" - macOS iTerm (new window):
open -a iTerm "{path}"
Tip: If you want a new tab instead of a new window, use your terminal's CLI flags in ai_cmd (terminal-specific).
Using codeshard with Codex
- Create a shard:
uv run codeshard new MY-TASK cdinto it- Run your AI tool (e.g.
codex) - Remove the shard when finished:
uv run codeshard rm MY-TASK
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codeshard-0.1.0.tar.gz.
File metadata
- Download URL: codeshard-0.1.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
314daf5e991680bb83c8fb3339aee8a4f3bf719bef14ae6141994d5822902a56
|
|
| MD5 |
f658df92007dfaa93752078ab782b6d2
|
|
| BLAKE2b-256 |
b1e0794821b842307153da620e14cbdc4653322fa4725b40bc217dd538af6a71
|
File details
Details for the file codeshard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: codeshard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a24d3676008b55c1404d6de8c3e6af18d0e9c24ca9e1f12aef1ee03b91bfdd45
|
|
| MD5 |
fa5374453d8937136a06d4e89ad7abe5
|
|
| BLAKE2b-256 |
06b4cfcac44a0b00c5f5f30489bcef2e8aaf718f2599883499365b88cb6c603b
|