Skip to main content

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 --root or WT_ROOT.
  • codeshard new defaults its base ref to the current branch of the anchor repo.

Configuration

Config is stored in:

  • $XDG_CONFIG_HOME/codeshard/config.toml if XDG_CONFIG_HOME is 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 on cwd)
  • ide_enabled_default: default for --open-ide
  • ai_enabled_default: default for --open-ai
  • allow_shell: opt-in to execute IDE/AI commands through a shell (default false)

Environment variables override config:

  • CODESHARD_IDE_CMD
  • CODESHARD_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

  1. Create a shard: uv run codeshard new MY-TASK
  2. cd into it
  3. Run your AI tool (e.g. codex)
  4. Remove the shard when finished: uv run codeshard rm MY-TASK

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codeshard-0.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codeshard-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

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

Hashes for codeshard-0.1.0.tar.gz
Algorithm Hash digest
SHA256 314daf5e991680bb83c8fb3339aee8a4f3bf719bef14ae6141994d5822902a56
MD5 f658df92007dfaa93752078ab782b6d2
BLAKE2b-256 b1e0794821b842307153da620e14cbdc4653322fa4725b40bc217dd538af6a71

See more details on using hashes here.

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

Hashes for codeshard-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a24d3676008b55c1404d6de8c3e6af18d0e9c24ca9e1f12aef1ee03b91bfdd45
MD5 fa5374453d8937136a06d4e89ad7abe5
BLAKE2b-256 06b4cfcac44a0b00c5f5f30489bcef2e8aaf718f2599883499365b88cb6c603b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page