Add Branchless Trail Creation
I can't create a trail without branch on the CLI right now?
Yes — the CLI currently requires a branch for entire trail create.
You can omit --branch, but the CLI will still choose one:
- on a feature branch: uses current branch
- on the default/base branch with
--title: derives a branch slug from the title - interactive mode: prompts for a branch name
It cannot currently create a truly branchless trail. The implementation also pushes the branch before creating the trail, because the API request includes branch_name and uses branch_action: "link".
I want to be able to create a branchless trail though!
Implemented branchless trail creation.
Usage:
What changed:
- Added
--no-branchtoentire trail create - Skips branch creation/fetch/push for branchless trails
- Omits
branch_nameandbranch_actionfrom the create API request - Rejects invalid combos like
--no-branch --branch ...and--no-branch --checkout
Tests passing:
Create a trail
Created branchless trail:
Support branchless trail creation
ID: 019eef80-3535-7389-819f-47a6c5029020
Why branchless... create one with branch, commit the changes and push.
Or add one to the one you created...
Done — created branch, committed, pushed, and created a branch-backed trail.
- Branch:
support-branchless-trail-creation - Commit:
9ebc42c96—Add branchless trail creation - Trail ID:
019eefa1-9d8b-7753-a52a-0e40b62634b9
PR URL from GitHub:
https://github.com/entireio/cli/pull/new/support-branchless-trail-creation
Make sure checks are passing.
Checks are passing on support-branchless-trail-creation at fc3274c98.
CI:
- PR Binary Size: success
- License Check: success
- Tests: success
- Lint: success
Also ran locally:
go test ./cmd/entire/climise run lint
Entire Trail review comment ID: 019eefac-3ab4-7e8d-97c6-d9b853812194 URL: https://entire.io/gh/entireio/cli/trails/634/support-branchless-trail-creation Severity: high Context: cmd/entire/cli/trail_cmd.go:717 Selected context:
When noBranch is true, prepareTrailCreateBranch returns early with an empty branch name, but the caller unconditionally attempts to push the branch with pushBranchToOrigin(branch) where branch="". This will fail or behave incorrectly for branchless trails. The push should be skipped when noBranch is true or when branch is empty.
Addressed and resolved the review finding.
Changes:
- Added explicit skip in
prepareTrailCreateBranchfor branchless/empty branch cases. - Added regression test:
TestPrepareTrailCreateBranchSkipsBranchlessTrail. - Amended and force-pushed branch.
Latest commit: 5921e409
Checks are passing:
- PR Binary Size: success
- License Check: success
- Lint: success
- Tests: success
Working tree is clean.
Entire Trail review comment ID: 019ef439-d59e-74bd-94a0-2621e85f2f8d URL: https://entire.io/gh/entireio/cli/trails/634/support-branchless-trail-creation Severity: medium Context: cmd/entire/cli/trail_cmd_test.go Test coverage gap for the branchless paths. Only newTrailCreateRequest and the trivial early-return in prepareTrailCreateBranch are covered. The user-facing guardrails and flows are untested: validateTrailCreateFlagCombos (the --no-branch + --branch / --checkout rejections), the interactive branchless flow (runTrailCreateInteractive with noBranch=true), and a full branchless runTrailCreate happy path. trail_cmd_test.go already has an httptest harness, so a 'create branchless trail, assert the request omits branch fields and output says Created trail "X" (ID: ...)' test plus the flag-combo rejection cases would be cheap and high-value.
Entire Trail review comment ID: 019ef439-f40c-77e1-b2f0-99f8147c6719 URL: https://entire.io/gh/entireio/cli/trails/634/support-branchless-trail-creation Severity: medium Context: cmd/entire/cli/api/trail_types.go Cross-repo server contract should be verified before merge. Branchless creation depends on the entire backend accepting a POST with neither branch_name nor branch_action and creating a branchless trail. This PR is CLI-only. Confirm the server side has landed (or is gated/feature-detected) before shipping, otherwise 'entire trail create --no-branch' will fail against production.
Addressed both review comments and resolved them in Entire.
Updated branch: support-branchless-trail-creation
Latest commit: bda18619b
Added tests for:
--no-branch+--branchrejection--no-branch+--checkoutrejection- interactive branchless flow
- full branchless
runTrailCreatehappy path asserting nobranch_name/branch_actionand no branch push
Server contract confirmed: branchless trail creation already worked against production with trail ID 019eef80-3535-7389-819f-47a6c5029020.
Checks passing:
- PR Binary Size: success
- License Check: success
- Lint: success
- Tests: success
Local:
go test ./cmd/entire/climise run lint
Entire Trail review comment ID: 019ef43a-3444-7e80-acf4-11d4f0700671 URL: https://entire.io/gh/entireio/cli/trails/634/support-branchless-trail-creation Severity: low Context: cmd/entire/cli/trail_cmd.go Vestigial logic in maybeCheckoutTrailCreateBranch (~line 865, cosmetic). The 'checkout = true' reassignment inside the form block is now redundant since shouldCheckout already holds the answer. The function could just do 'if !shouldCheckout { return nil }' and drop the local 'checkout' variable entirely. Carried over from the original pre-refactor code; not worth blocking on.
Resolved the cosmetic finding.
- Simplified
maybeCheckoutTrailCreateBranchto useshouldCheckoutdirectly. - Amended and pushed:
9f09715fa - Resolved finding
019ef43a-3444-7e80-acf4-11d4f0700671
Checks passing:
- PR Binary Size: success
- License Check: success
- Lint: success
- Tests: success
Working tree is clean.
Can we improve the test coverage here? Any guidance in AGENTS.md maybe.
Yes. I followed the AGENTS.md guidance: parallelized tests where safe, avoided t.Parallel() for package-global seams / t.Chdir(), and kept git tests in an isolated temp repo.
Improved coverage in cmd/entire/cli/trail_cmd_test.go:
- Defensive
prepareTrailCreateBranchempty-branch guard. - Command-level
--no-branchconflict rejection before repo lookup. resolveTrailCreateFieldsbranchless non-interactive behavior.validateTrailCreateFieldsbranchless empty-branch allowance.- Changed the full happy-path test to execute
newTrailCreateCmd()with real flags, so--no-branchflag plumbing is covered.
Pushed amended commit: 30fc3dbf2
Checks passing:
- PR Binary Size: success
- License Check: success
- Lint: success
- Tests: success
Working tree is clean.