1
+ export interface Tool {
2
+ name : string ;
3
+ slug : string ;
4
+ description : string ;
5
+ category : string ;
6
+ pricing ?: string ;
7
+ features ?: string [ ] ;
8
+ pros ?: string [ ] ;
9
+ cons ?: string [ ] ;
10
+ website ?: string ;
11
+ }
12
+
13
+ // Mock tool data - in a real app this would come from a database or API
14
+ const tools : Tool [ ] = [
15
+ {
16
+ name : "GitHub Copilot" ,
17
+ slug : "github-copilot" ,
18
+ description : "AI-powered code completion and generation tool by GitHub" ,
19
+ category : "Code Generation" ,
20
+ pricing : "$10/month" ,
21
+ features : [ "Code completion" , "Code generation" , "Multi-language support" ] ,
22
+ pros : [ "Excellent IDE integration" , "High-quality suggestions" , "Large training dataset" ] ,
23
+ cons : [ "Subscription required" , "Privacy concerns" , "Can suggest outdated patterns" ] ,
24
+ website : "https://github.com/features/copilot"
25
+ } ,
26
+ {
27
+ name : "Cursor" ,
28
+ slug : "cursor" ,
29
+ description : "AI-first code editor built for pair programming with AI" ,
30
+ category : "Code Editor" ,
31
+ pricing : "$20/month" ,
32
+ features : [ "AI chat" , "Code editing" , "Codebase understanding" ] ,
33
+ pros : [ "Native AI integration" , "Codebase awareness" , "Modern interface" ] ,
34
+ cons : [ "Newer tool" , "Higher price" , "Learning curve" ] ,
35
+ website : "https://cursor.sh"
36
+ }
37
+ ] ;
38
+
39
+ export function getToolBySlug ( slug : string ) : Tool | undefined {
40
+ return tools . find ( tool => tool . slug === slug ) ;
41
+ }
42
+
43
+ export function getAllTools ( ) : Tool [ ] {
44
+ return tools ;
45
+ }
46
+
47
+ export function getToolComparison ( tool1Slug : string , tool2Slug : string ) {
48
+ const tool1 = getToolBySlug ( tool1Slug ) ;
49
+ const tool2 = getToolBySlug ( tool2Slug ) ;
50
+
51
+ if ( ! tool1 || ! tool2 ) {
52
+ return null ;
53
+ }
54
+
55
+ return {
56
+ tool1,
57
+ tool2,
58
+ comparisonTitle : `${ tool1 . name } vs ${ tool2 . name } ` ,
59
+ comparisonDescription : `Compare ${ tool1 . name } and ${ tool2 . name } to find the best AI development tool for your needs.`
60
+ } ;
61
+ }
62
+
63
+ export function generateComparisonSlug ( tool1 : string , tool2 : string ) : string {
64
+ return `${ tool1 } -vs-${ tool2 } ` ;
65
+ }
66
+
67
+ export function parseComparisonSlug ( slug : string ) : { tool1 : string ; tool2 : string } | null {
68
+ const parts = slug . split ( '-vs-' ) ;
69
+ if ( parts . length !== 2 ) {
70
+ return null ;
71
+ }
72
+ return {
73
+ tool1 : parts [ 0 ] ,
74
+ tool2 : parts [ 1 ]
75
+ } ;
76
+ }
0 commit comments