Skip to content

Feat: Repository Initialization in TUI#33

Merged
bakayu merged 4 commits intomasterfrom
feat/repo-initialization
Feb 6, 2026
Merged

Feat: Repository Initialization in TUI#33
bakayu merged 4 commits intomasterfrom
feat/repo-initialization

Conversation

@shatrughantwt
Copy link
Contributor

@shatrughantwt shatrughantwt commented Feb 4, 2026

Description:

Fixes: #32

Summary

Implemented repository initialization feature for gitx TUI.

What Changed

Added ability to initialize Git repositories directly from TUI interface.

Key Features

  • Press i in Status Panel to initialize
  • Interactive path input dialog
  • Command history tracking
  • Help system integration

Files Changed

  • internal/tui/keys.go
  • internal/tui/update.go
  • internal/tui/model.go
  • internal/tui/model_test.go

Testing

✅ All unit tests pass (15/15)
✅ Manual testing successful
✅ No breaking changes

How to Test

  1. Run: make run
  2. Press 1 for Status Panel
  3. Press i to initialize repo
  4. Enter path and press Enter

@shatrughantwt shatrughantwt requested a review from bakayu February 4, 2026 08:30
Copy link
Member

@bakayu bakayu left a comment

Choose a reason for hiding this comment

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

When I am running the command gitx, it just says this:

Image

Did you try running this feature from a directory without a git repository initialized?
Make sure to run Make install to install the binary to ~/go/bin/, also remove the gitx binary installed in /usr/loca/bin if you installed it via the install script while testing your own development version.

Also, your approach is not fully correct, we don't want the TUI to be opened without there being a git repository, and your approach requires the app to be opened to initialize a new git repository.
Suggested changes:
Maybe shift to a flag,

If no git repo exists and the user runs gitx, it gives an error message saying "error: not a git repository"
Extend this error message saying

error: not a git repository
run gitx -i/--init to initialize a new git repository and open gitx

And implement the respective flags, when provided they should initialize the git repository at the current directory.

If you have another approach in mind, let me know.

@shatrughantwt
Copy link
Contributor Author

That makes sense, thanks for the clarification.
I’ll update the behavior so gitx errors out when no repo exists and suggests using gitx -i/--init, and implement the flags to initialize the repo before opening the TUI.

To clarify, I didn’t use the install script.
I ran make install and it shows Binary available at ./build/gitx (as shown in the screenshot below).

Screenshot from 2026-02-04 17-14-40

@bakayu
Copy link
Member

bakayu commented Feb 4, 2026

To clarify, I didn’t use the install script. I ran make install and it shows Binary available at ./build/gitx (as shown in the screenshot below).

make install runs the build script first and then go install, so the binary is built and stored in ./build/gitx first and then it is installed in the ~/go/bin directory as well, which is usually loaded up in the environment allowing you to run the gitx tui from anywhere.
I was suggesting you this for convenience and ease of development.

@shatrughantwt
Copy link
Contributor Author

To clarify, I didn’t use the install script. I ran make install and it shows Binary available at ./build/gitx (as shown in the screenshot below).

make install runs the build script first and then go install, so the binary is built and stored in ./build/gitx first and then it is installed in the ~/go/bin directory as well, which is usually loaded up in the environment allowing you to run the gitx tui from anywhere. I was suggesting you this for convenience and ease of development.

Got it, thanks for explaining.
That makes sense — make install builds the binary and installs it to ~/go/bin, so it’s available globally. Appreciate the clarification!

@shatrughantwt
Copy link
Contributor Author

I’ve implemented the flag-based approach.

gitx now exits with an error when no git repository exists and suggests using
-i/--init, and gitx -i initializes a new git repository before launching the TUI.

I tested this by running the binary from /tmp and /tmp/testg (as shown in the screenshot).

Let me know if this behavior looks correct or if you’d like any changes.

Screenshot from 2026-02-04 19-39-45

@bakayu
Copy link
Member

bakayu commented Feb 5, 2026

@shatrughantwt the behavior looks good from the provided screenshots. But it looks like you have not pushed your code yet, please push your code to this branch so that I can review it.

@shatrughantwt
Copy link
Contributor Author

@bakayu, All Done

@shatrughantwt
Copy link
Contributor Author

done

Signed-off-by: Ayush <mail@ayuch.dev>
@bakayu bakayu merged commit ef31f52 into master Feb 6, 2026
2 checks passed
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.

Feat: Initialize a Git repository if none exists

2 participants