Skip to content

feat(vcs): add read-only jj repository support#31

Open
frittlechasm wants to merge 4 commits intomabd-dev:feat/jjSupportfrom
frittlechasm:feat/jjsupport
Open

feat(vcs): add read-only jj repository support#31
frittlechasm wants to merge 4 commits intomabd-dev:feat/jjSupportfrom
frittlechasm:feat/jjsupport

Conversation

@frittlechasm
Copy link
Copy Markdown
Contributor

Adds read-only support for scanning jj repositories alongside Git repositories.

Changes include:

  • Created a VCS abstraction so RepoScan can handle more than Git.
  • Added Git and jj providers under internal/vcs.
  • Detects jj repositories by .jj directories.
  • Scans jj repos without mutating them.
  • Reports jj repo metadata:
    • path
    • repo name
    • VCS type ( in JSON report )
    • bookmark/change display
    • uncommitted file summaries
    • outgoing tracked bookmark commits
  • Maps jj outgoing commit count into RemoteStatus.Ahead, so dirty and unpushed filters work for jj repos.
  • Shows jj outgoing commits in stdout/TUI details.
  • Handles missing jj binary with a warning instead of crashing.
  • Added test coverage for jj detection, provider routing, dirty jj repos, outgoing commits, and missing binary behavior.
  • go test ./... passes.

mabd-dev and others added 4 commits April 18, 2026 18:28
Skip rendering the remote name in parentheses when:
- There is only one remote and it is named "origin" (the common default)
- The remote name is empty (no remote configured)

Closes mabd-dev#20

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Introduce a VCS provider layer and generalize repo discovery so reposcan can detect and scan both git and jj repositories.
Copy link
Copy Markdown
Owner

@mabd-dev mabd-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the contribution. Overall the code look clean and well made

Comment thread internal/vcs/types.go
TypeJJ Type = "jj"
)

type RepoPath struct {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to RepoInfo or something similar that makes more sense

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense will get it done ..

Comment thread pkg/report/report.go
VCSType string `json:"vcsType"`
Branch string `json:"branch"`
UncommitedFiles []string `json:"uncommitedFiles"`
OutgoingCommits []string `json:"outgoingCommits"`
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this exists here? i don't like the idea that only support jj. same thing if we have a variable here that is only supported by git.
Maybe this struct can be remodeled to handle both jj and git repo. For now, it's this is fine. Will look into it later

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In jj, a commit is the unit of work so more than looking at uncommitted files , being able to see the number of outgoing commits makes more sense.

I can either remove OutgoingCommits entirely for now and use RemoteStatus.Ahead which should give us the count of number of commits which are ahead. OutgoingCommits would have actually shown what those commits are.
Another approach is to add GIT support for Outgoing Commits. This way there will be no variables that are vcs specific.

Let me know which approach you think is best here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might more sense to add OutgoingCommits to RemoteStatus instead of Repostate as conceptually it belongs near sync state.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making git support outgoing commits make sense. And yes, I do agree that OutgoingCommits should be in RemoteStatus not RepoState

Comment thread internal/vcs/git/git.go
}

func (p *Provider) CheckRepoState(path string) (report.RepoState, []string) {
state, warnings := gitx.CheckRepoState(path)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, should we move all gitx package files to vcs/git package?
I guess this is the right thing to do, since they will only be used in here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense I will move the gitx package files to internal/vcs/git ..
I will keep the internal/render/tui as is for now as we have no jj actions.
Let me know if that's okay.

If not I will create interfaces similar to internal/vcs/provider.go for the various actions.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, keep internal/render/tui as is for now

Include bool
}

func GetRepoStatesConcurrent(
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the git version not needed. Delete internal/gitx/gitxConcurrent.go

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done will delete it.

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.

Feature Request: Add Jujutsu (jj) repository support

3 participants