Skip to content

Commit 3436e80

Browse files
committed
feat(pr): support Codeberg pull requests
- parse GitHub/Codeberg remotes into a shared HostedRepo with dynamic PR labels - show public Codeberg PR status and checks via the Forgejo API - add a jayjay-network crate (ureq) for blocking HTTP; drop the curl shell-out - share the PR check roll-up across hosts; host-agnostic PrState parsing - document the bookmark-based GitHub/Codeberg PR flow
1 parent 5c71f54 commit 3436e80

34 files changed

Lines changed: 1167 additions & 460 deletions

AGENTS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Keep this file as always-loaded guidance. Load focused docs only when the task t
1010
- [Testing Guide](agents/testing.md) - Rust/Swift/GPUI test placement, fixtures, UI test rules.
1111
- [Architecture Guide](agents/architecture.md) - MVVM boundaries, file layout, review state, presentation surfaces.
1212
- [Design Guide](agents/design.md) - JayJay product context, visual direction, interaction principles.
13+
- [Pull Request Workflow](agents/pull-requests.md) - bookmark-based GitHub and Codeberg PRs, review updates, landing.
1314

1415
When a change spans multiple areas, load each relevant doc before editing.
1516

@@ -89,12 +90,15 @@ jj describe -m "message"
8990
jj commit -m "message"
9091
jj squash
9192
jj split --paths FILE -m "msg"
93+
jj edit <rev>
9294
jj bookmark set <name> -r <rev>
9395
jj git fetch
94-
jj git push
96+
jj git push --bookmark <name>
9597
jj fix
9698
```
9799

100+
For PR work, load [Pull Request Workflow](agents/pull-requests.md). Use a pushed bookmark and JayJay's **Pull Request on GitHub** or **Pull Request on Codeberg** action.
101+
98102
Do not use `git commit`, `git add`, `git push`, `git stash`, `git branch`, or `git rebase -i`; use the jj equivalents.
99103

100104
## UI And Design

CONTRIBUTING.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ This project uses [Jujutsu](https://github.com/jj-vcs/jj) for version control, n
44

55
## Requirements
66

7-
| Dependency | Version |
8-
|------------|---------|
9-
| macOS | 15+ (Sequoia) |
10-
| Rust | 1.85+ |
11-
| Xcode | 16+ |
12-
| jj | latest |
13-
| just | latest |
14-
| xcodegen | latest |
15-
| xcbeautify | latest |
7+
| Dependency | Version | Notes |
8+
|------------|---------|-------|
9+
| macOS | 15+ (Sequoia) | |
10+
| Rust | 1.85+ | |
11+
| Xcode | 16+ | |
12+
| jj | latest | |
13+
| just | latest | |
14+
| xcodegen | latest | |
15+
| xcbeautify | latest | |
1616

1717
## Development loop
1818

@@ -27,6 +27,23 @@ just build # Build the macOS app
2727
just run # Build and run macOS app
2828
```
2929

30+
## Pull request workflow
31+
32+
Use [agents/pull-requests.md](agents/pull-requests.md) for GitHub and Codeberg PR workflows.
33+
34+
Optional tools:
35+
36+
| Tool | Needed for |
37+
|------|------------|
38+
| gh CLI | GitHub PR status, checks, and optional PR creation |
39+
| GitHub account | GitHub PR creation from pushed bookmarks |
40+
| Codeberg account | Codeberg PR creation from pushed bookmarks |
41+
42+
Summary:
43+
44+
- GitHub: push a jj bookmark, then use JayJay's **Pull Request on GitHub** action or `gh pr create`.
45+
- Codeberg: push a jj bookmark, then use JayJay's **Pull Request on Codeberg** action to open Codeberg's PR compose page.
46+
3047
## Testing
3148

