mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
Remove fake Typecheck tool
This commit is contained in:
5 files changed
+2
-93
No files matched your search
@@ -38,7 +38,6 @@ Shakespeare provides AI agents with specialized tools for project development (n
|
|||||||
- **TextEditorWriteTool**: Create or overwrite files with new content
|
- **TextEditorWriteTool**: Create or overwrite files with new content
|
||||||
- **TextEditorStrReplaceTool**: Replace strings in files
|
- **TextEditorStrReplaceTool**: Replace strings in files
|
||||||
- **BuildProjectTool**: Build and compile projects
|
- **BuildProjectTool**: Build and compile projects
|
||||||
- **TypecheckTool**: Run TypeScript type checking
|
|
||||||
- **NpmAddPackageTool**: Add npm packages to projects
|
- **NpmAddPackageTool**: Add npm packages to projects
|
||||||
- **NpmRemovePackageTool**: Remove npm packages from projects
|
- **NpmRemovePackageTool**: Remove npm packages from projects
|
||||||
- **GitCommitTool**: Commit changes to Git repositories
|
- **GitCommitTool**: Commit changes to Git repositories
|
||||||
@@ -241,7 +240,7 @@ This project is a Nostr client application built with React 18.x, TailwindCSS 3.
|
|||||||
- Unix-style commands: `cat`, `cd`, `cp`, `find`, `grep`, `ls`, `mkdir`, `mv`, `rm`, etc.
|
- Unix-style commands: `cat`, `cd`, `cp`, `find`, `grep`, `ls`, `mkdir`, `mv`, `rm`, etc.
|
||||||
- `/src/lib/tools/`: AI tool implementations for project development
|
- `/src/lib/tools/`: AI tool implementations for project development
|
||||||
- File operations: `TextEditorViewTool`, `TextEditorWriteTool`, `TextEditorStrReplaceTool`
|
- File operations: `TextEditorViewTool`, `TextEditorWriteTool`, `TextEditorStrReplaceTool`
|
||||||
- Project tools: `BuildProjectTool`, `TypecheckTool`, `DeployProjectTool`
|
- Project tools: `BuildProjectTool`, `DeployProjectTool`
|
||||||
- Package management: `NpmAddPackageTool`, `NpmRemovePackageTool`
|
- Package management: `NpmAddPackageTool`, `NpmRemovePackageTool`
|
||||||
- Git integration: `GitCommitTool`
|
- Git integration: `GitCommitTool`
|
||||||
- Shell access: `ShellTool`
|
- Shell access: `ShellTool`
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { memo, useState } from 'react';
|
import { memo, useState } from 'react';
|
||||||
import { Streamdown } from 'streamdown';
|
import { Streamdown } from 'streamdown';
|
||||||
import { Wrench, Eye, FileText, Edit, Package, PackageMinus, GitCommit, BookOpen, Download, Hash, Tag, Network, List, Plus, Terminal, Globe, CheckCircle, Lightbulb, Loader2, Logs, Send, Puzzle } from 'lucide-react';
|
import { Wrench, Eye, FileText, Edit, Package, PackageMinus, GitCommit, BookOpen, Download, Hash, Tag, Network, List, Plus, Terminal, Globe, Lightbulb, Loader2, Logs, Send, Puzzle } from 'lucide-react';
|
||||||
import type { AIMessage } from '@/lib/SessionManager';
|
import type { AIMessage } from '@/lib/SessionManager';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { UserMessage } from '@/components/UserMessage';
|
import { UserMessage } from '@/components/UserMessage';
|
||||||
@@ -156,11 +156,6 @@ export const AIMessageItem = memo(({
|
|||||||
icon: Globe,
|
icon: Globe,
|
||||||
title: args.deployServer ? `Deployed to ${args.deployServer}` : 'Deployed Project'
|
title: args.deployServer ? `Deployed to ${args.deployServer}` : 'Deployed Project'
|
||||||
};
|
};
|
||||||
case 'typecheck':
|
|
||||||
return {
|
|
||||||
icon: CheckCircle,
|
|
||||||
title: 'TypeScript'
|
|
||||||
};
|
|
||||||
case 'read_console_messages':
|
case 'read_console_messages':
|
||||||
return {
|
return {
|
||||||
icon: Logs,
|
icon: Logs,
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import { NostrReadNipsIndexTool } from '@/lib/tools/NostrReadNipsIndexTool';
|
|||||||
import { NostrGenerateKindTool } from '@/lib/tools/NostrGenerateKindTool';
|
import { NostrGenerateKindTool } from '@/lib/tools/NostrGenerateKindTool';
|
||||||
import { NostrPublishEventsTool } from '@/lib/tools/NostrPublishEventsTool';
|
import { NostrPublishEventsTool } from '@/lib/tools/NostrPublishEventsTool';
|
||||||
import { ShellTool } from '@/lib/tools/ShellTool';
|
import { ShellTool } from '@/lib/tools/ShellTool';
|
||||||
import { TypecheckTool } from '@/lib/tools/TypecheckTool';
|
|
||||||
import { ReadConsoleMessagesTool } from '@/lib/tools/ReadConsoleMessagesTool';
|
import { ReadConsoleMessagesTool } from '@/lib/tools/ReadConsoleMessagesTool';
|
||||||
import { SkillTool } from '@/lib/tools/SkillTool';
|
import { SkillTool } from '@/lib/tools/SkillTool';
|
||||||
import { createMCPTools } from '@/lib/tools/MCPTool';
|
import { createMCPTools } from '@/lib/tools/MCPTool';
|
||||||
@@ -166,7 +165,6 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
|||||||
npm_add_package: new NpmAddPackageTool(fs, cwd),
|
npm_add_package: new NpmAddPackageTool(fs, cwd),
|
||||||
npm_remove_package: new NpmRemovePackageTool(fs, cwd),
|
npm_remove_package: new NpmRemovePackageTool(fs, cwd),
|
||||||
build_project: new BuildProjectTool(fs, cwd, esmUrlRef.current),
|
build_project: new BuildProjectTool(fs, cwd, esmUrlRef.current),
|
||||||
typecheck: new TypecheckTool(fs, cwd),
|
|
||||||
nostr_read_nip: new NostrReadNipTool(),
|
nostr_read_nip: new NostrReadNipTool(),
|
||||||
nostr_fetch_event: new NostrFetchEventTool(),
|
nostr_fetch_event: new NostrFetchEventTool(),
|
||||||
nostr_read_kind: new NostrReadKindTool(),
|
nostr_read_kind: new NostrReadKindTool(),
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
||||||
import { TypecheckTool } from './TypecheckTool';
|
|
||||||
import type { JSRuntimeFS } from '../JSRuntime';
|
|
||||||
|
|
||||||
describe('TypecheckTool', () => {
|
|
||||||
let mockFS: JSRuntimeFS;
|
|
||||||
let tool: TypecheckTool;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
vi.clearAllMocks();
|
|
||||||
|
|
||||||
mockFS = {
|
|
||||||
readFile: vi.fn(),
|
|
||||||
} as unknown as JSRuntimeFS;
|
|
||||||
|
|
||||||
tool = new TypecheckTool(mockFS, '/test/project');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have correct description', () => {
|
|
||||||
expect(tool.description).toBe('Run TypeScript type checking on the project to verify there are no type errors.');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should fail if tsconfig.json does not exist', async () => {
|
|
||||||
vi.mocked(mockFS.readFile).mockRejectedValue(new Error('File not found'));
|
|
||||||
|
|
||||||
await expect(tool.execute()).rejects.toThrow(
|
|
||||||
'❌ Could not find tsconfig.json at /test/project. Make sure you\'re in a valid TypeScript project.'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should successfully return no type errors (stub implementation)', async () => {
|
|
||||||
vi.mocked(mockFS.readFile).mockResolvedValue('{"compilerOptions": {}}'); // tsconfig.json exists
|
|
||||||
|
|
||||||
const result = await tool.execute();
|
|
||||||
|
|
||||||
expect(result).toContain('✅ No type errors found.');
|
|
||||||
expect(result).toContain('🔍 TypeScript compilation completed successfully.');
|
|
||||||
expect(result).toContain('📁 Project: /test/project');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should handle file system errors gracefully', async () => {
|
|
||||||
vi.mocked(mockFS.readFile).mockRejectedValue(new Error('Permission denied'));
|
|
||||||
|
|
||||||
await expect(tool.execute()).rejects.toThrow(
|
|
||||||
'❌ Could not find tsconfig.json at /test/project. Make sure you\'re in a valid TypeScript project.'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
import type { Tool } from "./Tool";
|
|
||||||
import type { JSRuntimeFS } from "../JSRuntime";
|
|
||||||
|
|
||||||
export class TypecheckTool implements Tool<void> {
|
|
||||||
private fs: JSRuntimeFS;
|
|
||||||
private cwd: string;
|
|
||||||
|
|
||||||
readonly description = "Run TypeScript type checking on the project to verify there are no type errors.";
|
|
||||||
|
|
||||||
constructor(fs: JSRuntimeFS, cwd: string) {
|
|
||||||
this.fs = fs;
|
|
||||||
this.cwd = cwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
async execute(): Promise<string> {
|
|
||||||
// TODO: Add actual typechecking functionality
|
|
||||||
// This should run TypeScript compiler in --noEmit mode to check for type errors
|
|
||||||
// Similar to how the test script runs: tsc --noEmit
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Check if we're in a valid TypeScript project
|
|
||||||
try {
|
|
||||||
await this.fs.readFile(`${this.cwd}/tsconfig.json`, "utf8");
|
|
||||||
} catch {
|
|
||||||
throw new Error(`❌ Could not find tsconfig.json at ${this.cwd}. Make sure you're in a valid TypeScript project.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Implement actual TypeScript compilation check
|
|
||||||
// For now, return a success message as a stub
|
|
||||||
return "✅ No type errors found.\n\n🔍 TypeScript compilation completed successfully.\n📁 Project: " + this.cwd;
|
|
||||||
} catch (error) {
|
|
||||||
throw new Error(`❌ Type check failed: ${String(error)}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user