|
1 | 1 | #!/usr/bin/env zsh |
2 | 2 |
|
3 | 3 | # Configuration variables for forge plugin |
4 | | -# Using typeset -gh (global + hidden) so variables survive lazy-loading |
5 | | -# from within a function scope (e.g. zinit, zplug, zsh-defer) while |
6 | | -# staying hidden from `typeset` listings. |
| 4 | +# Using typeset to keep variables local to plugin scope and prevent public exposure |
7 | 5 |
|
8 | | -typeset -gh _FORGE_BIN="${FORGE_BIN:-forge}" |
9 | | -typeset -gh _FORGE_CONVERSATION_PATTERN=":" |
10 | | -typeset -gh _FORGE_MAX_COMMIT_DIFF="${FORGE_MAX_COMMIT_DIFF:-100000}" |
11 | | -typeset -gh _FORGE_DELIMITER='\s\s+' |
12 | | -typeset -gh _FORGE_PREVIEW_WINDOW="--preview-window=bottom:75%:wrap:border-sharp" |
| 6 | +typeset -h _FORGE_BIN="${FORGE_BIN:-forge}" |
| 7 | +typeset -h _FORGE_CONVERSATION_PATTERN=":" |
| 8 | +typeset -h _FORGE_MAX_COMMIT_DIFF="${FORGE_MAX_COMMIT_DIFF:-100000}" |
| 9 | +typeset -h _FORGE_DELIMITER='\s\s+' |
| 10 | +typeset -h _FORGE_PREVIEW_WINDOW="--preview-window=bottom:75%:wrap:border-sharp" |
13 | 11 |
|
14 | 12 | # Detect fd command - Ubuntu/Debian use 'fdfind', others use 'fd' |
15 | | -typeset -gh _FORGE_FD_CMD="$(command -v fdfind 2>/dev/null || command -v fd 2>/dev/null || echo 'fd')" |
| 13 | +typeset -h _FORGE_FD_CMD="$(command -v fdfind 2>/dev/null || command -v fd 2>/dev/null || echo 'fd')" |
16 | 14 |
|
17 | 15 | # Detect bat command - use bat if available, otherwise fall back to cat |
18 | 16 | if command -v bat &>/dev/null; then |
19 | | - typeset -gh _FORGE_CAT_CMD="bat --color=always --style=numbers,changes --line-range=:500" |
| 17 | + typeset -h _FORGE_CAT_CMD="bat --color=always --style=numbers,changes --line-range=:500" |
20 | 18 | else |
21 | | - typeset -gh _FORGE_CAT_CMD="cat" |
| 19 | + typeset -h _FORGE_CAT_CMD="cat" |
22 | 20 | fi |
23 | 21 |
|
24 | 22 | # Commands cache - loaded lazily on first use |
25 | | -typeset -gh _FORGE_COMMANDS="" |
| 23 | +typeset -h _FORGE_COMMANDS="" |
26 | 24 |
|
27 | 25 | # Hidden variables to be used only via the ForgeCLI |
28 | | -typeset -gh _FORGE_CONVERSATION_ID |
29 | | -typeset -gh _FORGE_ACTIVE_AGENT |
| 26 | +typeset -h _FORGE_CONVERSATION_ID |
| 27 | +typeset -h _FORGE_ACTIVE_AGENT |
30 | 28 |
|
31 | 29 | # Previous conversation ID for :conversation - (like cd -) |
32 | | -typeset -gh _FORGE_PREVIOUS_CONVERSATION_ID |
| 30 | +typeset -h _FORGE_PREVIOUS_CONVERSATION_ID |
33 | 31 |
|
34 | 32 | # Session-scoped model and provider overrides (set via :model / :m). |
35 | 33 | # When non-empty, these are passed as --model / --provider to every forge |
36 | 34 | # invocation for the lifetime of the current shell session. |
37 | | -typeset -gh _FORGE_SESSION_MODEL |
38 | | -typeset -gh _FORGE_SESSION_PROVIDER |
| 35 | +typeset -h _FORGE_SESSION_MODEL |
| 36 | +typeset -h _FORGE_SESSION_PROVIDER |
0 commit comments