Refactor Git to accept a nostr object

This commit is contained in:
Alex Gleason committed 2025-09-21 14:31:13 -05:00
1 parent f797ec55c5
commit 69c1000063
16 files changed
+184 -379

No files matched your search

+1 -1
View File
@@ -75,8 +75,8 @@ export function ActionsMenu({
const navigate = useNavigate();
const projectsManager = useProjectsManager();
const { toast } = useToast();
const git = useGit();
const { fs } = useFS();
const { git } = useGit();
const isAnyLoading = isLoading || isBuildLoading || isDeployLoading || isDeleting || isExporting;
+1 -1
View File
@@ -58,7 +58,7 @@ export function GitDialog({ projectId, children, open, onOpenChange }: GitDialog
const { data: gitStatus, refetch: refetchGitStatus } = useGitStatus(projectId);
const { settings } = useGitSettings();
const git = useGit();
const { git } = useGit();
const { toast } = useToast();
const projectPath = `/projects/${projectId}`;
+3 -3
View File
@@ -33,13 +33,13 @@ import { NostrReadNipsIndexTool } from '@/lib/tools/NostrReadNipsIndexTool';
import { NostrGenerateKindTool } from '@/lib/tools/NostrGenerateKindTool';
import { ShellTool } from '@/lib/tools/ShellTool';
import { TypecheckTool } from '@/lib/tools/TypecheckTool';
import { Git } from '@/lib/git';
import { toolToOpenAI } from '@/lib/tools/openai-adapter';
import { Tool } from '@/lib/tools/Tool';
import OpenAI from 'openai';
import { makeSystemPrompt } from '@/lib/system';
import { assistantContentEmpty } from '@/lib/ai-messages';
import { saveFileToTmp } from '@/lib/fileUtils';
import { useGit } from '@/hooks/useGit';
interface ChatPaneProps {
projectId: string;
@@ -94,13 +94,13 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
const [searchParams, setSearchParams] = useSearchParams();
const { fs } = useFS();
const { git } = useGit();
const { user, metadata } = useCurrentUser();
const { models } = useProviderModels();
// Initialize AI chat with tools
const cwd = `/projects/${projectId}`;
const customTools = useMemo(() => {
const git = new Git(fs);
const baseTools = {
git_commit: new GitCommitTool(fs, cwd, git),
text_editor_view: new TextEditorViewTool(fs, cwd),
@@ -129,7 +129,7 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
}
return baseTools;
}, [fs, cwd, user, projectId]);
}, [fs, git, cwd, user, projectId]);
// Convert tools to OpenAI format
const tools = useMemo(() => {
+1 -1
View File
@@ -43,8 +43,8 @@ export function GitHistoryDialog({ projectId, open: controlledOpen, onOpenChange
const setIsOpen = onOpenChange || setInternalOpen;
const [isRollingBack, setIsRollingBack] = useState<string | null>(null);
const [expandedCommits, setExpandedCommits] = useState<Set<string>>(new Set());
const git = useGit();
const { fs } = useFS();
const { git } = useGit();
const { toast } = useToast();
const loadGitHistory = useCallback(async () => {