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 optionally launches a configured coding agent in the new worktree.
Install
uv tool install new-feature
new-feature setup --agent codex
new-feature setup launches the configured coding agent in the current repository. With
no local default agent yet, pass --agent codex or --agent claude. The agent inspects the
project, proposes a repository-specific configuration, asks about unresolved choices such
as the optional Codex hook, and waits for approval before further edits. Run it again to
review and improve an existing integration.
Documentation
The documentation site uses this README as its homepage and generates its API reference from package docstrings. Build it before committing documentation changes:
uv run mkdocs build --strict
To preview the site locally with live reload, run uv run mkdocs serve. Pushing to
main builds and deploys the site through GitHub Pages.
Usage
# Ask an agent to configure or improve new-feature for this repository.
new-feature setup --agent codex
# Create a feature worktree. It launches no agent unless you configure a local default.
new-feature my-feature
# Create a feature worktree and explicitly launch an agent.
new-feature my-feature --agent claude
# Create a feature worktree without launching an agent, even when a default is configured.
new-feature my-feature --no-agent
# Merges the worktree into the main branch
new-feature merge my-feature
# Run configured teardown and remove the feature worktree.
new-feature teardown my-feature
# Teardown a worktree even if it has uncommitted work.
new-feature teardown my-feature --force
# Inspect managed features and diagnose stale state.
new-feature list
new-feature doctor
new-feature doctor --repair
Project Config
Put shared repository policy in the target repo's .new-feature.toml:
target_branch = "main"
setup = ["uv sync"]
pre_merge = ["uv run pytest"]
post_merge = ["uv run pytest"]
teardown = []
[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" }
Keep personal preferences in the ignored .new-feature.local.toml sidecar:
default_agent = "codex"
push = true
agents = { custom = ["custom-agent", "--prompt"] }
new-feature setup and feature creation ensure that *.local.toml is in .gitignore.
This makes local agent commands, automatic-push preferences, and machine-specific values
safe to customize without changing versioned repository policy.
All settings remain optional. new-feature resolves a shared configuration from
.new-feature.toml when present, otherwise from [tool.new-feature] in pyproject.toml.
It then overlays .new-feature.local.toml, which uses the standalone-file syntax above and
can also be used on its own. A local value replaces a shared scalar or command list; entries
in agents and env overlay by name. For projects that prefer the shared pyproject.toml
form, use [tool.new-feature.env] there and [env] in the local sidecar.
default_agent and push remain supported in shared config when a repository deliberately
wants to enforce them, but local placement is the recommended default. default_agent is
optional: without it, feature creation does not launch an interactive agent. Codex and Claude
are built in and always work with --agent; agents adds or overrides named commands and fixed
arguments. new-feature appends its generated feature prompt as the final argument, so a
personal agent that requires a prompt flag can be configured in the local sidecar:
# .new-feature.local.toml
default_agent = "custom"
agents = { custom = ["custom-agent", "--prompt"] }
Use a configured agent for one invocation, or pass an executable command directly:
new-feature my-feature --agent claude
new-feature my-feature --agent "fooagent --baz-flag"
new-feature setup --agent claude
When the value exactly matches a key in agents, that configured command is used. Otherwise,
new-feature parses the value as an executable command without invoking a shell.
The built-in create and setup prompts can be overridden with create_prompt and setup_prompt in
TOML, or for one invocation with --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 branch my-feature and worktree .worktrees/my-feature, reserves env values in .new-feature/manifest.toml, runs setup, and launches an agent only when default_agent or --agent selects one. It automatically adds .new-feature/, .worktrees/, and *.local.toml to .gitignore. If setup fails, it runs a forced teardown so the partial worktree, branch, and manifest entry do not linger.
After a successful create that does not launch an agent (for example, with --no-agent or no selected agent), new-feature prints the absolute worktree path and a copy-pasteable command such as:
Worktree ready: /path/to/repository/.worktrees/my-feature
Next: cd -- /path/to/repository/.worktrees/my-feature
A CLI process cannot change its parent shell's or an already-running coding agent's working directory. In an interactive shell, run the printed cd command; an existing coding agent should use the printed absolute path as the working directory for its subsequent tools. Paths on the Next: line are shell-quoted when necessary.
new-feature list shows each managed feature and its current Git/worktree state. new-feature doctor reports stale manifest entries, dirty worktrees, unmerged branches, and configuration drift. doctor --repair removes stale manifest entries whose worktree and branch are both already gone, and recovers a missing worktree only when its branch is already merged.
new-feature merge my-feature runs pre-merge checks in the feature worktree and rejects a conflicting merge before changing the target checkout. It then 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. Any failure after the merge starts is aborted.
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.
Agent hooks
Install the Codex or Claude Code hook in the current repository:
new-feature install-codex-hook
new-feature install-claude-hook
The Codex hook is written to .codex/hooks.json; Codex loads the guard only for this trusted
repository. The Claude Code hook is written to the hooks section of .claude/settings.json,
which Claude Code loads at session start. Both guards protect the configured target branch from
direct agent edits and require Git worktree creation and removal to go through the managed
new-feature lifecycle.
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 new_feature-1.1.11.tar.gz.
File metadata
- Download URL: new_feature-1.1.11.tar.gz
- Upload date:
- Size: 110.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2931deeb62f4ab86d2b9bc4375c53a767a992535eea9f17bcbc784aa7b95a334
|
|
| MD5 |
f584af987c3a281321f3ee677c85eb27
|
|
| BLAKE2b-256 |
66b43821309e5e1b56c86f527fa8263ec4ae6b06bca3df3f1258265c78cdf540
|
Provenance
The following attestation bundles were made for new_feature-1.1.11.tar.gz:
Publisher:
publish.yml on crypdick/new-feature
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
new_feature-1.1.11.tar.gz -
Subject digest:
2931deeb62f4ab86d2b9bc4375c53a767a992535eea9f17bcbc784aa7b95a334 - Sigstore transparency entry: 2210956904
- Sigstore integration time:
-
Permalink:
crypdick/new-feature@096968ba02e3a6df4d85fbf4ebd14c386b3d2346 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/crypdick
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@096968ba02e3a6df4d85fbf4ebd14c386b3d2346 -
Trigger Event:
push
-
Statement type:
File details
Details for the file new_feature-1.1.11-py3-none-any.whl.
File metadata
- Download URL: new_feature-1.1.11-py3-none-any.whl
- Upload date:
- Size: 36.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18a99a6414d6513ba3232812d6124bbe0529edd8b68d6e18fd96ee42cf13f27c
|
|
| MD5 |
f9404efb1a669bdbb35895397c7f2b3e
|
|
| BLAKE2b-256 |
7b77f381d07d7e2a01c26d4ffedd7fb849860d01f5a402c37c8d7df748d9f528
|
Provenance
The following attestation bundles were made for new_feature-1.1.11-py3-none-any.whl:
Publisher:
publish.yml on crypdick/new-feature
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
new_feature-1.1.11-py3-none-any.whl -
Subject digest:
18a99a6414d6513ba3232812d6124bbe0529edd8b68d6e18fd96ee42cf13f27c - Sigstore transparency entry: 2210956936
- Sigstore integration time:
-
Permalink:
crypdick/new-feature@096968ba02e3a6df4d85fbf4ebd14c386b3d2346 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/crypdick
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@096968ba02e3a6df4d85fbf4ebd14c386b3d2346 -
Trigger Event:
push
-
Statement type: