feat(trail): add --repo and --branch overrides for backend/GUI use · Entire

feat(trail): add --repo and --branch overrides for backend/GUI use

2876f99→main·

toothbrush·2w ago·6 files·+280 added/-21 removed

entire trail derived the repo from origin and the branch from the current checkout, so it only worked inside a clone of the target repo. Add:

Auth is unchanged: it already keys off the API base URL's .well-known/entire-api.json, independent of any local git repo.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Changes

6

41 unmodified lines

...

func newTrailCmd() *cobra.Command { var insecureHTTPAuth bool var repoOverride string

cmd := &cobra.Command{ Use: "trail", ... }

// Target an explicit repository instead of the origin remote, so the trail // commands can drive a repo the caller is not checked out in (e.g. a GUI // backend). Commands that mutate the local clone (create, checkout, finding // apply) reject it via ensureNoTrailRepoOverride. cmd.PersistentFlags().StringVar(&repoOverride, "repo", "Target repository as forge/owner/repo (e.g. gh/acme/app) or a clone URL; defaults to the origin remote")

cmd.AddCommand(newTrailShowCmd()) cmd.AddCommand(newTrailListCmd())

...


type trailListOptions struct {
    JSON         bool
    Limit        int
    InsecureHTTP bool
    Repo string
}

func defaultTrailListOptions(insecureHTTP bool) trailListOptions {
    ...
}

func newTrailShowCmd() *cobra.Command {
    var branch string
    cmd := &cobra.Command{
        Use:   "show [<trail>]",
        Short: "Show a trail",
        Long: `Show a trail.

If <trail> is omitted, shows the trail for the current branch. Otherwise,
<trail> may be a trail number, id, or branch in the current repo.`,
        ...
    }

cmd.Flags().StringVar(&branch, "branch", "", "Show the trail for this branch instead of the current branch; cannot be combined with a trail selector")

return cmd 
}

...

func checkTrailResponse(resp *http.Response) error { ... }