Repository navigation
Expand file tree
/
Copy pathdot_aliases
More file actions
130 lines (106 loc) · 3.14 KB
/
Copy pathdot_aliases
File metadata and controls
130 lines (106 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash
# General
alias v='$EDITOR'
alias cm="chezmoi"
# Dotfiles
alias dots="chezmoi edit --watch --apply"
# Listing files
if command -v eza >/dev/null 2>&1; then
alias ls="eza --icons --color=always --classify --git --group-directories-first --git-ignore"
alias l="ls --oneline"
alias ll="ls --long"
alias la="ll -a"
alias tree="ll --tree --level=3"
fi
alias tlr="taze latest --recursive"
alias tlri="taze latest --recursive --write --install"
alias nr="FORCE_COLORS=1 nr"
# Git
alias lg="lazygit"
alias gitroot="git rev-parse --show-toplevel"
alias cdr='cd $(gitroot)'
if command -v trash >/dev/null 2>&1; then
alias rm="trash"
fi
if command -v bat >/dev/null 2>&1; then
alias cat="bat"
fi
if command -v gping >/dev/null 2>&1; then
alias ping="gping"
fi
if command -v zed-preview >/dev/null 2>&1; then
alias zed="zed-preview"
fi
alias oc="opencode2"
function ocw() {
local host="${1:-opencode-worker-01.exe.xyz}"
local port="${OPENCODE_WORKER_PORT:-4096}"
local password
local tunnel_pid
local status
if ! command -v opencode >/dev/null 2>&1; then
echo "opencode is not installed locally" >&2
return 1
fi
password="$(ssh "${host}" '. ~/.config/opencode/server.env; printf %s "$OPENCODE_SERVER_PASSWORD"')" || return
ssh -N -L "${port}:127.0.0.1:4096" "${host}" &
tunnel_pid=$!
sleep 1
if ! kill -0 "${tunnel_pid}" 2>/dev/null; then
echo "failed to open SSH tunnel to ${host}" >&2
return 1
fi
opencode attach "http://127.0.0.1:${port}" --username opencode --password "${password}"
status=$?
kill "${tunnel_pid}" 2>/dev/null || true
wait "${tunnel_pid}" 2>/dev/null || true
return "${status}"
}
alias npx="nubx"
function ctxup() {
local ctx_dir="${HOME}/.ctx"
fd -HI -t d -d 2 --glob '.git' "${ctx_dir}" --format '{//}' | parallel --bar --tag '
cd {} &&
git fetch --all --prune &&
git reset --hard origin/$(git rev-parse --abbrev-ref origin/HEAD | sed "s|origin/||") &&
git clean -fd
' 2>&1
}
# Vercel skills CLI guard: never touch Claude.
# The CLI pre-selects claude-code, auto-detects it via ~/.claude, and always
# creates ./.claude/skills (createProjectSkillsDirByDefault), so force an
# explicit -a. Adjust the list to the agents you actually use.
SKILLS_DEFAULT_AGENTS=(amp opencode codex)
function skills() {
local cmd=${1:-}
case ${cmd} in
add | a | install | i | experimental_sync | experimental_install)
# `use --agent` means "launch this agent", so never touch `use`.
# Everything below means "install here".
# Refuse the footguns that always include Claude.
local arg has_agent=0
for arg in "$@"; do
if [[ ${arg} == --all || ${arg} == "*" ]]; then
echo "skills: refusing all-agent installs (would include claude-code)" >&2
return 1
fi
if [[ ${arg} == *claude-code* ]]; then
echo "skills: refusing claude-code (blocked)" >&2
return 1
fi
if [[ ${arg} == -a || ${arg} == --agent ]]; then
has_agent=1
fi
done
# Inject defaults only when the user did not pick agents.
if ((has_agent)); then
command nubx -y skills@latest "$@"
else
command nubx -y skills@latest "$@" -a "${SKILLS_DEFAULT_AGENTS[@]}"
fi
;;
*)
command nubx -y skills@latest "$@"
;;
esac
}