summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml8
-rw-r--r--packages/cli/src/config/config.ts6
-rw-r--r--packages/cli/src/core/gemini-client.ts1
-rw-r--r--packages/cli/src/core/gemini-stream.ts8
-rw-r--r--packages/cli/src/tools/ls.tool.ts23
-rw-r--r--packages/cli/src/tools/read-file.tool.ts5
-rw-r--r--packages/cli/src/tools/terminal.tool.ts18
-rw-r--r--packages/cli/src/tools/web-fetch.tool.ts6
-rw-r--r--packages/cli/src/tools/write-file.tool.ts5
-rw-r--r--packages/cli/src/ui/components/Footer.tsx12
-rw-r--r--packages/cli/src/ui/components/Header.tsx38
-rw-r--r--packages/cli/src/ui/components/HistoryDisplay.tsx37
-rw-r--r--packages/cli/src/ui/components/InputPrompt.tsx4
-rw-r--r--packages/cli/src/ui/components/Tips.tsx26
-rw-r--r--packages/cli/src/ui/components/messages/ToolGroupMessage.tsx34
-rw-r--r--packages/cli/src/ui/hooks/useAppEffects.ts2
-rw-r--r--packages/cli/src/ui/hooks/useGeminiStream.ts5
-rw-r--r--packages/cli/src/utils/BackgroundTerminalAnalyzer.ts10
-rw-r--r--packages/cli/src/utils/errors.ts28
-rw-r--r--packages/cli/src/utils/getFolderStructure.ts10
-rw-r--r--packages/cli/tsconfig.json4
-rw-r--r--packages/server/package.json43
-rw-r--r--packages/server/src/index.ts4
-rw-r--r--packages/server/tsconfig.json21
-rw-r--r--scripts/check-build-status.js59
-rw-r--r--tsconfig.json2
26 files changed, 211 insertions, 208 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ca0c6936..ec049686 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -4,9 +4,9 @@ name: Gemini Code CI
on:
push:
- branches: [ main ] # Run on pushes to the main branch
+ branches: [main] # Run on pushes to the main branch
pull_request:
- branches: [ main ] # Run on pull requests targeting the main branch
+ branches: [main] # Run on pull requests targeting the main branch
jobs:
build_and_test:
@@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
# Specify the Node.js versions you want to test against
- node-version: [ 20.x ] # You can add more like [18.x, 20.x]
+ node-version: [20.x] # You can add more like [18.x, 20.x]
steps:
# 1. Checkout Code
@@ -60,4 +60,4 @@ jobs:
# 8. Testing
# Uncomment when we have tests.
#- name: Run tests
- # run: npm test \ No newline at end of file
+ # run: npm test
diff --git a/packages/cli/src/config/config.ts b/packages/cli/src/config/config.ts
index f02fea98..28e755e8 100644
--- a/packages/cli/src/config/config.ts
+++ b/packages/cli/src/config/config.ts
@@ -35,7 +35,7 @@ export function loadConfig(): Config {
loadEnvironment();
const argv = parseArguments();
return new Config(
- process.env.GEMINI_API_KEY || "",
+ process.env.GEMINI_API_KEY || '',
argv.model || process.env.GEMINI_API_KEY || DEFAULT_GEMINI_MODEL,
argv.target_dir || process.cwd(),
);
@@ -66,15 +66,13 @@ function parseArguments(): CliArgs {
})
.help()
.alias('h', 'help')
- .strict() // Keep strict mode to error on unknown options
- .argv;
+ .strict().argv; // Keep strict mode to error on unknown options
// Cast to the interface to ensure the structure aligns with expectations
// Use `unknown` first for safer casting if types might not perfectly match
return argv as unknown as CliArgs;
}
-
function findEnvFile(startDir: string): string | null {
// Start search from the provided directory (e.g., current working directory)
let currentDir = path.resolve(startDir); // Ensure absolute path
diff --git a/packages/cli/src/core/gemini-client.ts b/packages/cli/src/core/gemini-client.ts
index 64bf87a3..a488b982 100644
--- a/packages/cli/src/core/gemini-client.ts
+++ b/packages/cli/src/core/gemini-client.ts
@@ -21,7 +21,6 @@ import { getFolderStructure } from '../utils/getFolderStructure.js';
import { GeminiEventType, GeminiStream } from './gemini-stream.js';
import { Config } from '../config/config.js';
-
type ToolExecutionOutcome = {
callId: string;
name: string;
diff --git a/packages/cli/src/core/gemini-stream.ts b/packages/cli/src/core/gemini-stream.ts
index 70361f10..0e3ca025 100644
--- a/packages/cli/src/core/gemini-stream.ts
+++ b/packages/cli/src/core/gemini-stream.ts
@@ -1,4 +1,4 @@
-import { ToolCallEvent , HistoryItem } from '../ui/types.js';
+import { ToolCallEvent, HistoryItem } from '../ui/types.js';
import { Part } from '@google/genai';
import {
handleToolCallChunk,
@@ -161,7 +161,11 @@ export const processGeminiStream = async ({
renderTimeoutId = null;
}
// Delegate history update for error message
- addErrorMessageToHistory(error as (Error | DOMException), setHistory, getNextMessageId);
+ addErrorMessageToHistory(
+ error as Error | DOMException,
+ setHistory,
+ getNextMessageId,
+ );
} finally {
isStreamComplete = true; // Signal stream end for render loop completion
if (renderTimeoutId) {
diff --git a/packages/cli/src/tools/ls.tool.ts b/packages/cli/src/tools/ls.tool.ts
index d2f6a3c7..4b015fa5 100644
--- a/packages/cli/src/tools/ls.tool.ts
+++ b/packages/cli/src/tools/ls.tool.ts
@@ -116,8 +116,12 @@ export class LSTool extends BaseTool<LSToolParams, ToolResult> {
* @returns An error message string if invalid, null otherwise
*/
validateToolParams(params: LSToolParams): string | null {
- if (this.schema.parameters &&
- !SchemaValidator.validate(this.schema.parameters as Record<string, unknown>, params)
+ if (
+ this.schema.parameters &&
+ !SchemaValidator.validate(
+ this.schema.parameters as Record<string, unknown>,
+ params,
+ )
) {
return 'Parameters failed schema validation.';
}
@@ -181,7 +185,8 @@ export class LSTool extends BaseTool<LSToolParams, ToolResult> {
if (validationError) {
return this.errorResult(
`Error: Invalid parameters provided. Reason: ${validationError}`,
- `Failed to execute tool.`);
+ `Failed to execute tool.`,
+ );
}
try {
@@ -189,12 +194,14 @@ export class LSTool extends BaseTool<LSToolParams, ToolResult> {
if (!stats) {
return this.errorResult(
`Directory does not exist: ${params.path}`,
- `Directory does not exist.`);
+ `Directory does not exist.`,
+ );
}
if (!stats.isDirectory()) {
return this.errorResult(
`Path is not a directory: ${params.path}`,
- `Path is not a directory.`);
+ `Path is not a directory.`,
+ );
}
const files = fs.readdirSync(params.path);
@@ -202,7 +209,8 @@ export class LSTool extends BaseTool<LSToolParams, ToolResult> {
if (files.length === 0) {
return this.errorResult(
`Directory is empty: ${params.path}`,
- `Directory is empty.`);
+ `Directory is empty.`,
+ );
}
for (const file of files) {
@@ -249,7 +257,8 @@ export class LSTool extends BaseTool<LSToolParams, ToolResult> {
} catch (error) {
return this.errorResult(
`Error listing directory: ${error instanceof Error ? error.message : String(error)}`,
- 'Failed to list directory.');
+ 'Failed to list directory.',
+ );
}
}
}
diff --git a/packages/cli/src/tools/read-file.tool.ts b/packages/cli/src/tools/read-file.tool.ts
index feb9cbae..9bc10491 100644
--- a/packages/cli/src/tools/read-file.tool.ts
+++ b/packages/cli/src/tools/read-file.tool.ts
@@ -27,10 +27,7 @@ export interface ReadFileToolParams {
/**
* Implementation of the ReadFile tool that reads files from the filesystem
*/
-export class ReadFileTool extends BaseTool<
- ReadFileToolParams,
- ToolResult
-> {
+export class ReadFileTool extends BaseTool<ReadFileToolParams, ToolResult> {
static readonly Name: string = 'read_file';
// Maximum number of lines to read by default
diff --git a/packages/cli/src/tools/terminal.tool.ts b/packages/cli/src/tools/terminal.tool.ts
index 1049a224..dacfb0be 100644
--- a/packages/cli/src/tools/terminal.tool.ts
+++ b/packages/cli/src/tools/terminal.tool.ts
@@ -115,10 +115,7 @@ interface QueuedCommand {
/**
* Implementation of the terminal tool that executes shell commands within a persistent session.
*/
-export class TerminalTool extends BaseTool<
- TerminalToolParams,
- ToolResult
-> {
+export class TerminalTool extends BaseTool<TerminalToolParams, ToolResult> {
static Name: string = 'execute_bash_command';
private readonly rootDirectory: string;
@@ -134,10 +131,7 @@ export class TerminalTool extends BaseTool<
private rejectShellReady: ((reason?: unknown) => void) | undefined; // Definite assignment assertion
private readonly backgroundTerminalAnalyzer: BackgroundTerminalAnalyzer;
- constructor(
- rootDirectory: string,
- outputLimit: number = MAX_OUTPUT_LENGTH,
- ) {
+ constructor(rootDirectory: string, outputLimit: number = MAX_OUTPUT_LENGTH) {
const toolDisplayName = 'Terminal';
// --- LLM-Facing Description ---
// Updated description for background tasks to mention polling and LLM analysis
@@ -454,9 +448,7 @@ Use this tool for running build steps (\`npm install\`, \`make\`), linters (\`es
// Define temp file paths here to be accessible throughout
let tempStdoutPath: string | null = null;
let tempStderrPath: string | null = null;
- let originalResolve: (
- value: ToolResult | PromiseLike<ToolResult>,
- ) => void; // To pass to polling
+ let originalResolve: (value: ToolResult | PromiseLike<ToolResult>) => void; // To pass to polling
let originalReject: (reason?: unknown) => void;
const promise = new Promise<ToolResult>((resolve, reject) => {
@@ -939,9 +931,7 @@ Use this tool for running build steps (\`npm install\`, \`make\`), linters (\`es
initialStderr: string, // Stderr during launch phase
tempStdoutPath: string, // Path to redirected stdout
tempStderrPath: string, // Path to redirected stderr
- resolve: (
- value: ToolResult | PromiseLike<ToolResult>,
- ) => void, // The original promise's resolve
+ resolve: (value: ToolResult | PromiseLike<ToolResult>) => void, // The original promise's resolve
): Promise<void> {
// This function manages its own lifecycle but resolves the outer promise
let finalStdout = '';
diff --git a/packages/cli/src/tools/web-fetch.tool.ts b/packages/cli/src/tools/web-fetch.tool.ts
index 74467605..4fc1e45e 100644
--- a/packages/cli/src/tools/web-fetch.tool.ts
+++ b/packages/cli/src/tools/web-fetch.tool.ts
@@ -90,9 +90,7 @@ export class WebFetchTool extends BaseTool<
getDescription(params: WebFetchToolParams): string {
// Shorten long URLs for display
const displayUrl =
- params.url.length > 80
- ? params.url.substring(0, 77) + '...'
- : params.url;
+ params.url.length > 80 ? params.url.substring(0, 77) + '...' : params.url;
return `Fetching content from ${displayUrl}`;
}
@@ -130,7 +128,7 @@ export class WebFetchTool extends BaseTool<
headers: {
'User-Agent': 'GeminiCode-CLI/1.0',
},
- signal: AbortSignal.timeout(15000) // 15 seconds timeout
+ signal: AbortSignal.timeout(15000), // 15 seconds timeout
});
if (!response.ok) {
diff --git a/packages/cli/src/tools/write-file.tool.ts b/packages/cli/src/tools/write-file.tool.ts
index cc0d5511..af0adc8d 100644
--- a/packages/cli/src/tools/write-file.tool.ts
+++ b/packages/cli/src/tools/write-file.tool.ts
@@ -28,10 +28,7 @@ export interface WriteFileToolParams {
/**
* Implementation of the WriteFile tool that writes files to the filesystem
*/
-export class WriteFileTool extends BaseTool<
- WriteFileToolParams,
- ToolResult
-> {
+export class WriteFileTool extends BaseTool<WriteFileToolParams, ToolResult> {
static readonly Name: string = 'write_file';
private shouldAlwaysWrite = false;
diff --git a/packages/cli/src/ui/components/Footer.tsx b/packages/cli/src/ui/components/Footer.tsx
index 6b069a2f..f2afc1bd 100644
--- a/packages/cli/src/ui/components/Footer.tsx
+++ b/packages/cli/src/ui/components/Footer.tsx
@@ -6,12 +6,12 @@ interface FooterProps {
}
const Footer: React.FC<FooterProps> = ({ queryLength }) => (
- <Box marginTop={1} justifyContent="space-between">
- <Box minWidth={15}>
- <Text color="gray">{queryLength === 0 ? '? for shortcuts' : ''}</Text>
- </Box>
- <Text color="blue">Gemini</Text>
+ <Box marginTop={1} justifyContent="space-between">
+ <Box minWidth={15}>
+ <Text color="gray">{queryLength === 0 ? '? for shortcuts' : ''}</Text>
</Box>
- );
+ <Text color="blue">Gemini</Text>
+ </Box>
+);
export default Footer;
diff --git a/packages/cli/src/ui/components/Header.tsx b/packages/cli/src/ui/components/Header.tsx
index d3f0f9d5..f8f7d27e 100644
--- a/packages/cli/src/ui/components/Header.tsx
+++ b/packages/cli/src/ui/components/Header.tsx
@@ -8,31 +8,31 @@ interface HeaderProps {
}
const Header: React.FC<HeaderProps> = ({ cwd }) => (
- <>
- {/* Static Header Art */}
- <Box marginBottom={1}>
- <Text color="blue">{`
+ <>
+ {/* Static Header Art */}
+ <Box marginBottom={1}>
+ <Text color="blue">{`
______ ________ ____ ____ _____ ____ _____ _____
.' ___ ||_ __ ||_ \\ / _||_ _||_ \\|_ _||_ _|
/ .' \\_| | |_ \\_| | \\/ | | | | \\ | | | |
| | ____ | _| _ | |\\ /| | | | | |\\ \\| | | |
\\ \`.___] |_| |__/ | _| |_\\/_| |_ _| |_ _| |_\\ |_ _| |_
\`._____.'|________||_____||_____||_____||_____|\\____||_____|`}</Text>
+ </Box>
+ {/* CWD Display */}
+ <Box
+ borderStyle="round"
+ borderColor="blue"
+ paddingX={BOX_PADDING_X}
+ flexDirection="column"
+ marginBottom={1}
+ width={UI_WIDTH}
+ >
+ <Box paddingLeft={2}>
+ <Text color="gray">cwd: {shortenPath(cwd, /*maxLength*/ 70)}</Text>
</Box>
- {/* CWD Display */}
- <Box
- borderStyle="round"
- borderColor="blue"
- paddingX={BOX_PADDING_X}
- flexDirection="column"
- marginBottom={1}
- width={UI_WIDTH}
- >
- <Box paddingLeft={2}>
- <Text color="gray">cwd: {shortenPath(cwd, /*maxLength*/ 70)}</Text>
- </Box>
- </Box>
- </>
- );
+ </Box>
+ </>
+);
export default Header;
diff --git a/packages/cli/src/ui/components/HistoryDisplay.tsx b/packages/cli/src/ui/components/HistoryDisplay.tsx
index fe0bf4c1..7565c5bc 100644
--- a/packages/cli/src/ui/components/HistoryDisplay.tsx
+++ b/packages/cli/src/ui/components/HistoryDisplay.tsx
@@ -17,26 +17,23 @@ interface HistoryDisplayProps {
const HistoryDisplay: React.FC<HistoryDisplayProps> = ({
history,
onSubmit,
-}) =>
+}) => (
// No grouping logic needed here anymore
- (
- <Box flexDirection="column">
- {history.map((item) => (
- <Box key={item.id} marginBottom={1}>
- {/* Render standard message types */}
- {item.type === 'user' && <UserMessage text={item.text} />}
- {item.type === 'gemini' && <GeminiMessage text={item.text} />}
- {item.type === 'info' && <InfoMessage text={item.text} />}
- {item.type === 'error' && <ErrorMessage text={item.text} />}
-
- {/* Render the tool group component */}
- {item.type === 'tool_group' && (
- <ToolGroupMessage toolCalls={item.tools} onSubmit={onSubmit} />
- )}
- </Box>
- ))}
- </Box>
- )
-;
+ <Box flexDirection="column">
+ {history.map((item) => (
+ <Box key={item.id} marginBottom={1}>
+ {/* Render standard message types */}
+ {item.type === 'user' && <UserMessage text={item.text} />}
+ {item.type === 'gemini' && <GeminiMessage text={item.text} />}
+ {item.type === 'info' && <InfoMessage text={item.text} />}
+ {item.type === 'error' && <ErrorMessage text={item.text} />}
+ {/* Render the tool group component */}
+ {item.type === 'tool_group' && (
+ <ToolGroupMessage toolCalls={item.tools} onSubmit={onSubmit} />
+ )}
+ </Box>
+ ))}
+ </Box>
+);
export default HistoryDisplay;
diff --git a/packages/cli/src/ui/components/InputPrompt.tsx b/packages/cli/src/ui/components/InputPrompt.tsx
index 1102e75d..96089eec 100644
--- a/packages/cli/src/ui/components/InputPrompt.tsx
+++ b/packages/cli/src/ui/components/InputPrompt.tsx
@@ -3,8 +3,6 @@ import { Box, Text } from 'ink';
import TextInput from 'ink-text-input';
import { globalConfig } from '../../config/config.js';
-
-
interface InputPromptProps {
query: string;
setQuery: (value: string) => void;
@@ -34,6 +32,6 @@ const InputPrompt: React.FC<InputPromptProps> = ({
</Box>
</Box>
);
-}
+};
export default InputPrompt;
diff --git a/packages/cli/src/ui/components/Tips.tsx b/packages/cli/src/ui/components/Tips.tsx
index 6be53360..aa8d39d6 100644
--- a/packages/cli/src/ui/components/Tips.tsx
+++ b/packages/cli/src/ui/components/Tips.tsx
@@ -3,18 +3,18 @@ import { Box, Text } from 'ink';
import { UI_WIDTH } from '../constants.js';
const Tips: React.FC = () => (
- <Box flexDirection="column" marginBottom={1} width={UI_WIDTH}>
- <Text>Tips for getting started:</Text>
- <Text>
- 1. <Text bold>/help</Text> for more information.
- </Text>
- <Text>
- 2. <Text bold>/init</Text> to create a GEMINI.md for instructions &
- context.
- </Text>
- <Text>3. Ask coding questions, edit code or run commands.</Text>
- <Text>4. Be specific for the best results.</Text>
- </Box>
- );
+ <Box flexDirection="column" marginBottom={1} width={UI_WIDTH}>
+ <Text>Tips for getting started:</Text>
+ <Text>
+ 1. <Text bold>/help</Text> for more information.
+ </Text>
+ <Text>
+ 2. <Text bold>/init</Text> to create a GEMINI.md for instructions &
+ context.
+ </Text>
+ <Text>3. Ask coding questions, edit code or run commands.</Text>
+ <Text>4. Be specific for the best results.</Text>
+ </Box>
+);
export default Tips;
diff --git a/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx b/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
index 6627faee..6644cd5f 100644
--- a/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
+++ b/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
@@ -21,23 +21,23 @@ const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
return (
<Box flexDirection="column" borderStyle="round" borderColor={borderColor}>
{toolCalls.map((tool) => (
- <React.Fragment key={tool.callId}>
- <ToolMessage
- key={tool.callId} // Use callId as the key
- name={tool.name}
- description={tool.description}
- resultDisplay={tool.resultDisplay}
- status={tool.status}
- />
- {tool.status === ToolCallStatus.Confirming &&
- tool.confirmationDetails && (
- <ToolConfirmationMessage
- confirmationDetails={tool.confirmationDetails}
- onSubmit={onSubmit}
- ></ToolConfirmationMessage>
- )}
- </React.Fragment>
- ))}
+ <React.Fragment key={tool.callId}>
+ <ToolMessage
+ key={tool.callId} // Use callId as the key
+ name={tool.name}
+ description={tool.description}
+ resultDisplay={tool.resultDisplay}
+ status={tool.status}
+ />
+ {tool.status === ToolCallStatus.Confirming &&
+ tool.confirmationDetails && (
+ <ToolConfirmationMessage
+ confirmationDetails={tool.confirmationDetails}
+ onSubmit={onSubmit}
+ ></ToolConfirmationMessage>
+ )}
+ </React.Fragment>
+ ))}
{/* Optional: Add padding below the last item if needed,
though ToolMessage already has some vertical space implicitly */}
{/* {tools.length > 0 && <Box height={1} />} */}
diff --git a/packages/cli/src/ui/hooks/useAppEffects.ts b/packages/cli/src/ui/hooks/useAppEffects.ts
index 16f862b0..7bd7c6d6 100644
--- a/packages/cli/src/ui/hooks/useAppEffects.ts
+++ b/packages/cli/src/ui/hooks/useAppEffects.ts
@@ -58,4 +58,4 @@ export function useInitializationErrorEffect(
]);
}
}, [initError, history, setHistory]); // Include setHistory in dependency array
-} \ No newline at end of file
+}
diff --git a/packages/cli/src/ui/hooks/useGeminiStream.ts b/packages/cli/src/ui/hooks/useGeminiStream.ts
index f97f5e27..7fffa3fe 100644
--- a/packages/cli/src/ui/hooks/useGeminiStream.ts
+++ b/packages/cli/src/ui/hooks/useGeminiStream.ts
@@ -3,7 +3,10 @@ import { useInput } from 'ink';
import { GeminiClient } from '../../core/gemini-client.js';
import { type Chat, type PartListUnion } from '@google/genai';
import { HistoryItem } from '../types.js';
-import { processGeminiStream , StreamingState } from '../../core/gemini-stream.js';
+import {
+ processGeminiStream,
+ StreamingState,
+} from '../../core/gemini-stream.js';
import { globalConfig } from '../../config/config.js';
import { getErrorMessage, isNodeError } from '../../utils/errors.js';
diff --git a/packages/cli/src/utils/BackgroundTerminalAnalyzer.ts b/packages/cli/src/utils/BackgroundTerminalAnalyzer.ts
index 10448859..ae02e571 100644
--- a/packages/cli/src/utils/BackgroundTerminalAnalyzer.ts
+++ b/packages/cli/src/utils/BackgroundTerminalAnalyzer.ts
@@ -14,7 +14,7 @@ export interface AiClient {
generateJson(
prompt: Content[], // Keep flexible or define a stricter prompt structure type
schema: SchemaUnion,
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
): Promise<any>; // Ideally, specify the expected JSON structure TAnalysisResult | TAnalysisFailure
}
@@ -127,10 +127,14 @@ export class BackgroundTerminalAnalyzer {
// Reread files one last time in case output was written just before exit
try {
currentStdout = await fs.readFile(tempStdoutFilePath, 'utf-8');
- } catch { /* ignore */ }
+ } catch {
+ /* ignore */
+ }
try {
currentStderr = await fs.readFile(tempStderrFilePath, 'utf-8');
- } catch { /* ignore */ }
+ } catch {
+ /* ignore */
+ }
lastAnalysisResult = await this.analyzeOutputWithLLM(
currentStdout,
diff --git a/packages/cli/src/utils/errors.ts b/packages/cli/src/utils/errors.ts
index 7708895a..a7fcc5a3 100644
--- a/packages/cli/src/utils/errors.ts
+++ b/packages/cli/src/utils/errors.ts
@@ -1,18 +1,18 @@
export function isNodeError(error: unknown): error is NodeJS.ErrnoException {
- return error instanceof Error && 'code' in error;
+ return error instanceof Error && 'code' in error;
}
export function getErrorMessage(error: unknown): string {
- if (error instanceof Error) {
- return error.message;
- } else {
- // Attempt to convert the non-Error value to a string for logging
- try {
- const errorMessage = String(error);
- return errorMessage;
- } catch {
- // If String() itself fails (highly unlikely)
- return 'Failed to get error details';
- }
- }
-} \ No newline at end of file
+ if (error instanceof Error) {
+ return error.message;
+ } else {
+ // Attempt to convert the non-Error value to a string for logging
+ try {
+ const errorMessage = String(error);
+ return errorMessage;
+ } catch {
+ // If String() itself fails (highly unlikely)
+ return 'Failed to get error details';
+ }
+ }
+}
diff --git a/packages/cli/src/utils/getFolderStructure.ts b/packages/cli/src/utils/getFolderStructure.ts
index 8192fc96..42d6bbc3 100644
--- a/packages/cli/src/utils/getFolderStructure.ts
+++ b/packages/cli/src/utils/getFolderStructure.ts
@@ -137,7 +137,10 @@ async function readFullStructure(
folderInfo.subFolders.length +
folderInfo.subFolders.reduce((sum, sf) => sum + sf.totalChildren, 0);
} catch (error: unknown) {
- if (isNodeError(error) && (error.code === 'EACCES' || error.code === 'ENOENT')) {
+ if (
+ isNodeError(error) &&
+ (error.code === 'EACCES' || error.code === 'ENOENT')
+ ) {
console.warn(
`Warning: Could not read directory ${folderPath}: ${error.message}`,
);
@@ -345,10 +348,7 @@ export async function getFolderStructure(
}
// 2. Reduce the structure (handles ignored folders specifically)
- const reducedRoot = reduceStructure(
- fullInfo,
- mergedOptions.maxItems,
- );
+ const reducedRoot = reduceStructure(fullInfo, mergedOptions.maxItems);
// 3. Count items in the *reduced* structure for the summary
const rootNodeItselfCount = 0; // Don't count the root node in the items summary
diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json
index 1571716d..faebbc1b 100644
--- a/packages/cli/tsconfig.json
+++ b/packages/cli/tsconfig.json
@@ -13,7 +13,5 @@
},
"exclude": ["node_modules", "dist"],
"include": ["src"],
- "references": [
- { "path": "../server" },
- ]
+ "references": [{ "path": "../server" }]
}
diff --git a/packages/server/package.json b/packages/server/package.json
index 4e227105..3781aa5a 100644
--- a/packages/server/package.json
+++ b/packages/server/package.json
@@ -1,24 +1,23 @@
{
- "name": "@gemini-code/server",
- "version": "1.0.0",
- "description": "Gemini Code Server",
- "type": "module",
- "main": "src/index.js",
- "scripts": {
- "build": "tsc && cp package.json dist/",
- "clean": "rm -rf dist",
- "lint": "eslint . --ext .ts,.tsx",
- "format": "prettier --write ."
- },
- "files": [
- "dist"
- ],
- "dependencies": {},
- "devDependencies": {
- "typescript": "^5.3.3"
- },
- "engines": {
- "node": ">=18"
- }
+ "name": "@gemini-code/server",
+ "version": "1.0.0",
+ "description": "Gemini Code Server",
+ "type": "module",
+ "main": "src/index.js",
+ "scripts": {
+ "build": "tsc && cp package.json dist/",
+ "clean": "rm -rf dist",
+ "lint": "eslint . --ext .ts,.tsx",
+ "format": "prettier --write ."
+ },
+ "files": [
+ "dist"
+ ],
+ "dependencies": {},
+ "devDependencies": {
+ "typescript": "^5.3.3"
+ },
+ "engines": {
+ "node": ">=18"
}
- \ No newline at end of file
+}
diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts
index 16b131d8..8014d0c4 100644
--- a/packages/server/src/index.ts
+++ b/packages/server/src/index.ts
@@ -1,3 +1,3 @@
export function helloServer() {
- // TODO: add more things in this package
-} \ No newline at end of file
+ // TODO: add more things in this package
+}
diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json
index addfdb11..b0b6e067 100644
--- a/packages/server/tsconfig.json
+++ b/packages/server/tsconfig.json
@@ -1,13 +1,12 @@
{
- "extends": "../../tsconfig.json",
- "compilerOptions": {
- "outDir": "dist",
- "rootDir": ".",
- "lib": ["DOM", "DOM.Iterable", "ES2020"],
- "module": "Node16",
- "target": "ES2022",
- "composite": true,
- },
- "exclude": ["node_modules", "dist"],
+ "extends": "../../tsconfig.json",
+ "compilerOptions": {
+ "outDir": "dist",
+ "rootDir": ".",
+ "lib": ["DOM", "DOM.Iterable", "ES2020"],
+ "module": "Node16",
+ "target": "ES2022",
+ "composite": true
+ },
+ "exclude": ["node_modules", "dist"]
}
- \ No newline at end of file
diff --git a/scripts/check-build-status.js b/scripts/check-build-status.js
index fd38d003..37638e72 100644
--- a/scripts/check-build-status.js
+++ b/scripts/check-build-status.js
@@ -6,7 +6,10 @@ import os from 'os'; // Import os module
const cliPackageDir = path.resolve('packages', 'cli'); // Base directory for the CLI package
const buildTimestampPath = path.join(cliPackageDir, 'dist', '.last_build'); // Path to the timestamp file within the CLI package
const sourceDirs = [path.join(cliPackageDir, 'src')]; // Source directory within the CLI package
-const filesToWatch = [path.join(cliPackageDir, 'package.json'), path.join(cliPackageDir, 'tsconfig.json')]; // Specific files within the CLI package
+const filesToWatch = [
+ path.join(cliPackageDir, 'package.json'),
+ path.join(cliPackageDir, 'tsconfig.json'),
+]; // Specific files within the CLI package
const buildDir = path.join(cliPackageDir, 'dist'); // Build output directory within the CLI package
const warningsFilePath = path.join(os.tmpdir(), 'gemini-code-cli-warnings.txt'); // Temp file for warnings
// ---------------------
@@ -28,7 +31,11 @@ function findSourceFiles(dir, allFiles = []) {
for (const entry of entries) {
const fullPath = path.join(dir, entry.name);
// Simple check to avoid recursing into node_modules or build dir itself
- if (entry.isDirectory() && entry.name !== 'node_modules' && fullPath !== buildDir) {
+ if (
+ entry.isDirectory() &&
+ entry.name !== 'node_modules' &&
+ fullPath !== buildDir
+ ) {
findSourceFiles(fullPath, allFiles);
} else if (entry.isFile()) {
allFiles.push(fullPath);
@@ -45,7 +52,9 @@ try {
fs.unlinkSync(warningsFilePath);
}
} catch (err) {
- console.warn(`[Check Script] Warning: Could not delete previous warnings file: ${err.message}`);
+ console.warn(
+ `[Check Script] Warning: Could not delete previous warnings file: ${err.message}`,
+ );
}
const buildMtime = getMtime(buildTimestampPath);
@@ -56,7 +65,9 @@ if (!buildMtime) {
try {
fs.writeFileSync(warningsFilePath, errorMessage);
} catch (writeErr) {
- console.error(`[Check Script] Error writing missing build warning file: ${writeErr.message}`);
+ console.error(
+ `[Check Script] Error writing missing build warning file: ${writeErr.message}`,
+ );
}
process.exit(0); // Allow app to start and show the error
}
@@ -67,25 +78,24 @@ const allSourceFiles = [];
// Collect files from specified directories
sourceDirs.forEach((dir) => {
- const dirPath = path.resolve(dir);
- if (fs.existsSync(dirPath)) {
- findSourceFiles(dirPath, allSourceFiles);
- } else {
- console.warn(`Warning: Source directory "${dir}" not found.`);
- }
+ const dirPath = path.resolve(dir);
+ if (fs.existsSync(dirPath)) {
+ findSourceFiles(dirPath, allSourceFiles);
+ } else {
+ console.warn(`Warning: Source directory "${dir}" not found.`);
+ }
});
// Add specific files
filesToWatch.forEach((file) => {
- const filePath = path.resolve(file);
- if (fs.existsSync(filePath)) {
- allSourceFiles.push(filePath);
- } else {
- console.warn(`Warning: Watched file "${file}" not found.`);
- }
+ const filePath = path.resolve(file);
+ if (fs.existsSync(filePath)) {
+ allSourceFiles.push(filePath);
+ } else {
+ console.warn(`Warning: Watched file "${file}" not found.`);
+ }
});
-
// Check modification times
for (const file of allSourceFiles) {
const sourceMtime = getMtime(file);
@@ -102,7 +112,8 @@ for (const file of allSourceFiles) {
}
if (newerSourceFileFound) {
- const finalWarning = '\nRun "npm run build" to incorporate changes before starting.';
+ const finalWarning =
+ '\nRun "npm run build" to incorporate changes before starting.';
warningMessages.push(finalWarning);
console.warn(finalWarning);
@@ -118,12 +129,14 @@ if (newerSourceFileFound) {
console.log('Build is up-to-date.');
// Ensure no stale warning file exists if build is ok
try {
- if (fs.existsSync(warningsFilePath)) {
- fs.unlinkSync(warningsFilePath);
- }
+ if (fs.existsSync(warningsFilePath)) {
+ fs.unlinkSync(warningsFilePath);
+ }
} catch (err) {
- console.warn(`[Check Script] Warning: Could not delete previous warnings file: ${err.message}`);
+ console.warn(
+ `[Check Script] Warning: Could not delete previous warnings file: ${err.message}`,
+ );
}
}
-process.exit(0); // Always exit successfully so the app starts \ No newline at end of file
+process.exit(0); // Always exit successfully so the app starts
diff --git a/tsconfig.json b/tsconfig.json
index cdd593c2..729009fe 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -12,6 +12,6 @@
"target": "ES2020",
"module": "Node16",
"declaration": true,
- "moduleResolution": "node16",
+ "moduleResolution": "node16"
}
}