Skip to main content

Create isolated feature worktrees with allocated runtime environments.

Project description

new-feature

new-feature aims to eliminate friction for creating new features. In a single command, it creates isolated git worktrees, allocates conflict-free runtime values, runs project-defined setup and teardown commands (such as creating and deleting a feature database), and launches an interactive Codex session in the new worktree.

Install

uv tool install new-feature

Or copy and paste this into your favorite coding agent:

Run curl -fsSL https://pypi.org/pypi/new-feature/json, read info.description, and set up new-feature on this machine.

Usage

# Create a feature worktree and launch the configured agent.
uvx new-feature my-feature
# Create a feature worktree without launching another agent.
uvx new-feature my-feature --no-agent
# Merges the worktree into the main branch
uvx new-feature merge-feature my-feature
# Run configured teardown and remove the feature worktree.
uvx new-feature teardown my-feature
# Teardown a worktree even if it has uncommitted work.
uvx new-feature teardown my-feature --force

Project Config

Add config to the target repo's pyproject.toml:

[tool.new-feature]
target_branch = "main"
branch_prefix = "feature/"
agent = ["codex"]
push = false
setup = ["uv sync"]
pre_merge = ["uv run pytest"]
post_merge = ["uv run pytest"]
teardown = []

[tool.new-feature.env]
WEB_PORT = { allocate = "port", min = 3000, max = 3999 }
API_PORT = { allocate = "port", min = 4000, max = 4999 }
DATABASE_NAME = { allocate = "name", prefix = "myapp", max_length = 63 }
CACHE_DIR = { allocate = "path", base = ".new-feature/cache" }

agent is the command and arguments used to launch the coding agent. new-feature appends its generated feature prompt as the final argument, so agents that require a prompt flag can be configured directly:

[tool.new-feature]
agent = ["copilot", "--prompt"]

setup runs after worktree creation; teardown runs before worktree removal.

Supported env entries:

  • { value = "literal" }
  • { allocate = "port", min = 3000, max = 3999 }
  • { allocate = "integer", min = 1, max = 15 }
  • { allocate = "name", prefix = "myapp", max_length = 63 }
  • { allocate = "slug", prefix = "myapp" }
  • { allocate = "path", base = ".new-feature/cache" }

Lifecycle

new-feature my-feature creates .worktrees/my-feature, reserves env values in .new-feature/manifest.toml, runs setup, and launches interactive Codex in the worktree. It automatically adds .new-feature/ and .worktrees/ to .gitignore.

new-feature merge-feature my-feature runs pre-merge checks in the feature worktree, starts a no-commit merge into the target branch, runs post-merge checks on the merged target checkout, commits the merge only if those checks pass, and pushes only when push = true.

new-feature teardown my-feature runs the configured teardown commands before removing the worktree, deleting the branch, and removing the manifest entry. If the worktree has uncommitted changes or the branch has commits that are not in the target branch, pass --force to abandon them deliberately.

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

new_feature-0.2.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

new_feature-0.2.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file new_feature-0.2.0.tar.gz.

File metadata

  • Download URL: new_feature-0.2.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for new_feature-0.2.0.tar.gz
Algorithm Hash digest
SHA256 55714870d14eda73b356f3afcbc280e42bd000a2bb44be4b7e4f3063835bfe2d
MD5 f99e75b121ec24a883aa3dbac6a500de
BLAKE2b-256 61a648c9364ddefd7f15835fed223229f984679ac7fa42783055cc7ec7dad5db

See more details on using hashes here.

Provenance

The following attestation bundles were made for new_feature-0.2.0.tar.gz:

Publisher: publish.yml on crypdick/new-feature

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file new_feature-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: new_feature-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for new_feature-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca7ff795a85ad472cd4b5f9ced35809f9c5fb714172f5ef7660c529f0cbdd1aa
MD5 60b0018020417f83dc50116cc85e7e60
BLAKE2b-256 80b5906259e64a7a6a85a808679ca4470a2f0a80eaed2cb915b68b906f4636cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for new_feature-0.2.0-py3-none-any.whl:

Publisher: publish.yml on crypdick/new-feature

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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