@devries-cameron20 / t3code Mirror · read-only / commits / 1c379b63ba
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

fix(server): Antigravity links and discovers skills from skills.json (#39765)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Filippo Mameli committed Nov 20, 2026 at 16:16 UTC 1c379b63bafbd5fa54b7fa15282b5900af7bd604
5 files changed +391 -58
apps/server/src/provider/Drivers/AntigravitySkills.test.ts
+75
@@ -367,4 +367,79 @@ it.layer(NodeServices.layer)("discoverAntigravitySkills", (it) => {
367 }
368 }),
369 );
370 +
371 + it.effect(
372 + "reads skills declared in global and workspace skills.json with filters and inherits",
373 + () =>
374 + Effect.gen(function* () {
375 + const fileSystem = yield* FileSystem.FileSystem;
376 + const path = yield* Path.Path;
377 + const input = yield* makeWorkspace();
378 +
379 + const sharedSkills = path.join(input.userHome, ".agents", "skills");
380 + const keptPath = yield* writeSkill(
381 + path.join(sharedSkills, "yagni"),
382 + "---\nname: yagni\ndescription: Keep it simple.\n---\n",
383 + );
384 + yield* writeSkill(
385 + path.join(sharedSkills, "experimental-draft"),
386 + "---\nname: experimental-draft\n---\n",
387 + );
388 +
389 + const inheritedSkills = path.join(input.userHome, "inherited-skills");
390 + const inheritedPath = yield* writeSkill(
391 + path.join(inheritedSkills, "linter"),
392 + "---\nname: linter\n---\n",
393 + );
394 + yield* writeSkill(path.join(inheritedSkills, "skipped"), "---\nname: skipped\n---\n");
395 + // Backtracks exponentially under RegExp against the pattern below.
396 + yield* writeSkill(
397 + path.join(inheritedSkills, "a".repeat(40)),
398 + "---\nname: backtrack\n---\n",
399 + );
400 +
401 + const projectSkills = path.join(input.cwd, "tools", "skills");
402 + const projectPath = yield* writeSkill(
403 + path.join(projectSkills, "deploy"),
404 + "---\nname: deploy\n---\n",
405 + );
406 +
407 + const globalConfigDir = path.join(input.userHome, ".gemini", "config");
408 + const inheritedConfigPath = path.join(input.userHome, "shared-skills.json");
409 + yield* fileSystem.makeDirectory(globalConfigDir, { recursive: true });
410 + yield* fileSystem.makeDirectory(path.join(input.cwd, ".agents"), { recursive: true });
411 + yield* fileSystem.writeFileString(
412 + inheritedConfigPath,
413 + JSON.stringify({
414 + inherits: [{ path: path.join(globalConfigDir, "skills.json") }],
415 + entries: [{ path: "~/inherited-skills" }],
416 + }),
417 + );
418 + yield* fileSystem.writeFileString(
419 + path.join(globalConfigDir, "skills.json"),
420 + JSON.stringify({
421 + inherits: [{ path: inheritedConfigPath, include_only: ["linter", "(a*)*b"] }],
422 + entries: [{ path: sharedSkills, exclude: ["experimental-.*"] }],
423 + }),
424 + );
425 + yield* fileSystem.writeFileString(
426 + path.join(input.cwd, ".agents", "skills.json"),
427 + JSON.stringify({
428 + entries: [{ path: "tools/skills" }],
429 + }),
430 + );
431 +
432 + assert.deepEqual(yield* discoverAntigravitySkills(input), [
433 + { name: "deploy", path: projectPath, scope: "project", enabled: true },
434 + { name: "linter", path: inheritedPath, scope: "user", enabled: true },
435 + {
436 + name: "yagni",
437 + description: "Keep it simple.",
438 + path: keptPath,
439 + scope: "user",
440 + enabled: true,
441 + },
442 + ]);
443 + }),
444 + );
445 });
apps/server/src/provider/Drivers/AntigravitySkills.ts
+227
@@ -37,6 +37,7 @@ export function antigravityUserSkillDirectories(
37 const MAX_SKILL_BYTES = 1_000_000;
38 const MAX_SCAN_BYTES = 8_000_000;
39 const MAX_SCAN_ENTRIES = 10_000;
40 +const MAX_INHERIT_DEPTH = 10;
41 // Typical frontmatter fits in one chunk, so most skills cost about this much of the scan budget.
42 const SKILL_READ_CHUNK_BYTES = 1024;
43
@@ -45,6 +46,19 @@ const SkillFrontmatter = Schema.Struct({
46 description: Schema.optional(Schema.NullOr(Schema.String)),
47 });
48 const decodeSkillFrontmatter = Schema.decodeUnknownSync(SkillFrontmatter);
49 +const SkillConfigEntry = Schema.Struct({
50 + path: Schema.String,
51 + include_only: Schema.optional(Schema.Array(Schema.String)),
52 + exclude: Schema.optional(Schema.Array(Schema.String)),
53 +});
54 +const decodeSkillsConfig = Schema.decodeUnknownOption(
55 + Schema.fromJsonString(
56 + Schema.Struct({
57 + inherits: Schema.optional(Schema.Array(SkillConfigEntry)),
58 + entries: Schema.optional(Schema.Array(SkillConfigEntry)),
59 + }),
60 + ),
61 +);
62 const decodePluginPreferences = Schema.decodeUnknownOption(
63 Schema.fromJsonString(
64 Schema.Struct({
@@ -171,6 +185,139 @@ const readSkillFrontmatter = Effect.fn("readAntigravitySkill")(function* (
185 return bytes.toString("utf8", 0, frontmatterEnd);
186 });
187
188 +type SkillPatternMatcher = (entry: string) => boolean;
189 +
190 +interface SkillEntryFilter {
191 + readonly includeGroups: ReadonlyArray<ReadonlyArray<SkillPatternMatcher>>;
192 + readonly excludePatterns: ReadonlyArray<SkillPatternMatcher>;
193 +}
194 +
195 +const EMPTY_SKILL_FILTER: SkillEntryFilter = {
196 + includeGroups: [],
197 + excludePatterns: [],
198 +};
199 +
200 +interface SkillPatternToken {
201 + readonly test: (character: string) => boolean;
202 + readonly optional: boolean;
203 + readonly repeats: boolean;
204 +}
205 +
206 +/** Undefined for syntax outside literals, escapes, `.`, `[...]` and `* + ?`; such patterns match literally. */
207 +function parseSkillPattern(pattern: string): ReadonlyArray<SkillPatternToken> | undefined {
208 + const characters = Array.from(pattern);
209 + const tokens: Array<SkillPatternToken> = [];
210 + let index = 0;
211 + while (index < characters.length) {
212 + const character = characters[index]!;
213 + let test: (candidate: string) => boolean;
214 + if (character === "\\") {
215 + const escaped = characters[index + 1];
216 + if (escaped === undefined) return undefined;
217 + if (/[dDwWsS]/.test(escaped)) {
218 + const characterClass = new RegExp(`^\\${escaped}$`, "u");
219 + test = (candidate) => characterClass.test(candidate);
220 + } else {
221 + test = (candidate) => candidate === escaped;
222 + }
223 + index += 2;
224 + } else if (character === "[") {
225 + const close = characters.indexOf("]", index + 2);
226 + if (close === -1) return undefined;
227 + let characterClass: RegExp;
228 + try {
229 + characterClass = new RegExp(`^[${characters.slice(index + 1, close).join("")}]$`, "u");
230 + } catch {
231 + return undefined;
232 + }
233 + test = (candidate) => characterClass.test(candidate);
234 + index = close + 1;
235 + } else if (character === ".") {
236 + test = () => true;
237 + index += 1;
238 + } else if ("()|{}^$*+?".includes(character)) {
239 + return undefined;
240 + } else {
241 + test = (candidate) => candidate === character;
242 + index += 1;
243 + }
244 + const quantifier = characters[index];
245 + const optional = quantifier === "*" || quantifier === "?";
246 + const repeats = quantifier === "*" || quantifier === "+";
247 + if (optional || repeats) {
248 + index += 1;
249 + if (characters[index] === "?") index += 1;
250 + }
251 + tokens.push({ test, optional, repeats });
252 + }
253 + return tokens;
254 +}
255 +
256 +/** Manifests can come from an opened workspace, so matching runs as an NFA in linear time instead of RegExp. */
257 +function compileSkillPattern(pattern: string): SkillPatternMatcher {
258 + const tokens = parseSkillPattern(pattern);
259 + if (tokens === undefined) return (entry) => entry === pattern;
260 + const close = (states: Set<number>) => {
261 + for (const state of states) {
262 + if (state < tokens.length && tokens[state]!.optional) states.add(state + 1);
263 + }
264 + return states;
265 + };
266 + return (entry) => {
267 + let states = close(new Set([0]));
268 + for (const character of entry) {
269 + const next = new Set<number>();
270 + for (const state of states) {
271 + const token = tokens[state];
272 + if (!token?.test(character)) continue;
273 + next.add(state + 1);
274 + if (token.repeats) next.add(state);
275 + }
276 + if (next.size === 0) return false;
277 + states = close(next);
278 + }
279 + return states.has(tokens.length);
280 + };
281 +}
282 +
283 +function matchesSkillFilter(entry: string, filter: SkillEntryFilter): boolean {
284 + for (const group of filter.includeGroups) {
285 + if (!group.some((matches) => matches(entry))) return false;
286 + }
287 + return !filter.excludePatterns.some((matches) => matches(entry));
288 +}
289 +
290 +function narrowSkillFilter(
291 + parent: SkillEntryFilter,
292 + entry: {
293 + readonly include_only?: ReadonlyArray<string> | undefined;
294 + readonly exclude?: ReadonlyArray<string> | undefined;
295 + },
296 +): SkillEntryFilter {
297 + const includeGroups =
298 + entry.include_only && entry.include_only.length > 0
299 + ? [...parent.includeGroups, entry.include_only.map(compileSkillPattern)]
300 + : parent.includeGroups;
301 + const excludePatterns =
302 + entry.exclude && entry.exclude.length > 0
303 + ? [...parent.excludePatterns, ...entry.exclude.map(compileSkillPattern)]
304 + : parent.excludePatterns;
305 + return { includeGroups, excludePatterns };
306 +}
307 +
308 +function resolveSkillsConfigPath(
309 + path: Path.Path,
310 + rawPath: string,
311 + baseDir: string,
312 + userHome: string,
313 +): string {
314 + if (rawPath === "~") return userHome;
315 + if (rawPath.startsWith("~/") || rawPath.startsWith("~\\")) {
316 + return path.join(userHome, rawPath.slice(2));
317 + }
318 + return path.isAbsolute(rawPath) ? path.resolve(rawPath) : path.resolve(baseDir, rawPath);
319 +}
320 +
321 /** Keep read errors typed so workspace snapshots cannot cache partial results. */
322 export const discoverAntigravitySkills = Effect.fn("discoverAntigravitySkills")(function* (input: {
323 readonly cwd: string;
@@ -205,6 +352,7 @@ export const discoverAntigravitySkills = Effect.fn("discoverAntigravitySkills")(
352 directory: string,
353 scope: string,
354 scanChildren: boolean,
355 + filter: SkillEntryFilter = EMPTY_SKILL_FILTER,
356 ): Effect.fn.Return<void, AntigravitySkillsProbeError, FileSystem.FileSystem> {
357 const info = yield* readIfPresent(fileSystem.stat(directory), directory);
358 if (info?.type !== "Directory") return;
@@ -237,6 +385,7 @@ export const discoverAntigravitySkills = Effect.fn("discoverAntigravitySkills")(
385 }
386 if (scanChildren) {
387 const children = sortedEntries
388 + .filter((entry) => matchesSkillFilter(entry, filter))
389 .map((entry) => ({ entry, sortKey: skillPathSortKey(entry) }))
390 .sort((left, right) =>
391 left.sortKey < right.sortKey ? -1 : left.sortKey > right.sortKey ? 1 : 0,
@@ -247,10 +396,88 @@ export const discoverAntigravitySkills = Effect.fn("discoverAntigravitySkills")(
396 }
397 });
398
399 + const scanSkillsConfig = Effect.fn("scanAntigravitySkillsConfig")(function* (
400 + configPath: string,
401 + baseDir: string,
402 + scope: string,
403 + filter: SkillEntryFilter,
404 + visitedConfigs: ReadonlySet<string>,
405 + depth: number,
406 + ): Effect.fn.Return<void, AntigravitySkillsProbeError, FileSystem.FileSystem> {
407 + if (depth > MAX_INHERIT_DEPTH) return;
408 + const resolvedConfigPath = path.resolve(configPath);
409 + if (visitedConfigs.has(resolvedConfigPath)) return;
410 + const configInfo = yield* readIfPresent(
411 + fileSystem.stat(resolvedConfigPath),
412 + resolvedConfigPath,
413 + );
414 + if (configInfo?.type !== "File") return;
415 + const byteLimit = Math.min(MAX_SKILL_BYTES, budget.remainingBytes);
416 + if (configInfo.size > BigInt(byteLimit)) {
417 + return yield* new AntigravitySkillsProbeError({
418 + reason: "scan-budget-exhausted",
419 + path: resolvedConfigPath,
420 + });
421 + }
422 + const raw = yield* readIfPresent(
423 + fileSystem.readFileString(resolvedConfigPath),
424 + resolvedConfigPath,
425 + );
426 + if (raw === undefined) return;
427 + budget.remainingBytes -= Buffer.byteLength(raw, "utf8");
428 + const parsed = decodeSkillsConfig(raw);
429 + if (parsed._tag === "None") return;
430 +
431 + const nextVisited = new Set(visitedConfigs);
432 + nextVisited.add(resolvedConfigPath);
433 + for (const inherited of parsed.value.inherits ?? []) {
434 + const inheritedPath = resolveSkillsConfigPath(path, inherited.path, baseDir, input.userHome);
435 + yield* scanSkillsConfig(
436 + inheritedPath,
437 + path.dirname(inheritedPath),
438 + scope,
439 + narrowSkillFilter(filter, inherited),
440 + nextVisited,
441 + depth + 1,
442 + );
443 + }
444 + for (const entry of parsed.value.entries ?? []) {
445 + const entryDirectory = resolveSkillsConfigPath(path, entry.path, baseDir, input.userHome);
446 + yield* scanDirectory(entryDirectory, scope, true, narrowSkillFilter(filter, entry));
447 + }
448 + });
449 +
450 for (const root of roots) {
451 yield* scanDirectory(root.directory, root.scope, true);
452 }
453
454 + for (const config of [
455 + {
456 + configPath: path.resolve(input.cwd, ".agents", "skills.json"),
457 + baseDir: input.cwd,
458 + scope: "project",
459 + },
460 + {
461 + configPath: path.resolve(input.cwd, ".agent", "skills.json"),
462 + baseDir: input.cwd,
463 + scope: "project",
464 + },
465 + {
466 + configPath: path.join(input.userHome, ".gemini", "config", "skills.json"),
467 + baseDir: path.join(input.userHome, ".gemini", "config"),
468 + scope: "user",
469 + },
470 + ]) {
471 + yield* scanSkillsConfig(
472 + config.configPath,
473 + config.baseDir,
474 + config.scope,
475 + EMPTY_SKILL_FILTER,
476 + new Set(),
477 + 0,
478 + );
479 + }
480 +
481 const pluginsDirectory = path.join(input.profileDirectory, "config", "plugins");
482 const plugins = yield* readIfPresent(
483 fileSystem.readDirectory(pluginsDirectory),
apps/server/src/provider/antigravityAuthSupport.test.ts
+19 -2
@@ -699,9 +699,13 @@ it.layer(NodeServices.layer)("Antigravity profile preparation", (it) => {
699 const userHome = path.join(temporaryDirectory, "home");
700 const profileDirectory = path.join(temporaryDirectory, "profile");
701 const userGemini = path.join(userHome, ".gemini");
702 - yield* fs.makeDirectory(userGemini, { recursive: true });
702 + yield* fs.makeDirectory(path.join(userGemini, "config"), { recursive: true });
703 yield* fs.writeFileString(path.join(userGemini, "AGENTS.md"), "global agents rule");
704 yield* fs.writeFileString(path.join(userGemini, "GEMINI.md"), "global gemini rule");
705 + yield* fs.writeFileString(
706 + path.join(userGemini, "config", "skills.json"),
707 + JSON.stringify({ entries: [{ path: "/tmp/shared-skills" }] }),
708 + );
709
710 yield* prepareAntigravityProfile({ profileDirectory, userHome });
711 expect(yield* fs.readLink(path.join(profileDirectory, "AGENTS.md"))).toBe(
@@ -710,12 +714,17 @@ it.layer(NodeServices.layer)("Antigravity profile preparation", (it) => {
714 expect(yield* fs.readLink(path.join(profileDirectory, "GEMINI.md"))).toBe(
715 path.join(userGemini, "GEMINI.md"),
716 );
717 + expect(yield* fs.readLink(path.join(profileDirectory, "config", "skills.json"))).toBe(
718 + path.join(userGemini, "config", "skills.json"),
719 + );
720
721 yield* fs.remove(path.join(userGemini, "AGENTS.md"));
722 + yield* fs.remove(path.join(userGemini, "config", "skills.json"));
723 yield* fs.remove(path.join(profileDirectory, "GEMINI.md"));
724 yield* fs.writeFileString(path.join(profileDirectory, "GEMINI.md"), "profile's own rule");
725 yield* prepareAntigravityProfile({ profileDirectory, userHome });
726 expect(yield* fs.exists(path.join(profileDirectory, "AGENTS.md"))).toBe(false);
727 + expect(yield* fs.exists(path.join(profileDirectory, "config", "skills.json"))).toBe(false);
728 expect(yield* fs.readFileString(path.join(profileDirectory, "GEMINI.md"))).toBe(
729 "profile's own rule",
730 );
@@ -733,24 +742,32 @@ it.layer(NodeServices.layer)("Antigravity profile preparation", (it) => {
742 const prepare = prepareAntigravityProfile({ profileDirectory, userHome, platform: "win32" });
743 const profileAgents = path.join(profileDirectory, "AGENTS.md");
744 const profileGemini = path.join(profileDirectory, "GEMINI.md");
736 - yield* fs.makeDirectory(userGemini, { recursive: true });
745 + const profileSkillsJson = path.join(profileDirectory, "config", "skills.json");
746 + const userSkillsJson = path.join(userGemini, "config", "skills.json");
747 + yield* fs.makeDirectory(path.join(userGemini, "config"), { recursive: true });
748 yield* fs.writeFileString(path.join(userGemini, "AGENTS.md"), "global agents rule");
749 yield* fs.writeFileString(path.join(userGemini, "GEMINI.md"), "global gemini rule");
750 + yield* fs.writeFileString(userSkillsJson, '{"entries":[]}');
751
752 yield* prepare;
753 expect(yield* fs.readFileString(profileAgents)).toBe("global agents rule");
754 expect(yield* fs.readFileString(profileGemini)).toBe("global gemini rule");
755 + expect(yield* fs.readFileString(profileSkillsJson)).toBe('{"entries":[]}');
756
757 yield* fs.writeFileString(path.join(userGemini, "AGENTS.md"), "edited agents rule");
758 yield* fs.remove(path.join(userGemini, "GEMINI.md"));
759 + yield* fs.writeFileString(userSkillsJson, '{"entries":[{"path":"/skills"}]}');
760 yield* prepare;
761 expect(yield* fs.readFileString(profileAgents)).toBe("edited agents rule");
762 expect(yield* fs.exists(profileGemini)).toBe(false);
763 + expect(yield* fs.readFileString(profileSkillsJson)).toBe('{"entries":[{"path":"/skills"}]}');
764
765 yield* fs.writeFileString(profileGemini, "profile's own rule");
766 yield* fs.writeFileString(path.join(userGemini, "GEMINI.md"), "global gemini rule");
767 + yield* fs.remove(userSkillsJson);
768 yield* prepare;
769 expect(yield* fs.readFileString(profileGemini)).toBe("profile's own rule");
770 + expect(yield* fs.exists(profileSkillsJson)).toBe(false);
771 }),
772 );
773
apps/server/src/provider/antigravityAuthSupport.ts
+66 -54
@@ -253,7 +253,11 @@ class AntigravitySkillLinkError extends Schema.TaggedError<AntigravitySkillLinkE
253 }
254 }
255
256 -const antigravityUserRuleFiles = ["AGENTS.md", "GEMINI.md"] as const;
256 +const antigravityUserConfigFiles = [
257 + ["AGENTS.md"],
258 + ["GEMINI.md"],
259 + ["config", "skills.json"],
260 +] as const;
261
262 /** Private GEMINI_HOME isolates credentials/hooks/MCP; link global skills and rules from the real ~/.gemini. */
263 const linkAntigravityUserConfig = Effect.fn("linkAntigravityUserConfig")(function* (input: {
@@ -270,12 +274,16 @@ const linkAntigravityUserConfig = Effect.fn("linkAntigravityUserConfig")(functio
274 for (const [link, target, type] of [
275 [links[0], targets[0], directoryType],
276 [links[1], targets[1], directoryType],
273 - // File symlinks need elevation or Developer Mode on Windows, so rules are copied there.
277 + // File symlinks need elevation or Developer Mode on Windows, so config files are copied there.
278 ...(input.platform === "win32"
279 ? []
276 - : antigravityUserRuleFiles.map(
277 - (name) =>
278 - [path.join(input.profileDirectory, name), path.join(userGemini, name), "file"] as const,
280 + : antigravityUserConfigFiles.map(
281 + (segments) =>
282 + [
283 + path.join(input.profileDirectory, ...segments),
284 + path.join(userGemini, ...segments),
285 + "file",
286 + ] as const,
287 )),
288 ] as const) {
289 yield* Effect.gen(function* () {
@@ -329,54 +337,58 @@ const decodeRuleCopies = Schema.decodeUnknownOption(RuleCopiesJson);
337 const encodeRuleCopies = Schema.encodeSync(RuleCopiesJson);
338
339 /** Copies refresh each launch; the recorded copy keeps a file the profile owns or edited untouched. */
332 -const copyAntigravityUserRuleFiles = Effect.fn("copyAntigravityUserRuleFiles")(function* (input: {
333 - readonly profileDirectory: string;
334 - readonly userHome: string;
335 -}): Effect.fn.Return<void, never, FileSystem.FileSystem | Path.Path> {
336 - const fs = yield* FileSystem.FileSystem;
337 - const path = yield* Path.Path;
338 - const manifestPath = path.join(input.profileDirectory, ".t3-rule-copies.json");
339 - const readOptional = (file: string) =>
340 - fs.readFileString(file).pipe(Effect.orElseSucceed((): string | undefined => undefined));
341 - const manifestText = yield* readOptional(manifestPath);
342 - const copies: Record<string, string> = {
343 - ...Option.getOrElse(decodeRuleCopies(manifestText), () => ({})),
344 - };
345 - for (const name of antigravityUserRuleFiles) {
346 - const link = path.join(input.profileDirectory, name);
347 - const target = path.join(input.userHome, ".gemini", name);
348 - yield* Effect.gen(function* () {
349 - const current = yield* readOptional(link);
350 - if (current !== undefined && current !== copies[name]) {
351 - delete copies[name];
352 - return;
353 - }
354 - const source = yield* readOptional(target);
355 - if (source === undefined) {
356 - if (current !== undefined) yield* fs.remove(link);
357 - delete copies[name];
358 - return;
359 - }
360 - yield* fs.writeFileString(link, source);
361 - copies[name] = source;
362 - }).pipe(
363 - Effect.catch((error) =>
364 - Effect.logWarning("Antigravity user rules are not copied into the profile.", {
365 - link,
366 - target,
367 - error,
368 - }),
369 - ),
370 - );
371 - }
372 - yield* fs
373 - .writeFileString(manifestPath, encodeRuleCopies(copies))
374 - .pipe(
375 - Effect.catch((error) =>
376 - Effect.logWarning("Antigravity rule copy record could not be written.", { error }),
377 - ),
378 - );
379 -});
340 +const copyAntigravityUserConfigFiles = Effect.fn("copyAntigravityUserConfigFiles")(
341 + function* (input: {
342 + readonly profileDirectory: string;
343 + readonly userHome: string;
344 + }): Effect.fn.Return<void, never, FileSystem.FileSystem | Path.Path> {
345 + const fs = yield* FileSystem.FileSystem;
346 + const path = yield* Path.Path;
347 + const manifestPath = path.join(input.profileDirectory, ".t3-rule-copies.json");
348 + const readOptional = (file: string) =>
349 + fs.readFileString(file).pipe(Effect.orElseSucceed((): string | undefined => undefined));
350 + const manifestText = yield* readOptional(manifestPath);
351 + const copies: Record<string, string> = {
352 + ...Option.getOrElse(decodeRuleCopies(manifestText), () => ({})),
353 + };
354 + for (const segments of antigravityUserConfigFiles) {
355 + const key = segments.join("/");
356 + const link = path.join(input.profileDirectory, ...segments);
357 + const target = path.join(input.userHome, ".gemini", ...segments);
358 + yield* Effect.gen(function* () {
359 + const current = yield* readOptional(link);
360 + if (current !== undefined && current !== copies[key]) {
361 + delete copies[key];
362 + return;
363 + }
364 + const source = yield* readOptional(target);
365 + if (source === undefined) {
366 + if (current !== undefined) yield* fs.remove(link);
367 + delete copies[key];
368 + return;
369 + }
370 + yield* fs.makeDirectory(path.dirname(link), { recursive: true });
371 + yield* fs.writeFileString(link, source);
372 + copies[key] = source;
373 + }).pipe(
374 + Effect.catch((error) =>
375 + Effect.logWarning("Antigravity user configuration is not copied into the profile.", {
376 + link,
377 + target,
378 + error,
379 + }),
380 + ),
381 + );
382 + }
383 + yield* fs
384 + .writeFileString(manifestPath, encodeRuleCopies(copies))
385 + .pipe(
386 + Effect.catch((error) =>
387 + Effect.logWarning("Antigravity rule copy record could not be written.", { error }),
388 + ),
389 + );
390 + },
391 +);
392
393 export const prepareAntigravityProfile = Effect.fn("prepareAntigravityProfile")(function* (input: {
394 readonly profileDirectory: string;
@@ -526,7 +538,7 @@ export const prepareAntigravityProfile = Effect.fn("prepareAntigravityProfile")(
538 );
539 yield* linkAntigravityUserConfig({ profileDirectory: geminiHome, userHome, platform });
540 if (platform === "win32") {
529 - yield* copyAntigravityUserRuleFiles({ profileDirectory: geminiHome, userHome });
541 + yield* copyAntigravityUserConfigFiles({ profileDirectory: geminiHome, userHome });
542 }
543 return profile;
544 });
docs/user/providers-antigravity.md
+4 -2
@@ -102,8 +102,10 @@ wins in this order: `.gemini/skills`, `.agents/skills`, `.agent/skills`. See
102 [commands and skills](./composer.md#commands-and-skills) for invoking them.
103
104 Skills for every project go in `~/.gemini/config/skills` or
105 -`~/.gemini/antigravity-cli/skills`. Antigravity does not read `~/.agents/skills`,
106 -so a skill there only appears when the project itself is your home directory.
105 +`~/.gemini/antigravity-cli/skills`. Antigravity does not read `~/.agents/skills`
106 +on its own; to share a folder like that one, list it in `~/.gemini/config/skills.json`
107 +(or a project's `.agents/skills.json`), and T3 Code shows the skills it declares,
108 +honoring `inherits`, `include_only`, and `exclude`.
109
110 Antigravity receives images and audio directly, and reads PDFs and text files as
111 documents. Other attachments, including videos, are passed as a saved file path for