3249
**Every new feature ships with both unit and UI test coverage.** Bug fixes add the regression test that would have caught them.

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace]
2-
members = ["crates/jj-diff", "crates/jj-test", "crates/jayjay-core", "crates/jayjay-uniffi", "crates/jayjay-cli", "shell/gpui"]
2+
members = ["crates/jj-diff", "crates/jj-test", "crates/jayjay-network", "crates/jayjay-core", "crates/jayjay-uniffi", "crates/jayjay-cli", "shell/gpui"]
33
resolver = "2"
44

55
[workspace.package]
@@ -11,6 +11,9 @@ repository = "https://github.com/hewigovens/jayjay"
1111
[workspace.dependencies]
1212
jj-lib = "0.42.0"
1313
gix = { version = "0.84.0", default-features = false }
14+
gix-url = "0.36.1"
15+
percent-encoding = "2.3.2"
16+
ureq = "3"
1417
uniffi = "0.31"
1518
clap = { version = "4", features = ["derive"] }
1619
thiserror = "2"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Browse your DAG, review side-by-side diffs, resolve conflicts, and run every jj
4848
- Absorb hunks into ancestors, back out (revert) changes
4949
- Git push/fetch with auto-track
5050
- Bookmark Manager (⌘⇧B) with stats, filter, clean up stale branches, resolve conflicts
51-
- Pull Request on GitHub from bookmark right-click (DAG row + Bookmark Manager) — opens the existing PR if one exists, else GitHub's compose URL
51+
- Pull Request on GitHub/Codeberg from bookmark right-click (DAG row + Bookmark Manager) — opens an existing PR when one exists, else a GitHub or Codeberg PR compose URL; public Codeberg PR status is shown via the Forgejo API
5252
- Divergent commit detection and resolution
5353
- Undo via operation log
5454
- Command palette (⌘⇧P) with ~35 commands; type `jj <args>` (or `! <args>`) for inline raw jj CLI output

UserGuide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ This guide covers JayJay's user-facing features. The released macOS app uses the
6969
- Use Undo to inspect the jj operation log and roll back recent operations.
7070
- JayJay shows lightweight toasts for completed actions and keeps the rest of the window usable when possible.
7171

72-
## Bookmarks, Git, and GitHub
72+
## Bookmarks, Git, and Pull Requests
7373

7474
- Use the Bookmark Manager with `Cmd+Shift+B` to inspect bookmark stats, filter bookmarks, reveal their changes, copy names, diff them, resolve conflicts, and clean up stale entries.
7575
- Use bookmark actions to create, rename, track, move forward, delete, and push bookmarks.
7676
- Push and fetch Git remotes from JayJay; push can auto-track a bookmark when needed.
77-
- Right-click a bookmark in the DAG or Bookmark Manager to open a GitHub pull request.
78-
- If a PR already exists, JayJay opens it. Otherwise it opens GitHub's PR compose page for that bookmark.
79-
- The status bar can show the selected bookmark's PR link and check status via `gh`.
77+
- Right-click a bookmark in the DAG or Bookmark Manager to open a GitHub or Codeberg pull request.
78+
- If a GitHub PR or public Codeberg PR already exists, JayJay opens it. Otherwise it opens a GitHub or Codeberg PR compose page for that bookmark.
79+
- The status bar can show the selected bookmark's PR link and check status via `gh` for GitHub or Codeberg's public Forgejo API.
8080
- Remote repository URLs can be opened in the browser, including `git@...` URLs converted to HTTPS.
8181

8282
## Conflict Resolution

