Skip to content

Commit 0eb0c96

Browse files
fix: resolve Antigravity skill path mapping and UI scope bleeding (#64)
1 parent 7b29ffb commit 0eb0c96

2 files changed

Lines changed: 36 additions & 7 deletions

File tree

crates/hk-core/src/adapter/antigravity.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,28 @@ impl AgentAdapter for AntigravityAdapter {
6161
// ~/.agents/skills/ — cross-loading from Gemini CLI requires a manual
6262
// symlink per Google's own guidance.
6363
// Source: https://codelabs.developers.google.com/getting-started-with-antigravity-skills
64-
vec![self.base_dir().join("skills")]
64+
let mut dirs = vec![self.base_dir().join("skills")];
65+
66+
// Antigravity supports custom skill paths via skills.txt in its base directory.
67+
let skills_txt = self.base_dir().join("skills.txt");
68+
if let Ok(content) = std::fs::read_to_string(&skills_txt) {
69+
for line in content.lines() {
70+
let line = line.trim();
71+
if line.is_empty() {
72+
continue;
73+
}
74+
let path = if let Some(stripped) = line.strip_prefix("~/") {
75+
self.home.join(stripped)
76+
} else {
77+
PathBuf::from(line)
78+
};
79+
if !dirs.contains(&path) {
80+
dirs.push(path);
81+
}
82+
}
83+
}
84+
85+
dirs
6586
}
6687
fn project_skill_dirs(&self) -> Vec<String> {
6788
// Antigravity 1.18.4+ migrated from `.agent/` (singular) to `.agents/`

src/pages/marketplace.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,17 @@ export default function MarketplacePage() {
258258
agentName: string,
259259
activeScope: ScopeValue,
260260
) => {
261-
const key = `${item.id}:${agentName}`;
262-
if (installed.has(key)) return true;
263-
264261
const targetKey =
265262
activeScope.type === "all" ? null : scopeKey(activeScope as ConfigScope);
266263

264+
if (targetKey !== null) {
265+
if (installed.has(`${item.id}:${agentName}:${targetKey}`)) return true;
266+
} else {
267+
for (const k of installed) {
268+
if (k.startsWith(`${item.id}:${agentName}:`)) return true;
269+
}
270+
}
271+
267272
return extensions.some((ext) => {
268273
if (!ext.agents.includes(agentName)) return false;
269274

@@ -279,15 +284,17 @@ export default function MarketplacePage() {
279284
ext.source.url;
280285
let extSource = "";
281286
if (extUrl) {
282-
const match = extUrl.match(/github\.com\/([^/]+\/[^/]+)/);
283-
extSource = match ? match[1].replace(/\.git$/, "") : extUrl;
287+
const cleanUrl = extUrl.split(/[?#]/)[0];
288+
const match = cleanUrl.match(/github\.com[:/]([^/]+\/[^/]+)/);
289+
extSource = match ? match[1].replace(/\.git$/, "") : cleanUrl;
284290
}
285291
if (!extSource && ext.pack) extSource = ext.pack;
286292

287293
// GitHub repo slugs are case-insensitive; marketplace normalizes to
288294
// lowercase while scanner preserves original casing. Compare lowered
289295
// on both sides to avoid false negatives.
290296
const itemSourceLower = item.source.toLowerCase();
297+
if (!itemSourceLower) return false;
291298
const matchSource =
292299
extSource.toLowerCase() === itemSourceLower ||
293300
(ext.pack ?? "").toLowerCase() === itemSourceLower;
@@ -347,7 +354,8 @@ export default function MarketplacePage() {
347354
// Refresh extension store so audit page can resolve names immediately
348355
useExtensionStore.getState().fetch();
349356
const key = `${item.id}:${targetAgent ?? ""}`;
350-
setInstalled((prev) => new Set(prev).add(key));
357+
const installedKey = `${key}:${scopeKey(targetScope)}`;
358+
setInstalled((prev) => new Set(prev).add(installedKey));
351359
toast.success(
352360
result.was_update
353361
? t("toast.updated", { name: item.name })

0 commit comments

Comments
 (0)