Skip to content

Commit 9334cf7

Browse files
ericyangpanclaude
andcommitted
refactor(lib): remove unused utility functions and dead code
- Delete obsolete utility modules: faq.ts, manifesto.ts, product-utils.ts, runtime.ts, vendor-products.ts - Remove unused exports from landscape-data.ts (stats, relationships) - Remove unused exports from manifest-i18n.ts and pricing.ts - Reduce code bloat by ~580 lines 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent c1cb8ab commit 9334cf7

File tree

8 files changed

+0
-555
lines changed

8 files changed

+0
-555
lines changed

src/lib/faq.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/lib/landscape-data.ts

Lines changed: 0 additions & 258 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* This module aggregates and transforms manifest data for the /ai-coding-landscape page.
55
* It provides utilities for:
66
* - Building vendor-to-product mappings
7-
* - Calculating ecosystem statistics
8-
* - Creating relationship graphs between products
97
* - Extension-IDE compatibility mappings
108
*/
119

@@ -79,55 +77,6 @@ export interface ExtensionIDECompatibility {
7977
}>
8078
}
8179

82-
export interface LandscapeStats {
83-
totalProducts: number
84-
totalVendors: number
85-
counts: {
86-
ides: number
87-
clis: number
88-
extensions: number
89-
models: number
90-
providers: number
91-
}
92-
openSourceCount: number
93-
proprietaryCount: number
94-
platformSupport: {
95-
macOS: number
96-
windows: number
97-
linux: number
98-
}
99-
topByStars: Array<{
100-
id: string
101-
name: string
102-
category: ProductCategory
103-
stars: number
104-
}>
105-
vendorsByProductCount: Array<{
106-
vendorId: string
107-
vendorName: string
108-
productCount: number
109-
}>
110-
}
111-
112-
export interface RelationshipNode {
113-
id: string
114-
type: 'vendor' | ProductCategory
115-
data: {
116-
label: string
117-
description?: string
118-
category?: ProductCategory
119-
vendorId?: string
120-
}
121-
}
122-
123-
export interface RelationshipEdge {
124-
id: string
125-
source: string
126-
target: string
127-
type: 'vendor-product' | 'extension-ide' | 'related-product'
128-
label?: string
129-
}
130-
13180
// =============================================================================
13281
// DATA TRANSFORMATION HELPERS
13382
// =============================================================================
@@ -230,19 +179,6 @@ export function getAllProducts(): LandscapeProduct[] {
230179
return products
231180
}
232181

233-
/**
234-
* Get products grouped by category
235-
*/
236-
export function getProductsByCategory() {
237-
return {
238-
ides: idesData.map(ideToProduct),
239-
clis: clisData.map(cliToProduct),
240-
extensions: extensionsData.map(extensionToProduct),
241-
models: modelsData.map(modelToProduct),
242-
providers: providersData.map(providerToProduct),
243-
}
244-
}
245-
246182
/**
247183
* Get products by a specific vendor
248184
*/
@@ -396,200 +332,6 @@ export function buildExtensionIDECompatibility(): ExtensionIDECompatibility[] {
396332
return compatibilities
397333
}
398334

