chore: Extract '.gemini' to GEMINI_DIR constant (#10540)

Co-authored-by: Richie Foreman <richie.foreman@gmail.com>
This commit is contained in:
Dongin Kim(Terry)
2025-10-14 02:31:39 +09:00
committed by GitHub
parent 7beaa368a9
commit 518caae62e
36 changed files with 181 additions and 157 deletions

View File

@@ -6,7 +6,7 @@
import * as path from 'node:path';
import type { Config } from '@google/gemini-cli-core';
import { Storage } from '@google/gemini-cli-core';
import { GEMINI_DIR, Storage } from '@google/gemini-cli-core';
import mock from 'mock-fs';
import { FileCommandLoader } from './FileCommandLoader.js';
import { assert, vi } from 'vitest';
@@ -529,7 +529,9 @@ describe('FileCommandLoader', () => {
).getProjectCommandsDir();
const extensionDir = path.join(
process.cwd(),
'.gemini/extensions/test-ext',
GEMINI_DIR,
'extensions',
'test-ext',
);
mock({
@@ -582,7 +584,9 @@ describe('FileCommandLoader', () => {
).getProjectCommandsDir();
const extensionDir = path.join(
process.cwd(),
'.gemini/extensions/test-ext',
GEMINI_DIR,
'extensions',
'test-ext',
);
mock({
@@ -678,11 +682,15 @@ describe('FileCommandLoader', () => {
it('only loads commands from active extensions', async () => {
const extensionDir1 = path.join(
process.cwd(),
'.gemini/extensions/active-ext',
GEMINI_DIR,
'extensions',
'active-ext',
);
const extensionDir2 = path.join(
process.cwd(),
'.gemini/extensions/inactive-ext',
GEMINI_DIR,
'extensions',
'inactive-ext',
);
mock({
@@ -737,7 +745,9 @@ describe('FileCommandLoader', () => {
it('handles missing extension commands directory gracefully', async () => {
const extensionDir = path.join(
process.cwd(),
'.gemini/extensions/no-commands',
GEMINI_DIR,
'extensions',
'no-commands',
);
mock({
@@ -769,7 +779,12 @@ describe('FileCommandLoader', () => {
});
it('handles nested command structure in extensions', async () => {
const extensionDir = path.join(process.cwd(), '.gemini/extensions/a');
const extensionDir = path.join(
process.cwd(),
GEMINI_DIR,
'extensions',
'a',
);
mock({
[extensionDir]: {