|
1 | 1 | #!/usr/bin/env zsh |
2 | 2 |
|
3 | 3 | # Configuration variables for forge plugin |
4 | | -# Using typeset to keep variables local to plugin scope and prevent public exposure |
| 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. |
5 | 7 |
|
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" |
| 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" |
11 | 13 |
|
12 | 14 | # Detect fd command - Ubuntu/Debian use 'fdfind', others use 'fd' |
13 | | -typeset -h _FORGE_FD_CMD="$(command -v fdfind 2>/dev/null || command -v fd 2>/dev/null || echo 'fd')" |
| 15 | +typeset -gh _FORGE_FD_CMD="$(command -v fdfind 2>/dev/null || command -v fd 2>/dev/null || echo 'fd')" |
14 | 16 |
|
15 | 17 | # Detect bat command - use bat if available, otherwise fall back to cat |
16 | 18 | if command -v bat &>/dev/null; then |
17 | | - typeset -h _FORGE_CAT_CMD="bat --color=always --style=numbers,changes --line-range=:500" |
| 19 | + typeset -gh _FORGE_CAT_CMD="bat --color=always --style=numbers,changes --line-range=:500" |
18 | 20 | else |
19 | | - typeset -h _FORGE_CAT_CMD="cat" |
| 21 | + typeset -gh _FORGE_CAT_CMD="cat" |
20 | 22 | fi |
21 | 23 |
|
22 | 24 | # Commands cache - loaded lazily on first use |
23 | | -typeset -h _FORGE_COMMANDS="" |
| 25 | +typeset -gh _FORGE_COMMANDS="" |
24 | 26 |
|
25 | 27 | # Hidden variables to be used only via the ForgeCLI |
26 | | -typeset -h _FORGE_CONVERSATION_ID |
27 | | -typeset -h _FORGE_ACTIVE_AGENT |
| 28 | +typeset -gh _FORGE_CONVERSATION_ID |
| 29 | +typeset -gh _FORGE_ACTIVE_AGENT |
28 | 30 |
|
29 | 31 | # Previous conversation ID for :conversation - (like cd -) |
30 | | -typeset -h _FORGE_PREVIOUS_CONVERSATION_ID |
| 32 | +typeset -gh _FORGE_PREVIOUS_CONVERSATION_ID |
31 | 33 |
|
32 | 34 | # Session-scoped model and provider overrides (set via :model / :m). |
33 | 35 | # When non-empty, these are passed as --model / --provider to every forge |
34 | 36 | # invocation for the lifetime of the current shell session. |
35 | | -typeset -h _FORGE_SESSION_MODEL |
36 | | -typeset -h _FORGE_SESSION_PROVIDER |
| 37 | +typeset -gh _FORGE_SESSION_MODEL |
| 38 | +typeset -gh _FORGE_SESSION_PROVIDER |
0 commit comments