MCPcopy Create free account
hub / github.com/Sagyam/linite / quickCheck

Function quickCheck

scripts/package-discovery/quick-check.ts:47–103  ·  view source on GitHub ↗
(appSlug: string)

Source from the content-addressed store, hash-verified

45}
46
47function quickCheck(appSlug: string) {
48 const apps = loadApps();
49 const app = apps.find(a => a.slug === appSlug);
50
51 if (!app) {
52 console.error(`\nApp not found: ${appSlug}`);
53 console.log('\nSuggestions:');
54 const similar = apps.filter(a =>
55 a.slug.includes(appSlug) || a.displayName.toLowerCase().includes(appSlug.toLowerCase())
56 );
57 similar.slice(0, 5).forEach(a => console.log(` - ${a.slug} (${a.displayName})`));
58 process.exit(1);
59 }
60
61 console.log(`\n${'='.repeat(80)}`);
62 console.log(`App: ${app.displayName}`);
63 console.log(`Slug: ${app.slug}`);
64 console.log(`Category: ${app.category}`);
65 console.log('='.repeat(80));
66
67 const sources = ['flatpak', 'snap', 'aur', 'apt', 'dnf', 'pacman', 'zypper', 'homebrew', 'nix', 'script'];
68 const results: Array<{ source: string; has: boolean; identifier?: string }> = [];
69
70 for (const source of sources) {
71 const packages = loadPackages(source);
72 const pkg = packages.get(appSlug);
73
74 results.push({
75 source,
76 has: !!pkg,
77 identifier: pkg?.identifier,
78 });
79 }
80
81 console.log('\nPackage Availability:\n');
82
83 const maxSourceLength = Math.max(...sources.map(s => s.length));
84
85 results.forEach(({ source, has, identifier }) => {
86 const status = has ? '✅' : '❌';
87 const info = identifier ? `: ${identifier}` : '';
88 console.log(` ${status} ${source.padEnd(maxSourceLength)}${info}`);
89 });
90
91 const available = results.filter(r => r.has).length;
92 const total = results.length;
93 const percentage = Math.round((available / total) * 100);
94
95 console.log(`\nCoverage: ${available}/${total} sources (${percentage}%)`);
96
97 if (available < total) {
98 console.log('\nMissing from:');
99 results
100 .filter(r => !r.has)
101 .forEach(r => console.log(` - ${r.source}`));
102 }
103}
104

Callers 1

mainFunction · 0.85

Calls 3

loadAppsFunction · 0.70
loadPackagesFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected