MCPcopy
hub / github.com/Jpisnice/shadcn-ui-mcp-server / getFramework

Function getFramework

src/utils/framework.ts:25–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23 * @returns The selected framework ('react' or 'svelte' or 'vue')
24 */
25export function getFramework(): Framework {
26 // Check command line arguments first
27 const args = process.argv.slice(2);
28 const frameworkIndex = args.findIndex(
29 (arg) => arg === "--framework" || arg === "-f"
30 );
31
32 if (frameworkIndex !== -1 && args[frameworkIndex + 1]) {
33 const framework = args[frameworkIndex + 1].toLowerCase() as Framework;
34 if (
35 framework === "react" ||
36 framework === "svelte" ||
37 framework === "vue" ||
38 framework === "react-native"
39 ) {
40 logInfo(`Framework set to '${framework}' via command line argument`);
41 return framework;
42 } else {
43 logWarning(
44 `Invalid framework '${framework}' specified. Using default '${DEFAULT_FRAMEWORK}'`
45 );
46 }
47 }
48
49 // Check environment variable
50 const envFramework = process.env.FRAMEWORK?.toLowerCase() as Framework;
51 if (
52 envFramework === "react" ||
53 envFramework === "svelte" ||
54 envFramework === "vue" ||
55 envFramework === "react-native"
56 ) {
57 logInfo(`Framework set to '${envFramework}' via environment variable`);
58 return envFramework;
59 }
60
61 // Return default
62 logInfo(`Using default framework: '${DEFAULT_FRAMEWORK}'`);
63 return DEFAULT_FRAMEWORK;
64}
65
66/**
67 * Get the axios implementation based on the current framework

Callers 7

handleGetBlockFunction · 0.85
handleListBlocksFunction · 0.85
getAxiosImplementationFunction · 0.85
getFrameworkInfoFunction · 0.85
getResourceTemplateFunction · 0.85
index.tsFile · 0.85

Calls 2

logInfoFunction · 0.85
logWarningFunction · 0.85

Tested by

no test coverage detected