mirror of
https://github.com/samsonjs/Peekaboo.git
synced 2026-03-25 09:25:47 +00:00
Fix ESLint violations for release preparation
- Remove unused imports and variables - Fix quote consistency and trailing commas - Remove non-null assertions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
020621582a
commit
57c277f4da
5 changed files with 22 additions and 23 deletions
|
|
@ -44,7 +44,7 @@ export const analyzeToolSchema = z.object({
|
|||
{
|
||||
message: "image_path is required",
|
||||
path: ["image_path"],
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
export type AnalyzeToolInput = z.infer<typeof analyzeToolSchema>;
|
||||
|
|
@ -57,8 +57,8 @@ export async function analyzeToolHandler(
|
|||
|
||||
try {
|
||||
// Determine the effective image path (prioritize image_path, fallback to path)
|
||||
const effectiveImagePath = input.image_path || input.path!;
|
||||
|
||||
const effectiveImagePath = input.image_path || input.path || "";
|
||||
|
||||
logger.debug(
|
||||
{ input: { ...input, effectiveImagePath: effectiveImagePath.split("/").pop() } },
|
||||
"Processing peekaboo.analyze tool call",
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import { performAutomaticAnalysis } from "../utils/image-analysis.js";
|
|||
import { buildImageSummary } from "../utils/image-summary.js";
|
||||
import { buildSwiftCliArgs, resolveImagePath } from "../utils/image-cli-args.js";
|
||||
import { parseAIProviders } from "../utils/ai-providers.js";
|
||||
import * as fs from "fs/promises";
|
||||
|
||||
export { imageToolSchema } from "../types/index.js";
|
||||
|
||||
|
|
@ -19,7 +18,7 @@ export async function imageToolHandler(
|
|||
context: ToolContext,
|
||||
): Promise<ToolResponse> {
|
||||
const { logger } = context;
|
||||
let tempDirUsed: string | undefined = undefined;
|
||||
let _tempDirUsed: string | undefined = undefined;
|
||||
let finalSavedFiles: SavedFile[] = [];
|
||||
let analysisAttempted = false;
|
||||
let analysisSucceeded = false;
|
||||
|
|
@ -34,7 +33,7 @@ export async function imageToolHandler(
|
|||
|
||||
// Resolve the effective path using the centralized logic
|
||||
const { effectivePath, tempDirUsed: tempDir } = await resolveImagePath(input, logger);
|
||||
tempDirUsed = tempDir;
|
||||
_tempDirUsed = tempDir;
|
||||
|
||||
const args = buildSwiftCliArgs(input, effectivePath, swiftFormat, logger);
|
||||
|
||||
|
|
@ -92,7 +91,7 @@ export async function imageToolHandler(
|
|||
if (input.question) {
|
||||
analysisAttempted = true;
|
||||
const analysisResults: Array<{ label: string; text: string }> = [];
|
||||
|
||||
|
||||
const configuredProviders = parseAIProviders(
|
||||
process.env.PEEKABOO_AI_PROVIDERS || "",
|
||||
);
|
||||
|
|
@ -106,7 +105,7 @@ export async function imageToolHandler(
|
|||
try {
|
||||
const imageBase64 = await readImageAsBase64(savedFile.path);
|
||||
logger.debug({ path: savedFile.path }, "Image read successfully for analysis.");
|
||||
|
||||
|
||||
const analysisResult = await performAutomaticAnalysis(
|
||||
imageBase64,
|
||||
input.question,
|
||||
|
|
@ -139,7 +138,7 @@ export async function imageToolHandler(
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Format the analysis results
|
||||
if (analysisResults.length === 1) {
|
||||
analysisText = analysisResults[0].text;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ export const listToolSchema = z
|
|||
.refine(
|
||||
(data) =>
|
||||
data.item_type !== "server_status" ||
|
||||
(data.app === undefined &&
|
||||
(data.app === undefined &&
|
||||
(data.include_window_details === undefined || data.include_window_details.length === 0)),
|
||||
{
|
||||
message:
|
||||
|
|
|
|||
|
|
@ -151,8 +151,8 @@ export const imageToolSchema = z.object({
|
|||
.describe(
|
||||
"Optional. Focus behavior. 'auto' (default): bring target to front only if not already active. " +
|
||||
"'background': capture without altering window focus. " +
|
||||
"'foreground': always bring target to front before capture."
|
||||
)
|
||||
"'foreground': always bring target to front before capture.",
|
||||
),
|
||||
),
|
||||
})
|
||||
.describe(
|
||||
|
|
|
|||
|
|
@ -58,22 +58,22 @@ function getInitializedSwiftCliPath(logger: Logger): string {
|
|||
function mapExitCodeToErrorMessage(
|
||||
exitCode: number,
|
||||
stderr: string,
|
||||
command: 'image' | 'list',
|
||||
command: "image" | "list",
|
||||
appTarget?: string,
|
||||
): { message: string, code: string } {
|
||||
): { message: string; code: string } {
|
||||
const defaultMessage = stderr.trim()
|
||||
? `Peekaboo CLI Error: ${stderr.trim()}`
|
||||
: `Swift CLI execution failed (exit code: ${exitCode})`;
|
||||
|
||||
? "Peekaboo CLI Error: " + stderr.trim()
|
||||
: "Swift CLI execution failed (exit code: " + exitCode + ")";
|
||||
|
||||
// Handle exit code 18 specially with command context
|
||||
if (exitCode === 18) {
|
||||
return {
|
||||
message: `The specified application ('${appTarget || 'unknown'}') is not running or could not be found.`,
|
||||
message: "The specified application ('" + (appTarget || "unknown") + "') is not running or could not be found.",
|
||||
code: "SWIFT_CLI_APP_NOT_FOUND",
|
||||
};
|
||||
}
|
||||
|
||||
const errorCodeMap: { [key: number]: { message: string, code: string } } = {
|
||||
|
||||
const errorCodeMap: { [key: number]: { message: string; code: string } } = {
|
||||
1: { message: "An unknown error occurred in the Swift CLI.", code: "SWIFT_CLI_UNKNOWN_ERROR" },
|
||||
7: { message: "The specified application is running but has no capturable windows. Try setting 'capture_focus' to 'foreground' to un-hide application windows.", code: "SWIFT_CLI_NO_WINDOWS_FOUND" },
|
||||
10: { message: "No displays available for capture.", code: "SWIFT_CLI_NO_DISPLAYS" },
|
||||
|
|
@ -153,11 +153,11 @@ export async function executeSwiftCli(
|
|||
);
|
||||
|
||||
// Determine command and app target from args
|
||||
const command = args[0] as 'image' | 'list';
|
||||
const command = args[0] as "image" | "list";
|
||||
let appTarget: string | undefined;
|
||||
|
||||
|
||||
// Find app target in args
|
||||
const appIndex = args.indexOf('--app');
|
||||
const appIndex = args.indexOf("--app");
|
||||
if (appIndex !== -1 && appIndex < args.length - 1) {
|
||||
appTarget = args[appIndex + 1];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue