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:
- persistent
--repo forge/owner/repo(or a clone URL) on the trail root, honored by show/list/update/delete/watch/finding. Rejected on the local-clone commands (create, checkout, finding apply). --branchon show/watch/finding to select a trail by branch instead of the current checkout. update/delete already had--branch. Mutually exclusive with an explicit trail selector.
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
cmd/entire/cli
Mtrail_checkout_cmd_test.go+2/-2
- Mtrail_cmd.go+108/-12
- Atrail_repo_flag_test.go+151
- Mtrail_review_cmd.go+16/-6
- Mtrail_review_cmd_test.go+1/-1
- Mtrail_watch_cmd.go+14/-9
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 [