@quantiya/codevibe-antigravity-plugin 2.0.6 → 2.0.8
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/.env.example +7 -6
- package/README.md +18 -22
- package/dist/server.js +700 -48
- package/{bin/codevibe-agy → libexec/companion-launcher} +51 -56
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
#
|
|
3
|
-
#
|
|
3
|
+
# Private CodeVibe Companion launcher for Antigravity CLI (agy), using a tmux
|
|
4
4
|
# session bridged to the CodeVibe MCP server for mobile sync.
|
|
5
5
|
#
|
|
6
6
|
# Architecture (DESIGN.md §3 + §5.2):
|
|
@@ -34,19 +34,15 @@
|
|
|
34
34
|
# server's signal handler), kill MCP server, remove runtime dir.
|
|
35
35
|
#
|
|
36
36
|
# Usage:
|
|
37
|
-
# codevibe
|
|
38
|
-
# codevibe-agy login # Sign in via browser
|
|
39
|
-
# codevibe-agy logout # Sign out
|
|
40
|
-
# codevibe-agy status # Show auth status
|
|
41
|
-
# codevibe-agy reset-device # Reset device key (re-pair)
|
|
37
|
+
# codevibe --agent agy [-- agy-args...]
|
|
42
38
|
#
|
|
43
39
|
# Environment:
|
|
44
40
|
# ENVIRONMENT Set to 'production' (default) or 'development'
|
|
45
41
|
# AGY_PATH Path to agy binary (default: $(command -v agy))
|
|
46
42
|
#
|
|
47
|
-
#
|
|
43
|
+
# Companion limitations:
|
|
48
44
|
# - Requires tmux. Print mode (`--print` / `-p`) is NOT supported.
|
|
49
|
-
# - Requires Node.js
|
|
45
|
+
# - Requires Node.js 22 or newer for the MCP server.
|
|
50
46
|
#
|
|
51
47
|
|
|
52
48
|
set -e
|
|
@@ -62,14 +58,6 @@ case "${ENVIRONMENT:-}" in
|
|
|
62
58
|
esac
|
|
63
59
|
CODEVIBE_TMPDIR="${TMPDIR:-/tmp}"
|
|
64
60
|
|
|
65
|
-
# ─── Config dir (agent-detection marker) ──────────────────────────────
|
|
66
|
-
# Ensure ~/.codevibe-antigravity exists on EVERY invocation (including the
|
|
67
|
-
# fast `--version` path and normal sessions). The CodeVibe 2.0 companion
|
|
68
|
-
# agent-detection probe marks agy "healthy" only when this dir exists
|
|
69
|
-
# (matching the claude/codex convention where the config dir signals
|
|
70
|
-
# "set up"). Non-fatal — a mkdir failure must never break the wrapper.
|
|
71
|
-
mkdir -p "$HOME/.codevibe-antigravity" 2>/dev/null || true
|
|
72
|
-
|
|
73
61
|
# Resolve plugin dir via symlink-aware traversal (npm globals symlink
|
|
74
62
|
# bin/ into /usr/local/bin/).
|
|
75
63
|
SOURCE="${BASH_SOURCE[0]}"
|
|
@@ -84,8 +72,8 @@ PLUGIN_DIR="$(dirname "$SCRIPT_DIR")"
|
|
|
84
72
|
# ─── PATH augmentation ───────────────────────────────────────────────
|
|
85
73
|
# When the install one-liner runs in a fresh terminal, Homebrew's
|
|
86
74
|
# installer writes the shellenv eval into ~/.zprofile (etc.) but the
|
|
87
|
-
# user's current shell hasn't sourced it yet.
|
|
88
|
-
#
|
|
75
|
+
# user's current shell hasn't sourced it yet. CodeVibe Companion launches
|
|
76
|
+
# in that terminal then fail tmux/node/agy discovery because
|
|
89
77
|
# /opt/homebrew/bin isn't on PATH. Prepend common locations so the
|
|
90
78
|
# wrapper recovers without forcing a new terminal.
|
|
91
79
|
_CV_NEW_PATHS=""
|
|
@@ -145,38 +133,45 @@ cv_failed() {
|
|
|
145
133
|
cv_telem "wrapper_failed" "\"reason\":\"$1\",\"lifetime_seconds\":$(( $(date +%s) - _CV_STARTED_AT ))"
|
|
146
134
|
}
|
|
147
135
|
|
|
148
|
-
#
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
136
|
+
# AGY_PATH is an optional preferred executable, not a poison pill. If it is
|
|
137
|
+
# unset or invalid, fall back to the same PATH lookup used by agent discovery.
|
|
138
|
+
# Requiring a regular executable file keeps this contract aligned with
|
|
139
|
+
# codevibe-core's isExecutableFile() check.
|
|
140
|
+
resolve_agy_bin() {
|
|
141
|
+
if [ -n "${AGY_PATH:-}" ] && [ -f "$AGY_PATH" ] && [ -x "$AGY_PATH" ]; then
|
|
142
|
+
printf '%s\n' "$AGY_PATH"
|
|
143
|
+
return 0
|
|
144
|
+
fi
|
|
145
|
+
command -v agy 2>/dev/null || true
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
# ─── Internal diagnostic: short-circuit before heavy boot ─────────────
|
|
149
|
+
# Keep this off the public argv surface so `codevibe --agent agy -- --version`
|
|
150
|
+
# reaches the vendor CLI unchanged.
|
|
151
|
+
if [ "${CODEVIBE_COMPANION_DIAGNOSTIC:-}" = "version" ]; then
|
|
152
|
+
_CV_VER="$(node -p "require('$PLUGIN_DIR/package.json').version" 2>/dev/null || echo unknown)"
|
|
153
|
+
echo "codevibe companion agy $_CV_VER"
|
|
154
|
+
_CV_AGY_BIN="$(resolve_agy_bin)"
|
|
155
|
+
if [ -n "$_CV_AGY_BIN" ] && [ -f "$_CV_AGY_BIN" ] && [ -x "$_CV_AGY_BIN" ]; then
|
|
156
|
+
_CV_AGY_RAW="$("$_CV_AGY_BIN" --version 2>/dev/null | head -1)"
|
|
157
|
+
[ -n "$_CV_AGY_RAW" ] && echo "agy $_CV_AGY_RAW"
|
|
158
|
+
fi
|
|
159
|
+
exit 0
|
|
160
|
+
fi
|
|
161
|
+
|
|
162
|
+
# Metadata commands are intentionally short-lived and do not create a
|
|
163
|
+
# Companion session. Run them directly in the foreground so a TTY invocation
|
|
164
|
+
# cannot race a detached tmux session that exits before attach. Arguments and
|
|
165
|
+
# the vendor exit status are preserved exactly.
|
|
166
|
+
case "${1:-}" in
|
|
167
|
+
--version|-v|--help|-h)
|
|
168
|
+
_CV_DIRECT_AGY_BIN="$(resolve_agy_bin)"
|
|
169
|
+
if [ -z "$_CV_DIRECT_AGY_BIN" ] || ! [ -f "$_CV_DIRECT_AGY_BIN" ] || ! [ -x "$_CV_DIRECT_AGY_BIN" ]; then
|
|
170
|
+
echo "Error: Antigravity CLI (`agy`) is not installed or not executable." >&2
|
|
171
|
+
echo "Install instructions: https://antigravity.google/docs" >&2
|
|
172
|
+
exit 127
|
|
179
173
|
fi
|
|
174
|
+
exec "$_CV_DIRECT_AGY_BIN" "$@"
|
|
180
175
|
;;
|
|
181
176
|
esac
|
|
182
177
|
|
|
@@ -187,7 +182,7 @@ command -v node >/dev/null 2>&1 && _CV_NODE_VER="$(node -v 2>/dev/null | cv_sani
|
|
|
187
182
|
_CV_TMUX_VER="missing"
|
|
188
183
|
command -v tmux >/dev/null 2>&1 && _CV_TMUX_VER="$(tmux -V 2>/dev/null | cv_sanitize)"
|
|
189
184
|
[ -z "$_CV_TMUX_VER" ] && _CV_TMUX_VER="unknown"
|
|
190
|
-
_CV_AGY_BIN="$
|
|
185
|
+
_CV_AGY_BIN="$(resolve_agy_bin)"
|
|
191
186
|
_CV_AGY_VER="missing"
|
|
192
187
|
[ -n "$_CV_AGY_BIN" ] && _CV_AGY_VER="$("$_CV_AGY_BIN" --version 2>/dev/null | cv_sanitize)"
|
|
193
188
|
[ -z "$_CV_AGY_VER" ] && _CV_AGY_VER="unknown"
|
|
@@ -213,7 +208,7 @@ log() {
|
|
|
213
208
|
for arg in "$@"; do
|
|
214
209
|
case "$arg" in
|
|
215
210
|
--print|-p|--prompt|--print=*|--prompt=*|-p=*)
|
|
216
|
-
echo "Error:
|
|
211
|
+
echo "Error: the Antigravity Companion route does not support --print / -p / --prompt."
|
|
217
212
|
echo "Run \"agy ...\" directly for non-interactive use; mobile sync is interactive-only."
|
|
218
213
|
cv_failed "print_mode_unsupported"
|
|
219
214
|
sleep 1
|
|
@@ -231,7 +226,7 @@ if ! command -v tmux &> /dev/null; then
|
|
|
231
226
|
exit 1
|
|
232
227
|
fi
|
|
233
228
|
|
|
234
|
-
if [ -z "$_CV_AGY_BIN" ] || ! [ -x "$_CV_AGY_BIN" ]; then
|
|
229
|
+
if [ -z "$_CV_AGY_BIN" ] || ! [ -f "$_CV_AGY_BIN" ] || ! [ -x "$_CV_AGY_BIN" ]; then
|
|
235
230
|
echo "Error: Antigravity CLI (\`agy\`) is not installed or not executable."
|
|
236
231
|
echo "Install instructions: https://antigravity.google/docs"
|
|
237
232
|
cv_failed "agy_missing"
|
|
@@ -241,7 +236,7 @@ fi
|
|
|
241
236
|
|
|
242
237
|
if ! command -v node &> /dev/null; then
|
|
243
238
|
echo "Error: Node.js is required but not installed."
|
|
244
|
-
echo "Install Node.js
|
|
239
|
+
echo "Install Node.js 22+ from: https://nodejs.org"
|
|
245
240
|
cv_failed "node_missing"
|
|
246
241
|
sleep 1
|
|
247
242
|
exit 1
|
|
@@ -459,8 +454,8 @@ while [ \$i -lt 100 ] && [ ! -f '$escaped_conn_file' ]; do
|
|
|
459
454
|
i=\$((i + 1))
|
|
460
455
|
done
|
|
461
456
|
if [ ! -f '$escaped_conn_file' ]; then
|
|
462
|
-
echo '
|
|
463
|
-
echo '
|
|
457
|
+
echo 'CodeVibe Antigravity Companion: MCP server not ready after 10s; running agy without mobile sync.' >&2
|
|
458
|
+
echo 'CodeVibe Antigravity Companion: see $escaped_mcp_log for details.' >&2
|
|
464
459
|
fi
|
|
465
460
|
export ENVIRONMENT='$ENVIRONMENT'
|
|
466
461
|
$AGY_CMD
|
|
@@ -517,7 +512,7 @@ if ! kill -0 "$MCP_PID" 2>/dev/null; then
|
|
|
517
512
|
tail -3 "$MCP_LOG_FILE" 2>/dev/null | grep -v '^\[' | head -3
|
|
518
513
|
echo ""
|
|
519
514
|
echo "Server failed to start. Check $MCP_LOG_FILE for details."
|
|
520
|
-
echo "Common causes: not signed in (\`codevibe
|
|
515
|
+
echo "Common causes: not signed in (\`codevibe login\`), port in use, ENV mismatch."
|
|
521
516
|
# tmux session is already created — destroy it so the user doesn't
|
|
522
517
|
# attach to a degraded session that will time-out waiting for conn.json.
|
|
523
518
|
tmux kill-session -t "$SESSION_NAME" 2>/dev/null || true
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quantiya/codevibe-antigravity-plugin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "Control Antigravity CLI from your iPhone and Android — real-time sync, approve file edits, send prompts by voice. Part of CodeVibe.",
|
|
5
5
|
"main": "dist/server.js",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"codevibe": {
|
|
7
|
+
"companionLauncher": "./libexec/companion-launcher"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/**/*.js",
|
|
11
|
-
"
|
|
11
|
+
"libexec",
|
|
12
12
|
"antigravity-plugin.json",
|
|
13
13
|
"README.md",
|
|
14
14
|
".env.example"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"node": ">=22.0.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@quantiya/codevibe-core": "2.0.
|
|
51
|
+
"@quantiya/codevibe-core": "2.0.8",
|
|
52
52
|
"chokidar": "^5.0.0",
|
|
53
53
|
"dotenv": "^16.6.1",
|
|
54
54
|
"express": "^5.1.0",
|