Add Branchless Trail Creation

Pi·GPT-5.5·Unknown author·3mo ago·24hr 21min·1 Checkpoint·15 file changes·+1084/-369·670K tokens

I can't create a trail without branch on the CLI right now?

3mo ago·6.8s

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!

3mo ago·5.0s

Implemented branchless trail creation.

Usage:

What changed:

  • Added --no-branch to entire trail create
  • Skips branch creation/fetch/push for branchless trails
  • Omits branch_name and branch_action from the create API request
  • Rejects invalid combos like --no-branch --branch ... and --no-branch --checkout

Tests passing:

Create a trail

3mo ago·8.3s

Created branchless trail:

Support branchless trail creation
ID: 019eef80-3535-7389-819f-47a6c5029020

Why branchless... create one with branch, commit the changes and push.

3mo ago

Or add one to the one you created...

3mo ago·7.5s

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.

3mo ago·6.8s

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/cli
  • mise 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.

3mo ago·9.3s

Addressed and resolved the review finding.

Changes:

  • Added explicit skip in prepareTrailCreateBranch for 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.

3mo ago·7.4s

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.

3mo ago·9.3s

Addressed both review comments and resolved them in Entire.

Updated branch: support-branchless-trail-creation
Latest commit: bda18619b

Added tests for:

  • --no-branch + --branch rejection
  • --no-branch + --checkout rejection
  • interactive branchless flow
  • full branchless runTrailCreate happy path asserting no branch_name / branch_action and 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/cli
  • mise 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.

3mo ago·10.0s

Resolved the cosmetic finding.

  • Simplified maybeCheckoutTrailCreateBranch to use shouldCheckout directly.
  • 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.

3mo ago·10.1s

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 prepareTrailCreateBranch empty-branch guard.
  • Command-level --no-branch conflict rejection before repo lookup.
  • resolveTrailCreateFields branchless non-interactive behavior.
  • validateTrailCreateFields branchless empty-branch allowance.
  • Changed the full happy-path test to execute newTrailCreateCmd() with real flags, so --no-branch flag plumbing is covered.

Pushed amended commit: 30fc3dbf2

Checks passing:

  • PR Binary Size: success
  • License Check: success
  • Lint: success
  • Tests: success

Working tree is clean.