Repository navigation
Expand file tree
/
Copy pathzsh-profiles.example
More file actions
67 lines (58 loc) · 2.09 KB
/
Copy pathzsh-profiles.example
File metadata and controls
67 lines (58 loc) · 2.09 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
# zsh-profiles.example
#
# Example only — copy the parts you want into your shell rc (~/.zshrc) and
# adjust names, paths, and providers. Live configs (providers, model IDs) stay
# personal; this file ships only the pattern.
#
# Pattern: every launch binds ONE config pair explicitly (server config via
# OPENCODE_CONFIG, TUI config via OPENCODE_TUI_CONFIG) so a stray shell export
# can never silently switch profiles.
_OC_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/opencode"
_OC_BIN="$(command -v opencode)"
# default: clean, no plugins
function opencode() {
OPENCODE_CONFIG="$_OC_DIR/opencode.json" \
OPENCODE_TUI_CONFIG="$_OC_DIR/tui.json" \
"$_OC_BIN" "$@"
}
function oc() { opencode "$@"; }
# OMOS orchestration profile
function oc-omo() {
OPENCODE_CONFIG="$_OC_DIR/opencode.omo.json" \
OPENCODE_TUI_CONFIG="$_OC_DIR/tui.omo.json" \
"$_OC_BIN" "$@"
}
# power-pack + superpowers profile
function oc-super() {
OPENCODE_CONFIG="$_OC_DIR/opencode.super.json" \
OPENCODE_TUI_CONFIG="$_OC_DIR/tui.super.json" \
"$_OC_BIN" "$@"
}
# minimal-plugin profile
function oc-vanilla() {
OPENCODE_CONFIG="$_OC_DIR/opencode.vanilla.json" \
OPENCODE_TUI_CONFIG="$_OC_DIR/tui.vanilla.json" \
"$_OC_BIN" "$@"
}
# --- oh-my-openagent preset switcher -------------------------------
# Saved presets live next to the opencode config as omo.jsonc.<tag>;
# use-omo-<tag> copies one into ~/.omo/omo.jsonc (where OMOS reads it).
# omo-current prints the active preset by diffing against the saved ones.
OMO_PRESET_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/opencode"
OMO_ACTIVE="$HOME/.omo/omo.jsonc"
OMO_TAGS=() # fill with your preset tags, e.g. (ds dso go-f go-lg jt)
function use-omo() {
local tag="$1"
[[ -f "$OMO_PRESET_DIR/omo.jsonc.$tag" ]] || { echo "no preset: $tag" >&2; return 1; }
cp "$OMO_PRESET_DIR/omo.jsonc.$tag" "$OMO_ACTIVE"
echo "omo -> $tag"
}
function omo-current() {
local tag
for tag in "${OMO_TAGS[@]}"; do
if diff -q "$OMO_ACTIVE" "$OMO_PRESET_DIR/omo.jsonc.$tag" >/dev/null 2>&1; then
echo "omo active: $tag"; return 0
fi
done
echo "omo active: (modified, no template match)"
}