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

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

b75c0c3·

toothbrush·3w ago·6 files·+292 added/-30 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

Sessions

976ac978f60eView transcript

Changes

6

41 unmodified lines
    }
    for _, tc := range cases {
        t.Run(tc.name, func(t *testing.T) {
            found, err := resolveTrailBySelector(context.Background(), client, "gh", "acme", "repo", tc.selector)
            found, err := resolveTrailBySelector(context.Background(), client, "gh", "acme", "repo", tc.selector, "")
            if err != nil {
                t.Fatalf("resolveTrailBySelector: %v", err)
            }

defer srv.Close()

client := api.NewClientWithBaseURL("tok", srv.URL)
    found, err := resolveTrailBySelector(context.Background(), client, "gh", "acme", "repo", "does-not-exist")
    found, err := resolveTrailBySelector(context.Background(), client, "gh", "acme", "repo", "does-not-exist", "")
            if err == nil {
                t.Fatalf("expected error for missing trail, got found = %#v", found)
            }

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

cmd := &cobra.Command{ Use: "trail", Short: "Show or modify trails", }

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()) cmd.AddCommand(newTrailCreateCmd())

return cmd }

func newTrailShowCmd() *cobra.Command { var branch string cmd := &cobra.Command{ Use: "show []",