feat(trail): show the description and a browser URL in trail show#1476
feat(trail): show the description and a browser URL in trail show#1476khaong wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates entire trail show to enrich its output with a browser URL and a fuller “Description” pulled from the trail detail endpoint, aligning the CLI output with what the web UI shows.
Changes:
- Enrich
trail showoutput with a web URL and multi-line Description (best-effort detail fetch; warnings on failure). - Add a minimal detail fetch helper that decodes the nested
trail.body_document.text_snapshot. - Extend API types and add tests for URL construction, nested-body decoding, and output rendering.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
cmd/entire/cli/trail_cmd.go |
Adds best-effort detail fetch, web URL generation, and renders a Description block in trail show. |
cmd/entire/cli/trail_cmd_test.go |
Adds tests covering URL building, nested body_document decode, and updated show output formatting. |
cmd/entire/cli/api/trail_types.go |
Extends TrailResource with BodyDocument / TrailBodyDocument for detail decoding. |
cbffb34 to
2630d3e
Compare
|
bugbot run |
2630d3e to
1db9051
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
1 issue from previous review remains unresolved.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 1db9051. Configure here.
'entire trail show' now fetches the trail detail and renders the description (trail.body_document.text_snapshot, which the list endpoint omits) plus a browser URL (BaseURL/gh/<owner>/<repo>/trails/<number>; the web app is co-hosted with the data API). Adds trailWebURL and fetchTrailDetail, and a body_document field on TrailResource. Unit tests cover the URL builder and the nested-body decode (the field is under trail.body_document, not top-level). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1db9051 to
f68b176
Compare
|
The PR description says detail-fetch failure "degrades to 'no description'; falls back to On a detail-fetch failure, Since the old Suggested fix — seed from m := found.ToMetadata()
bodyText := found.Body // start from the list body
descriptionLoaded := found.Body != ""
if found.Number > 0 {
webURL = trailWebURL(...)
if bt, derr := fetchTrailDescription(...); derr == nil {
bodyText = bt // detail supersedes when it succeeds
descriptionLoaded = true
} else {
fmt.Fprintf(errW, "Warning: could not load trail description: %v\n", derr)
}
}This matches the PR description and improves both the failure and number-less paths. (If dropping the list body on failure is actually intended, the PR description should be corrected instead.) |

https://entire.io/gh/entireio/cli/trails/616
What
entire trail shownow renders the two things missing from it:trail.body_document.text_snapshot), which the list endpoint omits. This is the same content the web UI shows at the top of the trail page (the collaborative body editor).BaseURL()/gh/<owner>/<repo>/trails/<number>; the web app is co-hosted with the data API).Notes
body_documentis nested undertrailin the detail response (not top-level);fetchTrailDetaildecodes onlytrail+body_document, so it's unaffected by thecheckpoints/threadshapes. A regression test pins the nested path.found.Body).Testing
TestTrailWebURL(incl. trailing-slash dedup),TestFetchTrailDetail_ReadsNestedBodyDocument(httptest; nested-body path + ignores thecheckpointsarray),TestPrintTrailDetailsRendersURLAndDescription(URL + Description render; empty/whitespace omitted).entire trail show <n>now prints the Description + URL.gofmtclean;golangci-lint0 issues.Tracked by Entire trail #616.
🤖 Generated with Claude Code
Note
Low Risk
Read-only CLI display and an extra GET on
trail show; metadata still comes from list lookup and detail failures degrade gracefully.Overview
entire trail shownow prints a browser URL (from the API base + forge/owner/repo/trails/number) and the trail description from the detail API’strail.body_document.text_snapshot, which the list response does not include.After the usual list lookup, the command best-effort calls the per-number detail endpoint via new
fetchTrailDescription; failures warn on stderr but still show metadata and the URL. Descriptions use a Description block instead of inline Body; empty loaded descriptions show-- no description provided --. Trails without a number skip URL and description fetch.TrailResourcegains optionalBodyDocument/TrailBodyDocumenttypes for JSON decoding. Tests cover URL building, display helpers, nested body decode, and output formatting.Reviewed by Cursor Bugbot for commit 1db9051. Configure here.