-
-
-
-
-
Docker Build Debugger
-
Analyze errors and get instant solutions
+
+
+
+
+
+
+
+
+
DevTools Hub
+
Your developer toolkit
+
+
+
+
+
+
+
+
+ Navigation
+
+
+
+
-
-
-
-
- Log Analyzer
- Analyze
-
-
-
- Knowledge Base
- Knowledge
-
-
-
-
-
-
-
-
-
-
- Paste Build Log
-
-
- Copy your Docker build output and paste it below for analysis
-
-
-
-
-
-
-
-
-
- {parsedErrors.length > 0 && (
-
- {parsedErrors.map((error, index) => (
-
-
-
-
-
-
- Error #{index + 1}
-
- {error.type}
-
- {error.exitCode && (
-
- Exit Code: {error.exitCode}
-
- )}
- {error.stage && (
-
- {error.stage}
-
- )}
-
-
{error.message}
-
-
-
-
- {error.context.length > 0 && (
-
-
-
- Error Context
-
-
-
- {error.context.join('\n')}
-
-
-
- )}
-
-
-
-
-
-
- Recommended Solutions
-
-
- {getSolutionsForError(error).map((solution, sIndex) => (
-
-
-
-
- {solution.title}
-
- {solution.description}
-
-
-
-
Steps:
-
- {solution.steps.map((step, stepIndex) => (
- - {step}
- ))}
-
-
- {solution.code && (
-
-
-
Code:
-
-
-
-
- {solution.code}
-
-
- {solution.codeLanguage && (
-
- Language: {solution.codeLanguage}
-
- )}
-
- )}
-
-
-
- ))}
-
-
-
-
- ))}
-
- )}
-
-
-
-
-
-
-
-
- Search Knowledge Base
-
-
- Browse common Docker build errors and their solutions
-
-
-
-
-
- setSearchQuery(e.target.value)}
- placeholder="Search errors, categories, or keywords..."
- className="w-full pl-10 pr-4 py-3 rounded-lg border border-border/50 bg-secondary/50 text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-accent/20 focus:border-accent/50"
- />
-
-
-
-
-
- {filteredKnowledgeBase.map((item) => (
-
- setSelectedKbItem(item)}
- >
-
-
- {item.title}
-
- {item.category}
-
-
-
- {item.pattern}
-
-
-
-
- {item.explanation}
-
-
-
-
- ))}
+ {currentView === 'home' && (
+
+
+
Welcome to DevTools Hub
+
+ Select a tool from the menu to get started
+
- {filteredKnowledgeBase.length === 0 && (
-
-
- No results found for "{searchQuery}". Try different keywords.
-
-
- )}
+
+
handleNavigation('docker-debugger')}
+ >
+
+
+
+
+
+
Docker Build Debugger
+
+
+ Analyze Docker build errors and get instant solutions with an intelligent knowledge base
+
+
+
+
+ Paste your build logs and get detailed error analysis with recommended fixes
+
+
+
+
+
+ )}
-
- {selectedKbItem && (
- setSelectedKbItem(null)}
- >
- e.stopPropagation()}
- className="w-full max-w-3xl max-h-[90vh] overflow-auto"
- >
-
-
-
-
-
- {selectedKbItem.category}
- {selectedKbItem.title}
-
-
- Pattern: {selectedKbItem.pattern}
-
-
-
-
-
-
-
-
Explanation
-
- {selectedKbItem.explanation}
-
-
-
-
-
-
-
-
- Solutions
-
-
- {selectedKbItem.solutions.map((solution, index) => (
-
-
-
- {solution.title}
-
- {solution.description}
-
-
-
-
Steps:
-
- {solution.steps.map((step, stepIndex) => (
- - {step}
- ))}
-
-
- {solution.code && (
-
-
-
Code:
-
-
-
-
- {solution.code}
-
-
-
- )}
-
-
- ))}
-
-
-
-
-
-
- )}
-
-
-
+ {currentView === 'docker-debugger' && (
+
+
+
Docker Build Debugger
+
+ Analyze errors and get instant solutions
+
+
+
+
+ )}
diff --git a/src/components/DockerBuildDebugger.tsx b/src/components/DockerBuildDebugger.tsx
new file mode 100644
index 0000000..5ee7b9f
--- /dev/null
+++ b/src/components/DockerBuildDebugger.tsx
@@ -0,0 +1,407 @@
+import { useState } from 'react'
+import { useKV } from '@github/spark/hooks'
+import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
+import { Button } from '@/components/ui/button'
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'
+import { Textarea } from '@/components/ui/textarea'
+import { Badge } from '@/components/ui/badge'
+import { ScrollArea } from '@/components/ui/scroll-area'
+import { Separator } from '@/components/ui/separator'
+import { Alert, AlertDescription } from '@/components/ui/alert'
+import { Terminal, Warning, CheckCircle, Copy, Code, MagnifyingGlass, Sparkle } from '@phosphor-icons/react'
+import { parseDockerLog, getSolutionsForError, knowledgeBase } from '@/lib/docker-parser'
+import { DockerError, KnowledgeBaseItem } from '@/types/docker'
+import { toast } from 'sonner'
+import { motion, AnimatePresence } from 'framer-motion'
+
+export function DockerBuildDebugger() {
+ const [logInput, setLogInput] = useKV
('docker-log-input', '')
+ const [parsedErrors, setParsedErrors] = useState([])
+ const [selectedKbItem, setSelectedKbItem] = useState(null)
+ const [searchQuery, setSearchQuery] = useState('')
+
+ const handleParse = () => {
+ if (!logInput.trim()) {
+ toast.error('Please paste a Docker build log first')
+ return
+ }
+
+ const errors = parseDockerLog(logInput)
+
+ if (errors.length === 0) {
+ toast.info('No errors detected in the log')
+ } else {
+ setParsedErrors(errors)
+ toast.success(`Found ${errors.length} error${errors.length > 1 ? 's' : ''}`)
+ }
+ }
+
+ const handleCopy = (text: string, label: string) => {
+ navigator.clipboard.writeText(text)
+ toast.success(`${label} copied to clipboard`)
+ }
+
+ const filteredKnowledgeBase = knowledgeBase.filter(item =>
+ item.title.toLowerCase().includes(searchQuery.toLowerCase()) ||
+ item.category.toLowerCase().includes(searchQuery.toLowerCase()) ||
+ item.explanation.toLowerCase().includes(searchQuery.toLowerCase())
+ )
+
+ return (
+
+
+
+
+
+ Log Analyzer
+ Analyze
+
+
+
+ Knowledge Base
+ Knowledge
+
+
+
+
+
+
+
+
+
+
+ Paste Build Log
+
+
+ Copy your Docker build output and paste it below for analysis
+
+
+
+
+
+
+
+
+
+ {parsedErrors.length > 0 && (
+
+ {parsedErrors.map((error, index) => (
+
+
+
+
+
+
+ Error #{index + 1}
+
+ {error.type}
+
+ {error.exitCode && (
+
+ Exit Code: {error.exitCode}
+
+ )}
+ {error.stage && (
+
+ {error.stage}
+
+ )}
+
+
{error.message}
+
+
+
+
+ {error.context.length > 0 && (
+
+
+
+ Error Context
+
+
+
+ {error.context.join('\n')}
+
+
+
+ )}
+
+
+
+
+
+
+ Recommended Solutions
+
+
+ {getSolutionsForError(error).map((solution, sIndex) => (
+
+
+
+
+ {solution.title}
+
+ {solution.description}
+
+
+
+
Steps:
+
+ {solution.steps.map((step, stepIndex) => (
+ - {step}
+ ))}
+
+
+ {solution.code && (
+
+
+
Code:
+
+
+
+
+ {solution.code}
+
+
+ {solution.codeLanguage && (
+
+ Language: {solution.codeLanguage}
+
+ )}
+
+ )}
+
+
+
+ ))}
+
+
+
+
+ ))}
+
+ )}
+
+
+
+
+
+
+
+
+ Search Knowledge Base
+
+
+ Browse common Docker build errors and their solutions
+
+
+
+
+
+ setSearchQuery(e.target.value)}
+ placeholder="Search errors, categories, or keywords..."
+ className="w-full pl-10 pr-4 py-3 rounded-lg border border-border/50 bg-secondary/50 text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-accent/20 focus:border-accent/50"
+ />
+
+
+
+
+
+ {filteredKnowledgeBase.map((item) => (
+
+ setSelectedKbItem(item)}
+ >
+
+
+ {item.title}
+
+ {item.category}
+
+
+
+ {item.pattern}
+
+
+
+
+ {item.explanation}
+
+
+
+
+ ))}
+
+
+ {filteredKnowledgeBase.length === 0 && (
+
+
+ No results found for "{searchQuery}". Try different keywords.
+
+
+ )}
+
+
+ {selectedKbItem && (
+ setSelectedKbItem(null)}
+ >
+ e.stopPropagation()}
+ className="w-full max-w-3xl max-h-[90vh] overflow-auto"
+ >
+
+
+
+
+
+ {selectedKbItem.category}
+ {selectedKbItem.title}
+
+
+ Pattern: {selectedKbItem.pattern}
+
+
+
+
+
+
+
+
Explanation
+
+ {selectedKbItem.explanation}
+
+
+
+
+
+
+
+
+ Solutions
+
+
+ {selectedKbItem.solutions.map((solution, index) => (
+
+
+
+ {solution.title}
+
+ {solution.description}
+
+
+
+
Steps:
+
+ {solution.steps.map((step, stepIndex) => (
+ - {step}
+ ))}
+
+
+ {solution.code && (
+
+
+
Code:
+
+
+
+
+ {solution.code}
+
+
+
+ )}
+
+
+ ))}
+
+
+
+
+
+
+ )}
+
+
+
+
+ )
+}