399-
/**
400-
* Calculate ecosystem statistics
401-
*/
402-
export function calculateLandscapeStats(): LandscapeStats {
403-
const allProducts = getAllProducts()
404-
405-
// Count by category
406-
const counts = {
407-
ides: idesData.length,
408-
clis: clisData.length,
409-
extensions: extensionsData.length,
410-
models: modelsData.length,
411-
providers: providersData.length,
412-
}
413-
414-
// License statistics
415-
let openSourceCount = 0
416-
let proprietaryCount = 0
417-
418-
;[...idesData, ...clisData, ...extensionsData].forEach(product => {
419-
if (product.license && product.license.toLowerCase() !== 'proprietary') {
420-
openSourceCount++
421-
} else {
422-
proprietaryCount++
423-
}
424-
})
425-
426-
// Platform support
427-
const platformSupport = {
428-
macOS: 0,
429-
windows: 0,
430-
linux: 0,
431-
}
432-
433-
;[...idesData, ...clisData].forEach(product => {
434-
if (product.platforms) {
435-
product.platforms.forEach(platform => {
436-
if (platform.os === 'macOS') platformSupport.macOS++
437-
if (platform.os === 'Windows') platformSupport.windows++
438-
if (platform.os === 'Linux') platformSupport.linux++
439-
})
440-
}
441-
})
442-
443-
// Top by GitHub stars
444-
const productsWithStars = allProducts
445-
.filter(p => p.githubStars && p.githubStars > 0)
446-
.map(p => ({
447-
id: p.id,
448-
name: p.name,
449-
category: p.category,
450-
stars: p.githubStars!,
451-
}))
452-
.sort((a, b) => b.stars - a.stars)
453-
.slice(0, 10)
454-
455-
// Vendors by product count
456-
const vendorProductCounts = new Map<string, { name: string; count: number }>()
457-
458-
allProducts.forEach(product => {
459-
const existing = vendorProductCounts.get(product.vendor)
460-
if (existing) {
461-
existing.count++
462-
} else {
463-
vendorProductCounts.set(product.vendor, {
464-
name: product.vendor,
465-
count: 1,
466-
})
467-
}
468-
})
469-
470-
const vendorsByProductCount = Array.from(vendorProductCounts.entries())
471-
.map(([id, data]) => ({
472-
vendorId: id.toLowerCase().replace(/\s+/g, '-'),
473-
vendorName: data.name,
474-
productCount: data.count,
475-
}))
476-
.sort((a, b) => b.productCount - a.productCount)
477-
478-
return {
479-
totalProducts: allProducts.length,
480-
totalVendors: vendorsData.length,
481-
counts,
482-
openSourceCount,
483-
proprietaryCount,
484-
platformSupport,
485-
topByStars: productsWithStars,
486-
vendorsByProductCount,
487-
}
488-
}
489-
490-
/**
491-
* Build relationship graph data for visualization
492-
*/
493-
export function buildRelationshipGraph(): {
494-
nodes: RelationshipNode[]
495-
edges: RelationshipEdge[]
496-
} {
497-
const nodes: RelationshipNode[] = []
498-
const edges: RelationshipEdge[] = []
499-
const nodeIds = new Set<string>()
500-
501-
// Add vendor nodes
502-
vendorsData.forEach(vendor => {
503-
const vendorNodeId = `vendor-${vendor.id}`
504-
nodes.push({
505-
id: vendorNodeId,
506-
type: 'vendor',
507-
data: {
508-
label: vendor.name,
509-
description: vendor.description,
510-
},
511-
})
512-
nodeIds.add(vendorNodeId)
513-
})
514-
515-
// Add product nodes and vendor-product edges
516-
const allProducts = getAllProducts()
517-
518-
allProducts.forEach(product => {
519-
const productNodeId = `${product.category}-${product.id}`
520-
521-
// Add product node
522-
if (!nodeIds.has(productNodeId)) {
523-
nodes.push({
524-
id: productNodeId,
525-
type: product.category,
526-
data: {
527-
label: product.name,
528-
description: product.description,
529-
category: product.category,
530-
vendorId: product.vendor.toLowerCase().replace(/\s+/g, '-'),
531-
},
532-
})
533-
nodeIds.add(productNodeId)
534-
}
535-
536-
// Add vendor-product edge
537-
const vendorNodeId = `vendor-${product.vendor.toLowerCase().replace(/\s+/g, '-')}`
538-
if (nodeIds.has(vendorNodeId)) {
539-
edges.push({
540-
id: `edge-${vendorNodeId}-${productNodeId}`,
541-
source: vendorNodeId,
542-
target: productNodeId,
543-
type: 'vendor-product',
544-
})
545-
}
546-
})
547-
548-
// Add extension-IDE compatibility edges
549-
const compatibilities = buildExtensionIDECompatibility()
550-
551-
compatibilities.forEach(compat => {
552-
const extensionNodeId = `extension-${compat.extensionId}`
553-
554-
compat.supportedIdes.forEach(ide => {
555-
const ideNodeId = `ide-${ide.ideId}`
556-
557-
if (nodeIds.has(extensionNodeId) && nodeIds.has(ideNodeId)) {
558-
edges.push({
559-
id: `edge-${extensionNodeId}-${ideNodeId}`,
560-
source: extensionNodeId,
561-
target: ideNodeId,
562-
type: 'extension-ide',
563-
label: 'supports',
564-
})
565-
}
566-
})
567-
})
568-
569-
// Add related product edges
570-
;[...idesData, ...clisData, ...extensionsData].forEach(product => {
571-
if (product.relatedProducts && product.relatedProducts.length > 0) {
572-
const sourceNodeId = `${product.id.includes('ide') ? 'ide' : product.id.includes('cli') ? 'cli' : 'extension'}-${product.id}`
573-
574-
product.relatedProducts.forEach(related => {
575-
const targetNodeId = `${related.type}-${related.productId}`
576-
577-
if (nodeIds.has(sourceNodeId) && nodeIds.has(targetNodeId)) {
578-
edges.push({
579-
id: `edge-${sourceNodeId}-${targetNodeId}`,
580-
source: sourceNodeId,
581-
target: targetNodeId,
582-
type: 'related-product',
583-
label: 'related to',
584-
})
585-
}
586-
})
587-
}
588-
})
589-
590-
return { nodes, edges }
591-
}
592-
593335
// =============================================================================
594336
// MATRIX DATA BUILDER
595337
// =============================================================================

src/lib/manifest-i18n.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,6 @@ export interface ManifestItemWithTranslations {
1616
[key: string]: unknown
1717
}
1818

19-
/**
20-
* Get localized field from a manifest item
21-
* @param item - The manifest item with potential translations
22-
* @param field - The field name to translate (e.g., 'description', 'name')
23-
* @param locale - The target locale (e.g., 'en', 'zh-Hans')
24-
* @returns The localized value or the original value if translation not found
25-
*/
26-
export function getLocalizedField<T extends ManifestItemWithTranslations>(
27-
item: T,
28-
field: keyof T,
29-
locale: Locale
30-
): string {
31-
// If locale is default, return the original field
32-
if (locale === defaultLocale) {
33-
return item[field] as string
34-
}
35-
36-
// Check if translations exist for this locale
37-
const translation = item.translations?.[locale]
38-
if (translation && field in translation && translation[field as string]) {
39-
return translation[field as string] as string
40-
}
41-
42-
// Fallback to original field
43-
return item[field] as string
44-
}
45-
4619
/**
4720
* Apply localization to a manifest item
4821
* @param item - The manifest item with potential translations

src/lib/manifesto.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/lib/pricing.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,3 @@ export function formatPrice(tier: PricingTier): string {
3939

4040
return `${currencySymbol}${tier.value}${perText}`
4141
}
42-
43-
/**
44-
* Extract price value for Schema.org structured data
45-
* Returns a string representation of the price value
46-
*/
47-
export function getSchemaPrice(tier: PricingTier): string {
48-
if (tier.value === null || tier.value === 0) {
49-
return '0'
50-
}
51-
return tier.value.toString()
52-
}
53-
54-
/**
55-
* Get currency code for Schema.org structured data
56-
* Defaults to USD if not specified
57-
*/
58-
export function getSchemaCurrency(tier: PricingTier): string {
59-
return tier.currency || 'USD'
60-
}

0 commit comments

Comments
 (0)