Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .cursor/rules/jujutsu-config.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ alwaysApply: true
4. template language: https://jj-vcs.github.io/jj/latest/templates/

请阅读本地对 jj 的配置 [jj.nix](mdc:nix/hm/jj.nix)

- Use option `--quiet` to suppress non-command output, like "Hint: some not wanted help hint text" string.
2 changes: 1 addition & 1 deletion conf/fish/funcs/_fzf-jj-bookmarks.fish
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function _fzf-jj-bookmarks --description "Search for jujutsu bookmarks"
jj root --quiet &>/dev/null; or return
set -f lines (jj bookmark list --color always | grep -v '^[[:space:]]' | fzf --tmux 98% --ansi --layout=reverse \
set -f lines (jj bookmark list --sort committer-date- --quiet --no-pager --color always | grep -v '^[[:space:]]' | grep -v '\(deleted\)' | fzf --tmux 98% --ansi --layout=reverse \
--scheme=path \
--preview='jj log --color=always -r "stack($(echo {} | cut -d: -f2 | awk "{print \$1}" | string trim))" --no-graph' \
--preview-label='Commit Details' \
Expand Down
2 changes: 1 addition & 1 deletion conf/fish/funcs/_fzf-jj-revs.fish
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

function _fzf-jj-revs --description "Search for jujutsu revision ids"
jj root --quiet &>/dev/null; or return
set -f lines (jj log --ignore-working-copy --no-graph --color always \
set -f lines (jj log --quiet --ignore-working-copy --no-graph --color always \
--revisions 'bookmarks(towry) | (ancestors(@) & author(towry) ~ empty())' \
--template 'author.timestamp().format("%F") ++ " " ++change_id.shortest(7) ++ " " ++ description.first_line() ++ " " ++ bookmarks ++ "\n"' \
| fzf --tmux 98% --ansi --layout=reverse --multi \
Expand Down
2 changes: 1 addition & 1 deletion conf/fish/funcs/jj-fork-master.fish
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function jj-fork-master --description "Fork master branch"
set -l date_now (date +%m%d)
set -l bookmark_name "$bookmark_name-$date_now"

jj log -r $bookmark_name -n 1 > /dev/null 2>&1
jj log --quiet -r $bookmark_name -n 1 > /dev/null 2>&1
if test $status -eq 0
echo "Bookmark name $bookmark_name is already used"
return 1
Expand Down
15 changes: 6 additions & 9 deletions conf/fish/funcs/jj-mega-up.fish
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,26 @@ function jj-mega-up --description "update mega-merge-heads"
set target_rev "m-m"
end
if test -z "$target_rev"
echo "缺少 <target-rev> 参数,且默认值 m-m 也为空"
echo "Missing <target-rev> parameter"
echo $help_string
return 1
end

# 取第一个非选项参数作为 from_rev
set -l from_rev $argv[1]
if not set -q from_rev || test -z "$from_rev"
echo "缺少 <from-rev> 参数"
echo "Missing <from-rev> parameter"
echo $help_string
return 1
end

# 查找 trunk()..$from_rev & parents($target_rev)
set -l found_revs (jj log -r "(trunk()..$from_rev) & parents($target_rev)" --no-graph --template 'change_id.shortest(7) ++ " \t" ++ description.first_line()' --no-pager)
set -l found_revs (jj log --quiet -r "(trunk()..$from_rev) & parents($target_rev) ~ $from_rev" --no-graph --template 'change_id.shortest(7) ++ " \t" ++ description.first_line()' --no-pager)
set -l found_count (count $found_revs)

if test $found_count -eq 0
echo "没有找到可用的父节点,更新 $target_rev 到 mega-merge heads 中"
echo "> jj-mega-merge -t $target_rev -f $from_rev"
# jj-mega-merge -t $target_rev -f $from_rev
echo "Parent node not found,update "(set_color yellow)$from_rev(set_color normal)" to mega-merge node ("(set_color yellow)$target_rev(set_color normal)") parents"
# echo "> jj-mega-merge -t $target_rev -f $from_rev"
jj-mega-merge -t $target_rev -f $from_rev
return 0
end

Expand All @@ -58,9 +57,7 @@ function jj-mega-up --description "update mega-merge-heads"
set pick_rev (string split " " $pick_line)[1]
end

echo ""
echo "To remove: "(set_color red)$pick_rev(set_color normal)
echo ""

# 先合并
# echo "jj-mega-merge -t $target_rev -f $from_rev"
Expand Down
9 changes: 6 additions & 3 deletions conf/tmux/bin/pane.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ source "$CURRENT_DIR/.envs"
current_pane_origin=$(tmux display-message -p '#S:#{window_index}.#{pane_index}: #{window_name}')
current_pane=$(tmux display-message -p '#S:#{window_index}.#{pane_index}')

# Define the default format string
DEFAULT_FORMAT="#S:#{window_index}.#{pane_index}: [#{window_name}:#{pane_title}] #{pane_current_command} [#{pane_width}x#{pane_height}] [history #{history_size}/#{history_limit}, #{history_bytes} bytes] #{?pane_active,[active],[inactive]}"

if [[ -z "$TMUX_FZF_PANE_FORMAT" ]]; then
panes=$(tmux list-panes -a -F "#S:#{window_index}.#{pane_index}: [#{window_name}:#{pane_title}] #{pane_current_command} [#{pane_width}x#{pane_height}] [history #{history_size}/#{history_limit}, #{history_bytes} bytes] #{?pane_active,[active],[inactive]}")
panes=$(tmux list-panes -a -F "$DEFAULT_FORMAT")
else
panes=$(tmux list-panes -a -F "#S:#{window_index}.#{pane_index}: $TMUX_FZF_PANE_FORMAT")
panes=$(tmux list-panes -a -F "$TMUX_FZF_PANE_FORMAT")
fi

FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --header='Select an action.'"
FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --header='Select an action.' --bind='ctrl-x:execute-silent(echo {} | sed \"s/: .*//\" | xargs -I{} tmux kill-pane -t {})+reload(tmux list-panes -a -F \"$DEFAULT_FORMAT\")'"
if [[ -z "$1" ]]; then
action=$(printf "switch\nbreak\njoin\nswap\nlayout\nkill\nresize\nrename\n[cancel]" | eval "$TMUX_FZF_BIN $TMUX_FZF_OPTIONS")
else
Expand Down
1 change: 1 addition & 0 deletions nix/hm/editor.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ let
in
{
home.packages = with pkgs; [
mcp-filesystem-server
## build neovim
ninja
gettext
Expand Down
1 change: 1 addition & 0 deletions nix/hm/frontend-dev.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
fnm
nodejs
pnpm
bun
# biome
nodePackages.prettier
nodePackages.eslint
Expand Down
27 changes: 27 additions & 0 deletions nix/hm/jj.nix
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,14 @@ in
"bookmark"
"list"
"--tracked"
"--sort"
"committer-date-"
];
bl = [
"bookmark"
"list"
"--sort"
"committer-date-"
];
lmaster = [
"log"
Expand Down Expand Up @@ -729,6 +733,29 @@ in
bold = true;
};
};
fix.tools = {
ncu-sandbox = {
command = [
"qx"
"ncu"
"sandbox"
];
patterns = [
"package.json"
];
enabled = false;
};
ncu-latest = {
command = [
"qx"
"ncu"
"latest"
];
patterns = [
"package.json"
];
};
};
};
};
home.file = {
Expand Down
2 changes: 1 addition & 1 deletion nix/hm/tmux.nix
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ in

# ===============================================
## UI
set -g pane-border-status off
set -g pane-border-status top
set -g status-interval 10
set -g status on
set -g status-left-length 100
Expand Down
4 changes: 2 additions & 2 deletions nix/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ let
nixd
# nix-health
# git-fuzzy
zig
zls
# zig
# zls
# vim-zellij-navigator
path-git-format
uclanr
Expand Down
10 changes: 10 additions & 0 deletions nix/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
pkgs = final;
system = final.system;
};
mcp-filesystem-server = final.callPackage ./pkgs/mcp-filesystem-server.nix {
version = "0.9.0";
pkgs = final;
system = final.system;
};
code-assistant = final.callPackage ./pkgs/code-assistant.nix {
version = "0.1.6";
pkgs = final;
system = final.system;
};
# git-fuzzy = final.callPackage ./pkgs/git-fuzzy.nix {};
uclanr = final.callPackage ./pkgs/uclanr.nix {
pkgs = final;
Expand Down
42 changes: 42 additions & 0 deletions nix/pkgs/code-assistant.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
version ? "0.1.6",
system,
pkgs ? (import <nixpkgs> { }),
}:
let
url-map = {
x86_64-darwin = "https://github.com/stippi/code-assistant/releases/download/v${version}/code-assistant-macos-x86_64.zip";
aarch64-darwin = "https://github.com/stippi/code-assistant/releases/download/v${version}/code-assistant-macos-aarch64.zip";
};
sha256-map = {
x86_64-darwin = "1ksh6zdi6v56pmv08w11vg3hry2bagm2dxh8a0lljvb9rm10j3dv";
aarch64-darwin = "0mn1hh5bsk5hgzpngnylp3nikwh8q807qar0iq96rms54bqh82ql";
};
zipfile = builtins.fetchurl {
url = url-map.${system};
sha256 = sha256-map.${system};
};
in
with pkgs;
stdenv.mkDerivation {
pname = "code-assistant";
version = version;
src = ./.;
unpackPhase = ''
unzip ${zipfile}
'';
installPhase = ''
mkdir -p $out/bin
mv code-assistant $out/bin/
chmod +x $out/bin/code-assistant
'';
nativeBuildInputs = [
makeWrapper
unzip
];
meta = {
homepage = "https://github.com/stippi/code-assistant";
description = "AI code assistant binary for macOS";
license = lib.licenses.mit;
};
}
39 changes: 39 additions & 0 deletions nix/pkgs/mcp-filesystem-server.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
version ? "0.9.0",
system,
pkgs ? (import <nixpkgs> { }),
}:
let
url-map = {
x86_64-darwin = "https://github.com/mark3labs/mcp-filesystem-server/releases/download/v${version}/mcp-filesystem-server_darwin_amd64.tar.gz";
aarch64-darwin = "https://github.com/mark3labs/mcp-filesystem-server/releases/download/v${version}/mcp-filesystem-server_darwin_arm64.tar.gz";
};
sha256-map = {
x86_64-darwin = "2a6bbbe300ad05d7d4bfc69dc9f22920325f3dc81cf6a07398e2c8ee30ef19a2";
aarch64-darwin = "97b4100952bbbb5d6c988651692515e225e0a38c319c74a5319ff3466c43cbbc";
};
tarball = builtins.fetchurl {
url = url-map.${system};
sha256 = sha256-map.${system};
};
in
with pkgs;
stdenv.mkDerivation {
pname = "mcp-filesystem-server";
version = version;
src = ./.;
nativeBuildInputs = [ makeWrapper ];
unpackPhase = ''
tar -xvzf ${tarball}
'';
installPhase = ''
mkdir -p $out/bin
mv mcp-filesystem-server $out/bin/
chmod +x $out/bin/mcp-filesystem-server
'';
meta = {
homepage = "https://github.com/mark3labs/mcp-filesystem-server";
description = "Filesystem server for MCP";
license = lib.licenses.mit;
};
}
Loading