@duheso/zerocli 0.7.6 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/zero +87 -66
- package/dist/cli.mjs +11875 -11404
- package/package.json +2 -1
package/bin/zero
CHANGED
|
@@ -1,66 +1,87 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
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
|
-
if
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Zero CLI — Shell wrapper for env var mapping and V8 heap configuration
|
|
4
|
+
#
|
|
5
|
+
# Maps COPILOT_PROVIDER_* / COPILOT_MODEL vars to the native OpenAI-shim
|
|
6
|
+
# vars, then boots the app.
|
|
7
|
+
#
|
|
8
|
+
# Internal (localhost):
|
|
9
|
+
# export COPILOT_PROVIDER_BASE_URL=http://localhost:3052/v1
|
|
10
|
+
# export COPILOT_PROVIDER_TYPE=openai
|
|
11
|
+
# export COPILOT_PROVIDER_API_KEY=not-required
|
|
12
|
+
# export COPILOT_MODEL=gemma4:code
|
|
13
|
+
# zero
|
|
14
|
+
#
|
|
15
|
+
# External (remote server):
|
|
16
|
+
# export COPILOT_PROVIDER_BASE_URL=http://10.11.36.131:3052/v1
|
|
17
|
+
# export COPILOT_PROVIDER_TYPE=openai
|
|
18
|
+
# export COPILOT_PROVIDER_API_KEY=not-required
|
|
19
|
+
# export COPILOT_MODEL=gemma4:code
|
|
20
|
+
# zero
|
|
21
|
+
|
|
22
|
+
# ── COPILOT_* → native env var mapping ──────────────────────────────────────
|
|
23
|
+
|
|
24
|
+
providerType="${COPILOT_PROVIDER_TYPE,,}"
|
|
25
|
+
|
|
26
|
+
if [[ "$providerType" == "openai" ]] && [[ -n "$COPILOT_PROVIDER_BASE_URL" ]]; then
|
|
27
|
+
export CLAUDE_CODE_USE_OPENAI=1
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
if [[ -n "$COPILOT_PROVIDER_BASE_URL" ]] && [[ -z "$OPENAI_BASE_URL" ]]; then
|
|
31
|
+
export OPENAI_BASE_URL="$COPILOT_PROVIDER_BASE_URL"
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
if [[ -n "$COPILOT_PROVIDER_API_KEY" ]] && [[ -z "$OPENAI_API_KEY" ]]; then
|
|
35
|
+
export OPENAI_API_KEY="$COPILOT_PROVIDER_API_KEY"
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
if [[ -n "$COPILOT_MODEL" ]] && [[ -z "$OPENAI_MODEL" ]]; then
|
|
39
|
+
export OPENAI_MODEL="$COPILOT_MODEL"
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# COPILOT_TOOLLESS=1 → disable tool calling (text-only mode).
|
|
43
|
+
if [[ -n "$COPILOT_TOOLLESS" ]] && [[ -z "$OPENAI_TOOLLESS" ]]; then
|
|
44
|
+
export OPENAI_TOOLLESS="$COPILOT_TOOLLESS"
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
# ── V8 heap configuration ────────────────────────────────────────────────────
|
|
48
|
+
#
|
|
49
|
+
# Prevent "JavaScript heap out of memory" crashes during long-running
|
|
50
|
+
# sessions (large context windows, agent waves, file editing). The default
|
|
51
|
+
# V8 heap limit (~4GB) is insufficient for the Zero CLI's context buildup.
|
|
52
|
+
#
|
|
53
|
+
# When running in CCR (remote containers), use 8GB. Otherwise, allocate
|
|
54
|
+
# 8GB on machines with enough RAM, falling back to 6GB as minimum.
|
|
55
|
+
|
|
56
|
+
if [[ "$CLAUDE_CODE_REMOTE" == "true" ]]; then
|
|
57
|
+
HEAP_SIZE=8192
|
|
58
|
+
else
|
|
59
|
+
totalMemMB=$(free -m 2>/dev/null | awk '/^Mem:/{print $2}')
|
|
60
|
+
if [[ -n "$totalMemMB" ]] && [[ "$totalMemMB" -gt 16384 ]]; then
|
|
61
|
+
HEAP_SIZE=8192
|
|
62
|
+
else
|
|
63
|
+
HEAP_SIZE=6144
|
|
64
|
+
fi
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
# Preserve existing NODE_OPTIONS (user may set --inspect, etc.)
|
|
68
|
+
if [[ -n "$NODE_OPTIONS" ]]; then
|
|
69
|
+
export NODE_OPTIONS="${NODE_OPTIONS} --max-old-space-size=${HEAP_SIZE}"
|
|
70
|
+
else
|
|
71
|
+
export NODE_OPTIONS="--max-old-space-size=${HEAP_SIZE}"
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
# ── Boot the compiled bundle ─────────────────────────────────────────────────
|
|
75
|
+
|
|
76
|
+
# Resolve through symlinks (npm link creates symlink chains)
|
|
77
|
+
RESOLVED="$(cd -P "$(dirname "$0")" && pwd)"
|
|
78
|
+
SCRIPT_DIR="$(dirname "$(realpath "$0")" 2>/dev/null || echo "$RESOLVED")"
|
|
79
|
+
DIST_PATH="${SCRIPT_DIR}/../dist/cli.mjs"
|
|
80
|
+
|
|
81
|
+
if [[ -f "$DIST_PATH" ]]; then
|
|
82
|
+
exec node "$DIST_PATH" "$@"
|
|
83
|
+
else
|
|
84
|
+
cat >&2 <<'USAGE'
|
|
64
85
|
zero: dist/cli.mjs not found.
|
|
65
86
|
|
|
66
87
|
Build first:
|
|
@@ -70,6 +91,6 @@ if (existsSync(distPath)) {
|
|
|
70
91
|
bun run dev
|
|
71
92
|
|
|
72
93
|
See README.md for setup instructions.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
94
|
+
USAGE
|
|
95
|
+
exit 1
|
|
96
|
+
fi
|