agents/pull-requests.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Pull Request Workflow
2+
3+
Load this file before creating, updating, landing, or documenting pull request workflows.
4+
5+
JayJay uses jj bookmarks for pull requests on both GitHub and Codeberg. This keeps the pushed commit identical to the signed jj change, avoids generated PR commits, and matches jj's normal edit-and-rewrite model.
6+
7+
GitHub PR status and checks use `gh`. Public Codeberg PR status and commit statuses use the unauthenticated Forgejo API; private Codeberg repositories are not integrated yet.
8+
9+
## Default Flow
10+
11+
Start from current trunk:
12+
13+
```bash
14+
jj git fetch
15+
jj new main@origin
16+
```
17+
18+
Keep edits in the working-copy change `@` until they are ready to publish:
19+
20+
```bash
21+
jj st
22+
jj diff
23+
jj describe -m "scope: concise change summary"
24+
```
25+
26+
Split by responsibility when the working copy contains more than one logical change:
27+
28+
```bash
29+
jj split --paths <paths-for-one-change> -m "scope: one logical change"
30+
```
31+
32+
Repeat `jj split` until each PR-sized change has one clear purpose. Do not split just to mirror file boundaries; split by behavior, bug fix, or user-visible feature.
33+
34+
Before publishing, format and run the checks that match the change:
35+
36+
```bash
37+
jj fix # run configured formatters (rustfmt, SwiftFormat) over the change
38+
just test
39+
just test-app
40+
just lint
41+
```
42+
43+
Publish the selected change by moving a bookmark to it and pushing that bookmark:
44+
45+
```bash
46+
jj bookmark set <topic> -r @
47+
jj git push --bookmark <topic>
48+
```
49+
50+
Then open the bookmark context menu in JayJay and choose **Pull Request on GitHub** or **Pull Request on Codeberg**. For GitHub, `gh pr create --draft --base main --head <topic>` is also fine when the browser flow is inconvenient.
51+
52+
Use `master@origin` or `trunk@origin` instead of `main@origin` when that is the repository's trunk bookmark.
53+
54+
## Review Updates
55+
56+
Handle review feedback by editing the same change and pushing the same bookmark again:
57+
58+
```bash
59+
jj git fetch
60+
jj edit <topic>
61+
62+
# edit files
63+
jj st
64+
jj diff
65+
jj describe -m "scope: updated summary"
66+
jj fix
67+
just test
68+
just lint
69+
70+
jj bookmark set <topic> -r @
71+
jj git push --bookmark <topic>
72+
```
73+
74+
The remote branch moves as part of normal jj history editing. `jj git push` applies jj's bookmark safety checks, so fetch first if the push reports that the remote bookmark changed.
75+
76+
## Multiple Changes
77+
78+
For independent PRs, use one bookmark per ready change:
79+
80+
```bash
81+
jj bookmark set <topic-a> -r <rev-a>
82+
jj bookmark set <topic-b> -r <rev-b>
83+
jj git push --bookmark <topic-a>
84+
jj git push --bookmark <topic-b>
85+
```
86+
87+
For stacked work, prefer separate bookmarks only when the stack is actually useful for review. Push the base change first, then the dependent change, and set the dependent PR's base branch to the base bookmark in the hosting UI.
88+
89+
## Landing Cleanup
90+
91+
After the PR lands:
92+
93+
```bash
94+
jj git fetch
95+
jj new main@origin
96+
```
97+
98+
If the hosting service deleted the remote branch, forget the local bookmark and its stale remote tracking state:
99+
100+
```bash
101+
jj bookmark forget <topic> --include-remotes
102+
```
103+
104+
If the hosting service did not delete the remote branch, delete it before forgetting it:
105+
106+
```bash
107+
jj bookmark delete <topic>
108+
jj git push --bookmark <topic>
109+
```
110+
111+
Keep the local reviewed change only when it is still useful for follow-up work; otherwise start new work from `main@origin`.

crates/jayjay-core/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ repository.workspace = true
1010
[dependencies]
1111
jj-lib = { workspace = true }
1212
gix = { workspace = true }
13+
gix-url = { workspace = true }
14+
percent-encoding = { workspace = true }
1315
jj-diff = { version = "0.1.0", path = "../jj-diff" }
16+
jayjay-network = { version = "0.1.0", path = "../jayjay-network" }
1417
thiserror = { workspace = true }
1518
pollster = { workspace = true }
1619
chrono = { workspace = true }

0 commit comments

Comments
 (0)