Skip to content

Commit 18b54e4

Browse files
authored
Merge pull request #3 from ivanviragine/copilot/fix-antigravity-directory-issue
Fix Antigravity editor adapter to use dot pattern instead of full path
2 parents cf9f160 + 692de1e commit 18b54e4

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

lib/adapters.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
# flags — comma-separated modifiers (optional):
1515
# "workspace" — pass .code-workspace file instead of directory
1616
# "background" — launch with & (for terminal editors that fork)
17+
# "dot" — cd to directory and pass "." instead of full path
1718
#
1819
# Loading: file override (adapters/editor/<name>.sh) → registry → generic PATH fallback
1920
_EDITOR_REGISTRY="
20-
antigravity|agy|standard|Antigravity 'agy' command not found. Install from https://antigravity.google|workspace
21+
antigravity|agy|standard|Antigravity 'agy' command not found. Install from https://antigravity.google|workspace,dot
2122
atom|atom|standard|Atom not found. Install from https://atom.io|
2223
cursor|cursor|standard|Cursor not found. Install from https://cursor.com or enable the shell command.|workspace
2324
emacs|emacs|terminal|Emacs not found. Install from https://www.gnu.org/software/emacs/|background
@@ -86,13 +87,17 @@ _load_from_editor_registry() {
8687
_EDITOR_ERR_MSG="$err_msg"
8788
_EDITOR_WORKSPACE=0
8889
_EDITOR_BACKGROUND=0
90+
_EDITOR_DOT=0
8991

9092
case ",$flags," in
9193
*,workspace,*) _EDITOR_WORKSPACE=1 ;;
9294
esac
9395
case ",$flags," in
9496
*,background,*) _EDITOR_BACKGROUND=1 ;;
9597
esac
98+
case ",$flags," in
99+
*,dot,*) _EDITOR_DOT=1 ;;
100+
esac
96101

97102
case "$type" in
98103
terminal) _editor_define_terminal ;;
@@ -207,7 +212,7 @@ _ai_define_standard() {
207212
}
208213

209214
# Standard editor adapter builder — used by adapter files that follow the common pattern
210-
# Sets globals then call this: _EDITOR_CMD, _EDITOR_ERR_MSG, _EDITOR_WORKSPACE (optional, 0 or 1)
215+
# Sets globals then call this: _EDITOR_CMD, _EDITOR_ERR_MSG, _EDITOR_WORKSPACE (optional, 0 or 1), _EDITOR_DOT (optional, 0 or 1)
211216
_editor_define_standard() {
212217
# shellcheck disable=SC2317 # Functions are called indirectly via adapter dispatch
213218
editor_can_open() {
@@ -224,6 +229,8 @@ _editor_define_standard() {
224229
fi
225230
if [ "${_EDITOR_WORKSPACE:-0}" = "1" ] && [ -n "$workspace" ] && [ -f "$workspace" ]; then
226231
"$_EDITOR_CMD" "$workspace"
232+
elif [ "${_EDITOR_DOT:-0}" = "1" ]; then
233+
(cd "$path" && "$_EDITOR_CMD" .)
227234
else
228235
"$_EDITOR_CMD" "$path"
229236
fi

tests/adapters.bats

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ setup() {
9292
[ "$_EDITOR_BACKGROUND" -eq 1 ]
9393
}
9494

95+
@test "_load_from_editor_registry parses antigravity with workspace and dot flags" {
96+
local entry
97+
entry=$(_registry_lookup "$_EDITOR_REGISTRY" "antigravity")
98+
_load_from_editor_registry "$entry"
99+
[ "$_EDITOR_CMD" = "agy" ]
100+
[ "$_EDITOR_WORKSPACE" -eq 1 ]
101+
[ "$_EDITOR_DOT" -eq 1 ]
102+
}
103+
95104
# ── _load_from_ai_registry ──────────────────────────────────────────────────
96105

97106
@test "_load_from_ai_registry parses aider entry correctly" {

0 commit comments

Comments
 (0)