Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/server/src/guide/topics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ When a Claude, Codex or Antigravity usage limit stops a thread, the notice above
"instructions",
"rules",
],
body: `{place:settings.plugins} manages what agents can use beyond their own tools, per provider, on this computer or one project: {place:plugins.installed}, {place:plugins.apps}, {place:plugins.connections} (MCP servers) and {place:plugins.hooks}. Its Skills tab is {place:plugins.skills}.
body: `{place:settings.plugins} manages what agents can use beyond their own tools, per provider, on this computer or one project: {place:plugins.installed}, {place:plugins.apps}, {place:plugins.connections} (MCP servers) and {place:plugins.hooks}. Its Skills tab ({place:plugins.skills}) lists skills across every enabled provider (Codex, Claude, Antigravity, Grok, Cursor, OpenCode, Pi, Muse, fx and community agents), lets you toggle skills for Codex, Claude personal skills, Grok, local OpenCode and Antigravity personal skills (inside Threadlines profiles), and lets you inspect, reveal in folder, open provider config, create or delete skills where supported.

{place:settings.instructions} shows the instruction files each provider reads in a project (like AGENTS.md or CLAUDE.md), to open or edit.`,
},
Expand Down
50 changes: 30 additions & 20 deletions apps/server/src/provider/antigravity/AntigravitySkills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ export interface ListAntigravitySkillsInput {
readonly cwd: string;
/** The instance's profile (`GEMINI_HOME`), already prepared (`prepareAntigravityProfile`). */
readonly profileDir: string;
/** False on machine-wide views, so home-dir `.agents` / `.gemini` folders are not treated as project roots. */
readonly includeProject?: boolean;
}

export interface AntigravitySkillListing {
Expand All @@ -436,41 +438,49 @@ export async function listAntigravitySkillsNow(
): Promise<AntigravitySkillListing> {
const cwd = resolve(input.cwd);
const profile = resolve(input.profileDir);
const includeProject = input.includeProject !== false;
const scan = new SkillScan(
Date.now() + (options.timeLimitMs ?? Duration.toMillis(LIST_TIME_LIMIT)),
);

// Nothing outside the project or its repository root is opened for it.
const root = await repositoryRoot(scan, cwd);
const realRoot = (await scan.realpath(root)) ?? root;
const root = includeProject ? await repositoryRoot(scan, cwd) : cwd;
const realRoot = includeProject ? ((await scan.realpath(root)) ?? root) : cwd;
const insideProject: Confine = async (path) => {
const real = await scan.realpath(path);
return real !== undefined && isInside(realRoot, real);
};

const roots: ReadonlyArray<readonly [string, Scope]> = [
[join(profile, "config", "skills"), "user"],
[join(cwd, ".gemini", "skills"), "project"],
[join(profile, "antigravity-cli", "skills"), "user"],
[join(cwd, ".agents", "skills"), "project"],
[join(cwd, ".agent", "skills"), "project"],
];
const roots: ReadonlyArray<readonly [string, Scope]> = includeProject
? [
[join(profile, "config", "skills"), "user"],
[join(cwd, ".gemini", "skills"), "project"],
[join(profile, "antigravity-cli", "skills"), "user"],
[join(cwd, ".agents", "skills"), "project"],
[join(cwd, ".agent", "skills"), "project"],
]
: [
[join(profile, "config", "skills"), "user"],
[join(profile, "antigravity-cli", "skills"), "user"],
];
for (const [dir, scope] of roots) {
await scan.scanFolder(dir, scope, NO_FILTER, scope === "project" ? insideProject : undefined);
}

// The CLI skips project manifest entries leaving the project or its repository root.
for (let dir = cwd; ; dir = dirname(dir)) {
for (const folder of [".agents", ".agent"]) {
await scan.scanManifest({
path: join(dir, folder, "skills.json"),
baseDir: dir,
scope: "project",
filter: NO_FILTER,
confine: insideProject,
});
if (includeProject) {
for (let dir = cwd; ; dir = dirname(dir)) {
for (const folder of [".agents", ".agent"]) {
await scan.scanManifest({
path: join(dir, folder, "skills.json"),
baseDir: dir,
scope: "project",
filter: NO_FILTER,
confine: insideProject,
});
}
if (dir === root || dirname(dir) === dir || scan.exhausted) break;
}
if (dir === root || dirname(dir) === dir || scan.exhausted) break;
}
await scan.scanManifest({
path: join(profile, "config", "skills.json"),
Expand All @@ -495,7 +505,7 @@ export async function listAntigravitySkillsNow(
export function makeAntigravitySkillsLister() {
const lastComplete = new Map<string, ReadonlyArray<ServerProviderSkill>>();
return (input: ListAntigravitySkillsInput) => {
const key = `${resolve(input.cwd)}\0${resolve(input.profileDir)}`;
const key = `${resolve(input.cwd)}\0${resolve(input.profileDir)}\0${input.includeProject !== false ? "1" : "0"}`;
return Effect.promise(() =>
listAntigravitySkillsNow(input).catch((): AntigravitySkillListing => ({
skills: [],
Expand Down
74 changes: 74 additions & 0 deletions apps/server/src/provider/antigravity/AntigravityUserConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
ANTIGRAVITY_SHARED_DIRS,
ANTIGRAVITY_SHARED_FILES,
antigravityUserHome,
readAntigravityDisabledSkills,
setAntigravitySkillDisabled,
shareAntigravityUserConfigNow,
} from "./AntigravityUserConfig.ts";

Expand Down Expand Up @@ -432,4 +434,76 @@ describe("an Antigravity instance and the user's own setup", () => {
{ name: "review", description: "Review changes.", path: skill, scope: "user", enabled: true },
]);
});

it("splits config/skills into per-skill links when a skill is disabled and collapses safely on re-enable", async () => {
const setup = await makeSetup();
await setup.write("config/skills/alpha/SKILL.md", "---\nname: alpha\n---\n");
await setup.write("config/skills/beta/SKILL.md", "---\nname: beta\n---\n");

await shareAntigravityUserConfigNow({ ...setup, platform: "linux" });
expect(await linkOf(inProfile(setup.profileDir, "config/skills"))).toBe(
path.join(setup.gemini, "config/skills"),
);

const disableProblems = await setAntigravitySkillDisabled({
...setup,
platform: "linux",
sharedDir: "config/skills",
entryName: "beta",
disabled: true,
});
expect(disableProblems).toEqual([]);
expect(await linkOf(inProfile(setup.profileDir, "config/skills"))).toBeUndefined();
expect(await linkOf(inProfile(setup.profileDir, "config/skills/alpha"))).toBe(
path.join(setup.gemini, "config/skills/alpha"),
);
expect(await exists(inProfile(setup.profileDir, "config/skills/beta"))).toBe(false);
expect(await readAntigravityDisabledSkills(setup.profileDir)).toEqual({
"config/skills": ["beta"],
"antigravity-cli/skills": [],
});

// Re-enabling restores the whole-directory symlink when no agent-owned folder is inside.
const enableProblems = await setAntigravitySkillDisabled({
...setup,
platform: "linux",
sharedDir: "config/skills",
entryName: "beta",
disabled: false,
});
expect(enableProblems).toEqual([]);
expect(await linkOf(inProfile(setup.profileDir, "config/skills"))).toBe(
path.join(setup.gemini, "config/skills"),
);

// If the agent created its own skill while split, re-enabling must keep enabled links intact.
await setAntigravitySkillDisabled({
...setup,
platform: "linux",
sharedDir: "config/skills",
entryName: "beta",
disabled: true,
});
await NodeFS.mkdir(inProfile(setup.profileDir, "config/skills/agent-own"), { recursive: true });
await NodeFS.writeFile(
inProfile(setup.profileDir, "config/skills/agent-own/SKILL.md"),
"agent",
);
await setAntigravitySkillDisabled({
...setup,
platform: "linux",
sharedDir: "config/skills",
entryName: "beta",
disabled: false,
});
expect(await exists(inProfile(setup.profileDir, "config/skills/agent-own/SKILL.md"))).toBe(
true,
);
expect(await linkOf(inProfile(setup.profileDir, "config/skills/alpha"))).toBe(
path.join(setup.gemini, "config/skills/alpha"),
);
expect(await linkOf(inProfile(setup.profileDir, "config/skills/beta"))).toBe(
path.join(setup.gemini, "config/skills/beta"),
);
});
});
Loading
Loading