Skip to content

BBC2-19 add bb repo view#25

Open
b2l wants to merge 1 commit into
mainfrom
bbc2-19-repo-view
Open

BBC2-19 add bb repo view#25
b2l wants to merge 1 commit into
mainfrom
bbc2-19-repo-view

Conversation

@b2l
Copy link
Copy Markdown
Owner

@b2l b2l commented Apr 22, 2026

Summary

  • New bb repo view [workspace/repo] that fetches a single repository via GET /repositories/{workspace}/{repo_slug} and shows name, owner, visibility, default branch, primary language, creation/update timestamps, URL, and description.
  • Defaults to the auto-detected repo; a positional argument overrides. -R is also accepted for consistency. If both are passed, the positional wins — matches how gh repo view behaves.
  • Adds a new src/backend/repositories/ module with the Repository shape and RepositoryError class, mirroring the pullrequests backend pattern.
  • The generated `repository` schema nests optionals several layers deep; `toRepository` flattens to a surface the renderer can consume without guards.

Test plan

  • `bun test` — 160 tests pass (5 new backend tests: full mapping, owner fallback display_name → nickname → username, missing-fields defaults, 404, 403)
  • `bun run lint` clean
  • `bunx tsc --noEmit` clean
  • Manual: `bb repo view --help` shows correct help

Manual test path

  1. `bb repo view` on a checked-out Bitbucket repo → prints the current repo's metadata.
  2. `bb repo view some-workspace/some-repo` → prints that repo's metadata (ignoring the current checkout).
  3. `bb repo view -R some-workspace/some-repo` → same result via the flag form.
  4. `bb repo view some-ws/some-repo -R different-ws/different-repo` → positional wins; prints `some-ws/some-repo`.
  5. `bb repo view nonexistent-ws/nope` → clear 404 error, exit 1.
  6. `bb repo view private-inaccessible/repo` (one you don't have access to) → clear 403 error, exit 1.
  7. `bb --json repo view` → JSON object with all fields.
  8. Run outside a git repo without `-R` or positional → `Not inside a git repository` from resolveRepository.

Closes BBC2-19.

New `bb repo view [workspace/repo]` that fetches a single repository via
GET /repositories/{workspace}/{repo_slug} and shows name, owner,
visibility, default branch, primary language, creation/update timestamps,
URL, and description.

Defaults to the auto-detected repo; a positional argument overrides
(same semantics as -R). If both are passed, the positional wins — users
type `bb repo view some/repo` and expect it to act on `some/repo`
without learning which flag takes priority.

Adds a new src/backend/repositories/ module with the Repository shape
and RepositoryError class, mirroring the pullrequests backend pattern.
The generated `repository` schema nests optionals several layers deep;
toRepository flattens to a surface the renderer can consume without
optional-chain gymnastics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant