feat(cli): add et git create-branch command - #5
Merged
Merged
Conversation
Add `et git create-branch` (aliased `et git cb`) which creates and switches to a git branch named after the current task's Jira issue, following Canonical's `type/scope-short-description-jirakey` PR branch naming convention. - New `et.jira.fetch_issue_basis` fetches an issue's summary, type, and labels. - New `et.git_branch` module: slugify(), default_branch_type() (Bug->fix, Story->feat, Task->chore, documentation label->docs), build_branch_name(), git subprocess helpers, and the create_branch_interactive() orchestrator. - New `et git create-branch`/`et git cb` CLI command: resolves the ticket via the active workspace or -j/--jira KEY, prints the issue's clickable link and summary first, prompts to accept/override the branch type and edit the description slug, then creates and checks out the branch. - Update README and CHANGELOG. - Add unit/CLI tests for all of the above. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
test_git_create_branch_reports_no_active_workspace_error relied on the developer's local ~/.config/et/config.yaml existing (load_config() was never mocked), so it passed locally but failed in CI where no config file exists. Mock et.cli.load_config like the other git-create-branch tests do. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
et git create-branch(aliasedet git cb), which creates andswitches to a git branch named after the current task's Jira issue,
following Canonical's PR branch naming convention:
type/scope-short-description-jirakey(e.g.feat/tcp-wildcard-sni-support-isd-1234).Details
-j/--jira KEYoverride (matching the existinget jiraconvention).Bug→fix,Story→feat,Task→chore; adocumentationlabel always wins anddefaults to
docs), letting the user accept it or pick a different onefrom the fixed
feat/fix/docs/chore/test/cilist — this becomes thebranch's
type/prefix, which isn't otherwise freely editable.scope-short-descriptionsegment as a slug of the issuesummary, freely editable at the prompt.
which is never editable.
the computed name already exists.
HEADand switches to it(
git checkout -b).New/changed files
src/et/jira.py: newfetch_issue_basis(summary/type/labels).src/et/git_branch.py(new): pure branch-naming logic + git subprocesshelpers +
create_branch_interactiveorchestrator.src/et/cli.py: newgitTyper group withcreate-branch/cb.README.md/CHANGELOG.md: documented the new command.tests/test_git_branch.py(new), plus additions totests/test_jira.pyandtests/test_cli.py.Testing
just lint/just static/just testall pass (381 tests, 90.5%coverage).