GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — cli/tools/use-local-bl.sh at main · modelstudioai/cli

Expand file tree

/

use-local-bl.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
83 lines (74 loc) · 3.09 KB
/

use-local-bl.sh

Copy path

File metadata and controls

83 lines (74 loc) · 3.09 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/usr/bin/env bash
# Enable this checkout's CLI in the current Bash/Zsh session:
# source /path/to/cli/tools/use-local-bl.sh
# Uses the installed workspace dependencies, including the linked local SDK.
# Disables background update checks and auto-install for the local CLI process.
if [ -n "${ZSH_VERSION:-}" ]; then
case "$ZSH_EVAL_CONTEXT" in
*:file) ;;
*)
printf '%s\n' '请用 source 执行 / Run with: source tools/use-local-bl.sh' >&2
exit 1
;;
esac
elif [ -n "${BASH_VERSION:-}" ]; then
if [ "${BASH_SOURCE[0]}" = "$0" ]; then
printf '%s\n' '请用 source 执行 / Run with: source tools/use-local-bl.sh' >&2
exit 1
fi
else
printf '%s\n' '请在 Bash 或 Zsh 中 source 此脚本 / Source this script in Bash or Zsh.' >&2
return 1 2>/dev/null || exit 1
fi
_bailian_use_local_bl() {
local script_path="$1"
local repo_root node_bin loader_path entry_path bin_dir launcher_path help_output
repo_root="$(cd -- "$(dirname -- "$script_path")/.." && pwd -P)" || return 1
node_bin="$(command -v node)" || {
printf '%s\n' '未找到 Node.js / Node.js is required.' >&2
return 1
}
loader_path="$repo_root/node_modules/tsx/dist/loader.mjs"
entry_path="$repo_root/packages/cli/src/main.ts"
bin_dir="$repo_root/.scratch/local-bl/bin"
launcher_path="$bin_dir/bl"
if [ ! -f "$loader_path" ] || [ ! -f "$entry_path" ]; then
printf '%s\n' '缺少源码或 tsx 依赖;请先在仓库安装依赖 / Missing source or tsx; install workspace dependencies first.' >&2
return 1
fi
# Help loads the command map and SDK exports without a business API request.
if ! help_output="$(DO_NOT_TRACK=1 "$node_bin" --import "$loader_path" "$entry_path" \
managed-agent memory-store memories update --help 2>&1)"; then
printf '%s\n' "$help_output" >&2
printf '%s\n' '本地 Memory 命令加载失败,请检查依赖及本地 SDK 链接 / Cannot load Memory commands; check dependencies and the local SDK link.' >&2
return 1
fi
mkdir -p -- "$bin_dir" || return 1
{
printf '%s\n' '#!/usr/bin/env bash' '# Generated by tools/use-local-bl.sh; preserves the caller working directory.'
printf '%s\n' 'export NO_UPDATE_NOTIFIER=1'
printf 'exec %q --import %q %q "$@"\n' "$node_bin" "$loader_path" "$entry_path"
} > "$launcher_path" || return 1
chmod +x "$launcher_path" || return 1
# Select local bl even when the shell previously defined an alias/function.
unalias bl 2>/dev/null || :
unset -f bl 2>/dev/null || :
case "$PATH" in
"$bin_dir"|"$bin_dir":*) ;;
*) export PATH="$bin_dir:$PATH" ;;
esac
hash -r 2>/dev/null || :
printf '当前终端已启用本地 bl / Local bl enabled for this terminal:\n %s\n' "$launcher_path"
printf '%s\n' '可以执行 / Try: bl managed-agent memory-store --help'
printf '%s\n' '新终端请重新 source 此脚本 / Source this script again in each new terminal.'
}
if [ -n "${ZSH_VERSION:-}" ]; then
_bailian_use_local_bl "${(%):-%x}"
else
_bailian_use_local_bl "${BASH_SOURCE[0]}"
fi
if [ "$?" -ne 0 ]; then
unset -f _bailian_use_local_bl
return 1
fi
unset -f _bailian_use_local_bl
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.