Replace jj with git, use lazygit in neovim
This commit is contained in:
@@ -1,8 +1,5 @@
|
|||||||
# AGENTS.md
|
# AGENTS.md
|
||||||
|
|
||||||
## ⚠️ VERSION CONTROL: JUJUTSU (jj) ONLY
|
|
||||||
**NEVER run git commands.** This repo uses Jujutsu (`jj`). Use `jj status`, `jj diff`, `jj commit`, etc.
|
|
||||||
|
|
||||||
## Build Commands
|
## Build Commands
|
||||||
|
|
||||||
### Local Development
|
### Local Development
|
||||||
|
|||||||
@@ -40,11 +40,6 @@
|
|||||||
url = "github:jnsahaj/lumen";
|
url = "github:jnsahaj/lumen";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
jj-ryu = {
|
|
||||||
url = "github:dmmulroy/jj-ryu";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
jj-starship.url = "github:dmmulroy/jj-starship";
|
|
||||||
nono = {
|
nono = {
|
||||||
url = "github:lukehinds/nono";
|
url = "github:lukehinds/nono";
|
||||||
flake = false;
|
flake = false;
|
||||||
|
|||||||
@@ -31,8 +31,6 @@
|
|||||||
../../profiles/ghostty.nix
|
../../profiles/ghostty.nix
|
||||||
../../profiles/git.nix
|
../../profiles/git.nix
|
||||||
../../profiles/home.nix
|
../../profiles/home.nix
|
||||||
../../profiles/jjui.nix
|
|
||||||
../../profiles/jujutsu.nix
|
|
||||||
../../profiles/lazygit.nix
|
../../profiles/lazygit.nix
|
||||||
../../profiles/lumen.nix
|
../../profiles/lumen.nix
|
||||||
../../profiles/mise.nix
|
../../profiles/mise.nix
|
||||||
|
|||||||
@@ -30,8 +30,6 @@
|
|||||||
../../profiles/ghostty.nix
|
../../profiles/ghostty.nix
|
||||||
../../profiles/git.nix
|
../../profiles/git.nix
|
||||||
../../profiles/home.nix
|
../../profiles/home.nix
|
||||||
../../profiles/jjui.nix
|
|
||||||
../../profiles/jujutsu.nix
|
|
||||||
../../profiles/lazygit.nix
|
../../profiles/lazygit.nix
|
||||||
../../profiles/lumen.nix
|
../../profiles/lumen.nix
|
||||||
../../profiles/mise.nix
|
../../profiles/mise.nix
|
||||||
|
|||||||
@@ -31,8 +31,6 @@
|
|||||||
../../profiles/fzf.nix
|
../../profiles/fzf.nix
|
||||||
../../profiles/git.nix
|
../../profiles/git.nix
|
||||||
../../profiles/home.nix
|
../../profiles/home.nix
|
||||||
../../profiles/jjui.nix
|
|
||||||
../../profiles/jujutsu.nix
|
|
||||||
../../profiles/lazygit.nix
|
../../profiles/lazygit.nix
|
||||||
../../profiles/lumen.nix
|
../../profiles/lumen.nix
|
||||||
../../profiles/mise.nix
|
../../profiles/mise.nix
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
{inputs}: final: prev: {
|
|
||||||
jj-ryu =
|
|
||||||
import ../lib/build-rust-package.nix {
|
|
||||||
inherit prev;
|
|
||||||
input = inputs.jj-ryu;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{inputs}: inputs.jj-starship.overlays.default
|
|
||||||
@@ -36,44 +36,44 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
on-window-detected = [
|
on-window-detected = [
|
||||||
{
|
{
|
||||||
"if" = {
|
"if" = {
|
||||||
"app-id" = "com.apple.systempreferences";
|
"app-id" = "com.apple.systempreferences";
|
||||||
};
|
};
|
||||||
run = "layout floating";
|
run = "layout floating";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
"if" = {
|
"if" = {
|
||||||
"app-id" = "com.mitchellh.ghostty";
|
"app-id" = "com.mitchellh.ghostty";
|
||||||
};
|
};
|
||||||
run = ["layout tiling" "move-node-to-workspace 3"];
|
run = ["layout tiling" "move-node-to-workspace 3"];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
"if" = {
|
"if" = {
|
||||||
"app-id" = "net.imput.helium";
|
"app-id" = "net.imput.helium";
|
||||||
};
|
};
|
||||||
run = "move-node-to-workspace 2";
|
run = "move-node-to-workspace 2";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
"if" = {
|
"if" = {
|
||||||
"app-id" = "com.tinyspeck.slackmacgap";
|
"app-id" = "com.tinyspeck.slackmacgap";
|
||||||
};
|
};
|
||||||
run = "move-node-to-workspace 5";
|
run = "move-node-to-workspace 5";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
"if" = {
|
"if" = {
|
||||||
"app-id" = "net.whatsapp.WhatsApp";
|
"app-id" = "net.whatsapp.WhatsApp";
|
||||||
};
|
};
|
||||||
run = "move-node-to-workspace 5";
|
run = "move-node-to-workspace 5";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
"if" = {
|
"if" = {
|
||||||
"app-id" = "com.tidal.desktop";
|
"app-id" = "com.tidal.desktop";
|
||||||
};
|
};
|
||||||
run = "move-node-to-workspace 6";
|
run = "move-node-to-workspace 6";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
mode = {
|
mode = {
|
||||||
main.binding = {
|
main.binding = {
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
programs.jjui = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
{
|
|
||||||
programs.jujutsu = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
user = {
|
|
||||||
name = "Christoph Schmatzler";
|
|
||||||
email = "christoph@schmatzler.com";
|
|
||||||
};
|
|
||||||
git = {
|
|
||||||
sign-on-push = true;
|
|
||||||
subprocess = true;
|
|
||||||
write-change-id-header = true;
|
|
||||||
private-commits = "description(glob:'wip:*') | description(glob:'WIP:*') | description(exact:'')";
|
|
||||||
};
|
|
||||||
fsmonitor = {
|
|
||||||
backend = "watchman";
|
|
||||||
};
|
|
||||||
ui = {
|
|
||||||
default-command = "status";
|
|
||||||
diff-formatter = ":git";
|
|
||||||
pager = ["delta" "--pager" "less -FRX"];
|
|
||||||
diff-editor = ["nvim" "-c" "DiffEditor $left $right $output"];
|
|
||||||
movement = {
|
|
||||||
edit = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
aliases = {
|
|
||||||
n = ["new"];
|
|
||||||
tug = ["bookmark" "move" "--from" "closest_bookmark(@-)" "--to" "@-"];
|
|
||||||
stack = ["log" "-r" "stack()"];
|
|
||||||
retrunk = ["rebase" "-d" "trunk()"];
|
|
||||||
bm = ["bookmark"];
|
|
||||||
gf = ["git" "fetch"];
|
|
||||||
gp = ["git" "push"];
|
|
||||||
};
|
|
||||||
revset-aliases = {
|
|
||||||
"closest_bookmark(to)" = "heads(::to & bookmarks())";
|
|
||||||
"closest_pushable(to)" = "heads(::to & mutable() & ~description(exact:\"\") & (~empty() | merges()))";
|
|
||||||
"mine()" = "author(\"christoph@schmatzler.com\")";
|
|
||||||
"wip()" = "mine() ~ immutable()";
|
|
||||||
"open()" = "mine() ~ ::trunk()";
|
|
||||||
"current()" = "@:: & mutable()";
|
|
||||||
"stack()" = "reachable(@, mutable())";
|
|
||||||
};
|
|
||||||
templates = {
|
|
||||||
draft_commit_description = ''
|
|
||||||
concat(
|
|
||||||
coalesce(description, default_commit_description, "\n"),
|
|
||||||
surround(
|
|
||||||
"\nJJ: This commit contains the following changes:\n", "",
|
|
||||||
indent("JJ: ", diff.stat(72)),
|
|
||||||
),
|
|
||||||
"\nJJ: ignore-rest\n",
|
|
||||||
diff.git(),
|
|
||||||
)
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
./plugins/grug-far.nix
|
./plugins/grug-far.nix
|
||||||
./plugins/harpoon.nix
|
./plugins/harpoon.nix
|
||||||
./plugins/hunk.nix
|
./plugins/hunk.nix
|
||||||
./plugins/jj-diffconflicts.nix
|
|
||||||
./plugins/lsp.nix
|
./plugins/lsp.nix
|
||||||
./plugins/mini.nix
|
./plugins/mini.nix
|
||||||
./plugins/oil.nix
|
./plugins/oil.nix
|
||||||
|
|||||||
@@ -118,21 +118,15 @@
|
|||||||
options.desc = "Visit paths (cwd)";
|
options.desc = "Visit paths (cwd)";
|
||||||
}
|
}
|
||||||
# g - git
|
# g - git
|
||||||
{
|
|
||||||
mode = "n";
|
|
||||||
key = "<leader>gc";
|
|
||||||
action = ":JJDiffConflicts<CR>";
|
|
||||||
options.desc = "Resolve conflicts";
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
mode = "n";
|
mode = "n";
|
||||||
key = "<leader>gg";
|
key = "<leader>gg";
|
||||||
action.__raw = ''
|
action.__raw = ''
|
||||||
function()
|
function()
|
||||||
require('toggleterm.terminal').Terminal:new({ cmd = 'jjui', direction = 'float' }):toggle()
|
require('toggleterm.terminal').Terminal:new({ cmd = 'lazygit', direction = 'float' }):toggle()
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
options.desc = "jjui";
|
options.desc = "lazygit";
|
||||||
}
|
}
|
||||||
# l - lsp/formatter
|
# l - lsp/formatter
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
{pkgs, ...}: {
|
|
||||||
programs.nixvim.extraPlugins = [
|
|
||||||
(pkgs.vimUtils.buildVimPlugin {
|
|
||||||
name = "jj-diffconflicts";
|
|
||||||
src =
|
|
||||||
pkgs.fetchFromGitHub {
|
|
||||||
owner = "rafikdraoui";
|
|
||||||
repo = "jj-diffconflicts";
|
|
||||||
rev = "main";
|
|
||||||
hash = "sha256-hvMXpslucywVYA9Sdxx6IcXQXYcYNWK8s9jr+KtStdI=";
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
---
|
|
||||||
name: vcs-detect
|
|
||||||
description: Detect whether the current project uses jj (Jujutsu) or git for version control. Run this BEFORE any VCS command to use the correct tool.
|
|
||||||
---
|
|
||||||
|
|
||||||
# VCS Detection Skill
|
|
||||||
|
|
||||||
Detect the version control system in use before running any VCS commands.
|
|
||||||
|
|
||||||
## Why This Matters
|
|
||||||
|
|
||||||
- jj (Jujutsu) and git have different CLIs and workflows
|
|
||||||
- Running `git` commands in a jj repo (or vice versa) causes errors
|
|
||||||
- Some repos use jj with git colocated (both `.jj/` and `.git/` exist)
|
|
||||||
|
|
||||||
## Detection Logic
|
|
||||||
|
|
||||||
Both `jj root` and `git rev-parse --show-toplevel` walk up the filesystem to find repo root.
|
|
||||||
|
|
||||||
**Priority order:**
|
|
||||||
|
|
||||||
1. `jj root` succeeds → jj (handles colocated too)
|
|
||||||
2. `git rev-parse` succeeds → git
|
|
||||||
3. Both fail → no VCS
|
|
||||||
|
|
||||||
## Detection Command
|
|
||||||
|
|
||||||
```bash
|
|
||||||
if jj root &>/dev/null; then echo "jj"
|
|
||||||
elif git rev-parse --show-toplevel &>/dev/null; then echo "git"
|
|
||||||
else echo "none"
|
|
||||||
fi
|
|
||||||
```
|
|
||||||
|
|
||||||
## Command Mappings
|
|
||||||
|
|
||||||
| Operation | git | jj |
|
|
||||||
|-----------|-----|-----|
|
|
||||||
| Status | `git status` | `jj status` |
|
|
||||||
| Log | `git log` | `jj log` |
|
|
||||||
| Diff | `git diff` | `jj diff` |
|
|
||||||
| Commit | `git commit` | `jj commit` / `jj describe` |
|
|
||||||
| Branch list | `git branch` | `jj branch list` |
|
|
||||||
| New branch | `git checkout -b <name>` | `jj branch create <name>` |
|
|
||||||
| Push | `git push` | `jj git push` |
|
|
||||||
| Pull/Fetch | `git pull` / `git fetch` | `jj git fetch` |
|
|
||||||
| Rebase | `git rebase` | `jj rebase` |
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
Before any VCS operation:
|
|
||||||
|
|
||||||
1. Run detection command
|
|
||||||
2. Use appropriate CLI based on result
|
|
||||||
3. If `none`, warn user directory is not version controlled
|
|
||||||
|
|
||||||
## Example Integration
|
|
||||||
|
|
||||||
```
|
|
||||||
User: Show me the git log
|
|
||||||
Agent: [Runs detection] -> Result: jj
|
|
||||||
Agent: [Runs `jj log` instead of `git log`]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Colocated Repos
|
|
||||||
|
|
||||||
When both `.jj/` and `.git/` exist, the repo is "colocated":
|
|
||||||
- jj manages the working copy
|
|
||||||
- git is available for compatibility (GitHub, etc.)
|
|
||||||
- **Always prefer jj commands** in colocated repos
|
|
||||||
@@ -27,8 +27,6 @@ with pkgs;
|
|||||||
hledger
|
hledger
|
||||||
htop
|
htop
|
||||||
hyperfine
|
hyperfine
|
||||||
jj-ryu
|
|
||||||
jj-starship
|
|
||||||
jq
|
jq
|
||||||
killall
|
killall
|
||||||
lsof
|
lsof
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
settings = {
|
settings = {
|
||||||
add_newline = true;
|
add_newline = true;
|
||||||
command_timeout = 2000;
|
command_timeout = 2000;
|
||||||
format = "[$directory$\{custom.scm}]($style)$character";
|
format = "$directory$git_branch$git_status$character";
|
||||||
character = {
|
character = {
|
||||||
error_symbol = "[✗ ](bold #e64553)";
|
error_symbol = "[✗ ](bold #e64553)";
|
||||||
success_symbol = "[❯](bold #40a02b)[❯](bold #df8e1d)[❯](bold #dc8a78)";
|
success_symbol = "[❯](bold #40a02b)[❯](bold #df8e1d)[❯](bold #dc8a78)";
|
||||||
@@ -16,10 +16,26 @@
|
|||||||
repo_root_style = "bold cyan";
|
repo_root_style = "bold cyan";
|
||||||
repo_root_format = "[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) ";
|
repo_root_format = "[$repo_root]($repo_root_style)[$path]($style)[$read_only]($read_only_style) ";
|
||||||
};
|
};
|
||||||
custom.scm = {
|
git_branch = {
|
||||||
when = "jj-starship detect";
|
format = "[$symbol$branch(:$remote_branch)]($style) ";
|
||||||
shell = ["jj-starship" "--strip-bookmark-prefix" "cschmatzler/" "--truncate-name" "20" "--bookmarks-display-limit" "1"];
|
symbol = " ";
|
||||||
format = "$output ";
|
style = "bold #8839ef";
|
||||||
|
truncation_length = 20;
|
||||||
|
truncation_symbol = "…";
|
||||||
|
};
|
||||||
|
git_status = {
|
||||||
|
format = "([$all_status$ahead_behind]($style) )";
|
||||||
|
style = "bold #df8e1d";
|
||||||
|
conflicted = "=$count ";
|
||||||
|
ahead = "⇡$count ";
|
||||||
|
behind = "⇣$count ";
|
||||||
|
diverged = "⇡$ahead_count⇣$behind_count ";
|
||||||
|
untracked = "?$count ";
|
||||||
|
stashed = "\\$$count ";
|
||||||
|
modified = "!$count ";
|
||||||
|
staged = "+$count ";
|
||||||
|
renamed = "»$count ";
|
||||||
|
deleted = "✘$count ";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user