@fragments-sdk/mcp 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +122 -21
- package/dist/bin.js.map +1 -1
- package/dist/chunk-2W7DAUUS.js +107 -0
- package/dist/chunk-2W7DAUUS.js.map +1 -0
- package/dist/chunk-4SVS3AA3.js +78 -0
- package/dist/chunk-4SVS3AA3.js.map +1 -0
- package/dist/chunk-FGIBLPSU.js +29 -0
- package/dist/chunk-FGIBLPSU.js.map +1 -0
- package/dist/chunk-NVHGG7GW.js +630 -0
- package/dist/chunk-NVHGG7GW.js.map +1 -0
- package/dist/chunk-VRPDT3Y6.js +52 -0
- package/dist/chunk-VRPDT3Y6.js.map +1 -0
- package/dist/chunk-WBOVO43F.js +2481 -0
- package/dist/chunk-WBOVO43F.js.map +1 -0
- package/dist/config-TUFA5J2S.js +7 -0
- package/dist/config-TUFA5J2S.js.map +1 -0
- package/dist/constants-YXOTMY3I.js +9 -0
- package/dist/constants-YXOTMY3I.js.map +1 -0
- package/dist/dist-V7D67NXS.js +1093 -0
- package/dist/dist-V7D67NXS.js.map +1 -0
- package/dist/index.js +97 -0
- package/dist/index.js.map +1 -0
- package/dist/init.js +139 -0
- package/dist/init.js.map +1 -0
- package/dist/rules-WGBCECAK.js +7 -0
- package/dist/rules-WGBCECAK.js.map +1 -0
- package/dist/sass.node-4XJK6YBF-2NJM7G64.js +130796 -0
- package/dist/sass.node-4XJK6YBF-2NJM7G64.js.map +1 -0
- package/dist/server.js +3 -1
- package/package.json +22 -4
- package/dist/chunk-VHHXL3YB.js +0 -2274
- package/dist/chunk-VHHXL3YB.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../extract/src/component-extractor.ts","../../extract/src/auto-props.ts","../../extract/src/token-resolver.ts"],"sourcesContent":["/**\n * ComponentExtractor — persistent LanguageService-based prop extraction.\n *\n * Replaces auto-props.ts with:\n * - Persistent ts.LanguageService (not throwaway ts.createProgram())\n * - Incremental invalidation via projectVersion\n * - Compound component (Object.assign) sub-component prop extraction\n * - Full type serialization to PropMeta format\n *\n * Zero additional dependencies — uses raw TypeScript APIs.\n */\n\nimport ts from 'typescript';\nimport { existsSync, readFileSync, statSync, readdirSync } from 'node:fs';\nimport { resolve, dirname, join } from 'node:path';\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport interface ComponentExtractor {\n /** Extract metadata for a single component by export name */\n extract(filePath: string, exportName?: string): ComponentMeta | null;\n\n /** Extract all exported components found in a file */\n extractAll(filePath: string): ComponentMeta[];\n\n /** Notify extractor that a file changed (incremental) */\n invalidate(filePath: string): void;\n\n /** Clean up resources */\n dispose(): void;\n}\n\nexport interface ComponentMeta {\n name: string;\n filePath: string;\n description: string;\n props: Record<string, PropMeta>;\n composition: CompositionMeta | null;\n exports: string[];\n dependencies: string[];\n}\n\nexport interface PropMeta {\n name: string;\n type: string;\n typeKind: PropTypeKind;\n values?: string[];\n default?: string;\n description?: string;\n required: boolean;\n source: 'local' | 'inherited';\n}\n\nexport type PropTypeKind =\n | 'string' | 'number' | 'boolean'\n | 'enum'\n | 'function'\n | 'node'\n | 'element'\n | 'object' | 'array'\n | 'union'\n | 'custom';\n\nexport interface CompositionMeta {\n pattern: 'compound' | 'controlled' | 'simple';\n parts: PartMeta[];\n required: string[];\n}\n\nexport interface PartMeta {\n name: string;\n props: Record<string, PropMeta>;\n}\n\n// ---------------------------------------------------------------------------\n// Internal types\n// ---------------------------------------------------------------------------\n\ninterface ResolvedComponent {\n name: string;\n propsType: ts.Type | null;\n componentNode: ts.Node | null;\n compoundParts: Map<string, ts.Type> | null;\n}\n\n// ---------------------------------------------------------------------------\n// Factory\n// ---------------------------------------------------------------------------\n\nexport function createComponentExtractor(tsconfigPath?: string): ComponentExtractor {\n let projectVersion = 0;\n const fileVersions = new Map<string, number>();\n const fileSnapshots = new Map<string, ts.IScriptSnapshot>();\n\n // Parse tsconfig or use inferred settings\n const rootDir = tsconfigPath ? dirname(resolve(tsconfigPath)) : process.cwd();\n const parsedCommandLine = tsconfigPath\n ? parseTsConfig(tsconfigPath)\n : inferCompilerOptions(rootDir);\n\n const scriptFileNames = new Set(parsedCommandLine.fileNames);\n\n const host: ts.LanguageServiceHost = {\n getProjectVersion: () => projectVersion.toString(),\n getScriptVersion: (fileName) => (fileVersions.get(fileName) ?? 0).toString(),\n getScriptSnapshot: (fileName) => {\n const cached = fileSnapshots.get(fileName);\n if (cached) return cached;\n\n let text: string;\n try {\n text = readFileSync(fileName, 'utf-8');\n } catch {\n return undefined;\n }\n const snapshot = ts.ScriptSnapshot.fromString(text);\n fileSnapshots.set(fileName, snapshot);\n return snapshot;\n },\n getScriptFileNames: () => [...scriptFileNames],\n getCompilationSettings: () => parsedCommandLine.options,\n getCurrentDirectory: () => rootDir,\n getDefaultLibFileName: ts.getDefaultLibFilePath,\n fileExists: ts.sys.fileExists,\n readFile: ts.sys.readFile,\n readDirectory: ts.sys.readDirectory,\n directoryExists: ts.sys.directoryExists,\n getDirectories: ts.sys.getDirectories,\n resolveModuleNames: (moduleNames, containingFile) =>\n moduleNames.map((moduleName) => {\n const resolved = ts.resolveModuleName(\n moduleName,\n containingFile,\n parsedCommandLine.options,\n {\n fileExists: ts.sys.fileExists,\n readFile: ts.sys.readFile,\n realpath: ts.sys.realpath,\n directoryExists: ts.sys.directoryExists,\n getDirectories: ts.sys.getDirectories,\n getCurrentDirectory: () => rootDir,\n }\n );\n\n return resolved.resolvedModule;\n }),\n };\n\n const languageService = ts.createLanguageService(host, ts.createDocumentRegistry());\n\n function ensureFile(filePath: string): void {\n const resolved = resolve(filePath);\n if (!scriptFileNames.has(resolved)) {\n scriptFileNames.add(resolved);\n projectVersion++;\n }\n }\n\n function getChecker(): ts.TypeChecker {\n const program = languageService.getProgram();\n if (!program) throw new Error('Failed to get program from LanguageService');\n return program.getTypeChecker();\n }\n\n function getSourceFile(filePath: string): ts.SourceFile | undefined {\n return languageService.getProgram()?.getSourceFile(resolve(filePath));\n }\n\n return {\n extract(filePath: string, exportName?: string): ComponentMeta | null {\n const resolved = resolve(filePath);\n ensureFile(resolved);\n\n const sourceFile = getSourceFile(resolved);\n if (!sourceFile) return null;\n\n const checker = getChecker();\n const moduleSymbol = checker.getSymbolAtLocation(sourceFile);\n if (!moduleSymbol) return null;\n\n const exports = checker.getExportsOfModule(moduleSymbol);\n const targetName = exportName ?? findPrimaryExport(exports, sourceFile);\n if (!targetName) return null;\n\n const exportSymbol = exports.find(s => s.getName() === targetName);\n if (!exportSymbol) return null;\n\n const component = resolveExportedComponent(checker, exportSymbol, sourceFile);\n if (!component) return null;\n\n return buildComponentMeta(checker, component, resolved, sourceFile, exports);\n },\n\n extractAll(filePath: string): ComponentMeta[] {\n const resolved = resolve(filePath);\n ensureFile(resolved);\n\n const sourceFile = getSourceFile(resolved);\n if (!sourceFile) return [];\n\n const checker = getChecker();\n const moduleSymbol = checker.getSymbolAtLocation(sourceFile);\n if (!moduleSymbol) return [];\n\n const exports = checker.getExportsOfModule(moduleSymbol);\n const results: ComponentMeta[] = [];\n\n for (const exportSymbol of exports) {\n const name = exportSymbol.getName();\n // Only consider PascalCase exports as potential components\n if (!/^[A-Z]/.test(name)) continue;\n\n const component = resolveExportedComponent(checker, exportSymbol, sourceFile);\n if (!component) continue;\n\n const meta = buildComponentMeta(checker, component, resolved, sourceFile, exports);\n if (meta) results.push(meta);\n }\n\n return results;\n },\n\n invalidate(filePath: string): void {\n const resolved = resolve(filePath);\n fileVersions.set(resolved, (fileVersions.get(resolved) ?? 0) + 1);\n fileSnapshots.delete(resolved);\n projectVersion++;\n },\n\n dispose(): void {\n languageService.dispose();\n fileSnapshots.clear();\n fileVersions.clear();\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// tsconfig parsing\n// ---------------------------------------------------------------------------\n\nfunction parseTsConfig(tsconfigPath: string): ts.ParsedCommandLine {\n const resolved = resolve(tsconfigPath);\n const configFile = ts.readConfigFile(resolved, ts.sys.readFile);\n if (configFile.error) {\n throw new Error(`Failed to read tsconfig: ${ts.flattenDiagnosticMessageText(configFile.error.messageText, '\\n')}`);\n }\n\n return ts.parseJsonConfigFileContent(\n configFile.config,\n ts.sys,\n dirname(resolved),\n undefined,\n resolved,\n );\n}\n\nfunction inferCompilerOptions(rootDir: string): ts.ParsedCommandLine {\n return {\n options: {\n target: ts.ScriptTarget.ES2022,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n jsx: ts.JsxEmit.ReactJSX,\n allowSyntheticDefaultImports: true,\n esModuleInterop: true,\n skipLibCheck: true,\n strict: false,\n noEmit: true,\n },\n fileNames: [],\n errors: [],\n };\n}\n\n// ---------------------------------------------------------------------------\n// Export resolution\n// ---------------------------------------------------------------------------\n\n/**\n * Find the \"primary\" export — prefers the default export or the first PascalCase export.\n */\nfunction findPrimaryExport(exports: ts.Symbol[], sourceFile: ts.SourceFile): string | null {\n // Default export\n const defaultExport = exports.find(s => s.getName() === 'default');\n if (defaultExport) return 'default';\n\n // First PascalCase named export\n for (const s of exports) {\n if (/^[A-Z][a-zA-Z0-9]*$/.test(s.getName())) {\n return s.getName();\n }\n }\n\n return null;\n}\n\n/**\n * Resolve an export symbol to a component with its props type.\n * Handles: direct functions, forwardRef, memo, Object.assign, FC<Props>.\n */\nfunction resolveExportedComponent(\n checker: ts.TypeChecker,\n exportSymbol: ts.Symbol,\n sourceFile: ts.SourceFile,\n): ResolvedComponent | null {\n const name = exportSymbol.getName();\n\n // Follow aliases (re-exports)\n let symbol = exportSymbol;\n if (symbol.flags & ts.SymbolFlags.Alias) {\n symbol = checker.getAliasedSymbol(symbol);\n }\n\n const declarations = symbol.getDeclarations();\n if (!declarations || declarations.length === 0) return null;\n\n const declaration = declarations[0];\n\n // Variable declaration: const X = ... (forwardRef, memo, Object.assign, arrow, FC)\n if (ts.isVariableDeclaration(declaration) && declaration.initializer) {\n return resolveFromExpression(checker, name, declaration.initializer, declaration, sourceFile);\n }\n\n // Function declaration: function X(props: Props) { ... }\n if (ts.isFunctionDeclaration(declaration)) {\n const propsType = extractPropsFromFunctionLike(checker, declaration);\n return propsType ? { name, propsType, componentNode: declaration, compoundParts: null } : null;\n }\n\n // Export assignment: export default X\n if (ts.isExportAssignment(declaration) && declaration.expression) {\n return resolveFromExpression(checker, name, declaration.expression, null, sourceFile);\n }\n\n return null;\n}\n\nfunction resolveFromExpression(\n checker: ts.TypeChecker,\n name: string,\n expression: ts.Expression,\n variableDecl: ts.VariableDeclaration | null,\n sourceFile: ts.SourceFile,\n): ResolvedComponent | null {\n // Unwrap parentheses, type assertions\n expression = unwrapExpression(expression);\n\n // Arrow function or function expression\n if (ts.isArrowFunction(expression) || ts.isFunctionExpression(expression)) {\n const propsType = extractPropsFromFunctionLike(checker, expression);\n return propsType ? { name, propsType, componentNode: expression, compoundParts: null } : null;\n }\n\n // Call expression: React.forwardRef, React.memo, Object.assign\n if (ts.isCallExpression(expression)) {\n return resolveCallExpression(checker, name, expression, variableDecl, sourceFile);\n }\n\n // Identifier reference — follow to its declaration\n if (ts.isIdentifier(expression)) {\n const sym = checker.getSymbolAtLocation(expression);\n if (sym) {\n const decls = sym.getDeclarations();\n if (decls && decls.length > 0) {\n const decl = decls[0];\n if (ts.isVariableDeclaration(decl) && decl.initializer) {\n return resolveFromExpression(checker, name, decl.initializer, decl, sourceFile);\n }\n if (ts.isFunctionDeclaration(decl)) {\n const propsType = extractPropsFromFunctionLike(checker, decl);\n return propsType ? { name, propsType, componentNode: decl, compoundParts: null } : null;\n }\n }\n }\n }\n\n // FC<Props> typed variable\n if (variableDecl?.type && ts.isTypeReferenceNode(variableDecl.type)) {\n const typeName = variableDecl.type.typeName.getText(sourceFile);\n if (typeName.includes('FC') || typeName.includes('FunctionComponent')) {\n const typeArg = variableDecl.type.typeArguments?.[0];\n if (typeArg) {\n const propsType = checker.getTypeFromTypeNode(typeArg);\n return { name, propsType, componentNode: expression, compoundParts: null };\n }\n }\n }\n\n return null;\n}\n\nfunction resolveCallExpression(\n checker: ts.TypeChecker,\n name: string,\n call: ts.CallExpression,\n variableDecl: ts.VariableDeclaration | null,\n sourceFile: ts.SourceFile,\n): ResolvedComponent | null {\n const callee = call.expression;\n\n // Object.assign(Root, { Header, Body, ... })\n if (isObjectAssignCall(callee, sourceFile)) {\n return resolveObjectAssign(checker, name, call, sourceFile);\n }\n\n // React.forwardRef<Ref, Props>(fn) or forwardRef<Ref, Props>(fn)\n if (isForwardRefCall(callee)) {\n return resolveForwardRef(checker, name, call, sourceFile);\n }\n\n // React.memo(Component) or memo(Component)\n if (isMemoCall(callee)) {\n const innerArg = call.arguments[0];\n if (innerArg) {\n return resolveFromExpression(checker, name, innerArg, variableDecl, sourceFile);\n }\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Object.assign compound component resolution\n// ---------------------------------------------------------------------------\n\nfunction resolveObjectAssign(\n checker: ts.TypeChecker,\n name: string,\n call: ts.CallExpression,\n sourceFile: ts.SourceFile,\n): ResolvedComponent | null {\n if (call.arguments.length < 2) return null;\n\n // First arg is the root component\n const rootExpr = call.arguments[0];\n const rootResult = resolveFromExpression(checker, name, rootExpr, null, sourceFile);\n\n // Second arg is the object literal with sub-components\n const subsArg = call.arguments[1];\n const compoundParts = new Map<string, ts.Type>();\n\n if (ts.isObjectLiteralExpression(subsArg)) {\n for (const prop of subsArg.properties) {\n let subName: string | null = null;\n let subExpression: ts.Expression | null = null;\n\n if (ts.isShorthandPropertyAssignment(prop)) {\n subName = prop.name.text;\n // Resolve the identifier to its type\n const sym = checker.getSymbolAtLocation(prop.name);\n if (sym) {\n const subPropsType = extractPropsFromComponentSymbol(checker, sym);\n if (subPropsType) {\n compoundParts.set(subName, subPropsType);\n }\n }\n } else if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {\n subName = prop.name.text;\n subExpression = prop.initializer;\n if (subExpression) {\n const subType = extractPropsFromExpression(checker, subExpression, sourceFile);\n if (subType) {\n compoundParts.set(subName, subType);\n }\n }\n }\n }\n }\n\n return {\n name,\n propsType: rootResult?.propsType ?? null,\n componentNode: rootResult?.componentNode ?? rootExpr,\n compoundParts: compoundParts.size > 0 ? compoundParts : null,\n };\n}\n\n/**\n * Extract props type from a component symbol (function, variable, etc.)\n */\nfunction extractPropsFromComponentSymbol(checker: ts.TypeChecker, symbol: ts.Symbol): ts.Type | null {\n // Follow aliases\n let sym = symbol;\n if (sym.flags & ts.SymbolFlags.Alias) {\n sym = checker.getAliasedSymbol(sym);\n }\n\n const decls = sym.getDeclarations();\n if (!decls || decls.length === 0) return null;\n\n const decl = decls[0];\n\n if (ts.isFunctionDeclaration(decl)) {\n return extractPropsFromFunctionLike(checker, decl);\n }\n\n if (ts.isVariableDeclaration(decl) && decl.initializer) {\n // forwardRef, memo, arrow function, etc.\n return extractPropsFromExpressionDeep(checker, decl);\n }\n\n return null;\n}\n\n/**\n * Extract props type from an arbitrary expression (used for Object.assign values).\n */\nfunction extractPropsFromExpression(checker: ts.TypeChecker, expr: ts.Expression, sourceFile: ts.SourceFile): ts.Type | null {\n expr = unwrapExpression(expr);\n\n if (ts.isIdentifier(expr)) {\n const sym = checker.getSymbolAtLocation(expr);\n if (sym) return extractPropsFromComponentSymbol(checker, sym);\n }\n\n if (ts.isArrowFunction(expr) || ts.isFunctionExpression(expr)) {\n return extractPropsFromFunctionLike(checker, expr);\n }\n\n if (ts.isCallExpression(expr)) {\n if (isForwardRefCall(expr.expression)) {\n const typeArg = expr.typeArguments?.[1];\n if (typeArg) return checker.getTypeFromTypeNode(typeArg);\n const innerArg = expr.arguments[0];\n if (innerArg && (ts.isArrowFunction(innerArg) || ts.isFunctionExpression(innerArg))) {\n return extractPropsFromFunctionLike(checker, innerArg);\n }\n }\n if (isMemoCall(expr.expression) && expr.arguments[0]) {\n return extractPropsFromExpression(checker, expr.arguments[0], sourceFile);\n }\n }\n\n return null;\n}\n\n/**\n * Deep extraction from a variable declaration.\n */\nfunction extractPropsFromExpressionDeep(checker: ts.TypeChecker, decl: ts.VariableDeclaration): ts.Type | null {\n if (!decl.initializer) return null;\n const expr = unwrapExpression(decl.initializer);\n\n if (ts.isArrowFunction(expr) || ts.isFunctionExpression(expr)) {\n return extractPropsFromFunctionLike(checker, expr);\n }\n\n if (ts.isCallExpression(expr)) {\n if (isForwardRefCall(expr.expression)) {\n const typeArg = expr.typeArguments?.[1];\n if (typeArg) return checker.getTypeFromTypeNode(typeArg);\n const innerArg = expr.arguments[0];\n if (innerArg && (ts.isArrowFunction(innerArg) || ts.isFunctionExpression(innerArg))) {\n return extractPropsFromFunctionLike(checker, innerArg);\n }\n }\n if (isMemoCall(expr.expression) && expr.arguments[0]) {\n return extractPropsFromExpressionDeep(checker, {\n ...decl,\n initializer: expr.arguments[0],\n } as ts.VariableDeclaration);\n }\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// forwardRef resolution\n// ---------------------------------------------------------------------------\n\nfunction resolveForwardRef(\n checker: ts.TypeChecker,\n name: string,\n call: ts.CallExpression,\n sourceFile: ts.SourceFile,\n): ResolvedComponent | null {\n // Try type arguments first: forwardRef<Ref, Props>(...)\n const propsTypeArg = call.typeArguments?.[1];\n if (propsTypeArg) {\n const propsType = checker.getTypeFromTypeNode(propsTypeArg);\n const innerArg = call.arguments[0];\n const componentNode = innerArg && (ts.isArrowFunction(innerArg) || ts.isFunctionExpression(innerArg))\n ? innerArg : null;\n return { name, propsType, componentNode, compoundParts: null };\n }\n\n // Fall back to inner function's parameter type\n const innerArg = call.arguments[0];\n if (innerArg) {\n if (ts.isArrowFunction(innerArg) || ts.isFunctionExpression(innerArg)) {\n const propsType = extractPropsFromFunctionLike(checker, innerArg);\n return propsType ? { name, propsType, componentNode: innerArg, compoundParts: null } : null;\n }\n if (ts.isIdentifier(innerArg)) {\n const sym = checker.getSymbolAtLocation(innerArg);\n if (sym) {\n const propsType = extractPropsFromComponentSymbol(checker, sym);\n if (propsType) return { name, propsType, componentNode: innerArg, compoundParts: null };\n }\n }\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Props extraction from function-like declarations\n// ---------------------------------------------------------------------------\n\n/**\n * Extract the props type from a function's first parameter.\n */\nfunction extractPropsFromFunctionLike(\n checker: ts.TypeChecker,\n func: ts.FunctionLikeDeclaration,\n): ts.Type | null {\n const firstParam = func.parameters[0];\n if (!firstParam) return null;\n\n // If there's a type annotation, use it\n if (firstParam.type) {\n const directType = checker.getTypeFromTypeNode(firstParam.type);\n if (checker.getPropertiesOfType(directType).length > 0) {\n return directType;\n }\n\n const apparentType = checker.getApparentType(directType);\n if (checker.getPropertiesOfType(apparentType).length > 0) {\n return apparentType;\n }\n\n const paramType = checker.getTypeAtLocation(firstParam);\n if (checker.getPropertiesOfType(paramType).length > 0) {\n return paramType;\n }\n\n const constrainedType = checker.getBaseConstraintOfType(directType);\n if (constrainedType && checker.getPropertiesOfType(constrainedType).length > 0) {\n return constrainedType;\n }\n\n return directType;\n }\n\n // Otherwise try to infer from the parameter's symbol\n const paramSymbol = checker.getSymbolAtLocation(firstParam.name);\n if (paramSymbol) {\n return checker.getTypeOfSymbolAtLocation(paramSymbol, firstParam);\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Build ComponentMeta from resolved component\n// ---------------------------------------------------------------------------\n\nfunction buildComponentMeta(\n checker: ts.TypeChecker,\n component: ResolvedComponent,\n filePath: string,\n sourceFile: ts.SourceFile,\n moduleExports: ts.Symbol[],\n): ComponentMeta | null {\n const props: Record<string, PropMeta> = {};\n const sourceFilePath = toPosixPath(sourceFile.fileName);\n\n if (component.propsType) {\n extractPropsFromType(checker, component.propsType, props, sourceFilePath);\n if (Object.keys(props).length === 0) {\n const apparentPropsType = checker.getApparentType(component.propsType);\n if (apparentPropsType !== component.propsType) {\n extractPropsFromType(checker, apparentPropsType, props, sourceFilePath);\n }\n }\n if (Object.keys(props).length === 0) {\n const constrainedPropsType = checker.getBaseConstraintOfType(component.propsType);\n if (constrainedPropsType) {\n extractPropsFromType(checker, constrainedPropsType, props, sourceFilePath);\n }\n }\n }\n\n // Promote explicitly destructured props to \"local\" so wrapper components like\n // shadcn Input surface the props they actively customize from inherited DOM types.\n const destructuredProps = component.componentNode\n ? extractDestructuredPropNames(component.componentNode)\n : new Set<string>();\n for (const propName of destructuredProps) {\n if (props[propName]) {\n props[propName].source = 'local';\n }\n }\n\n // Extract defaults from the component function body\n const defaults = component.componentNode\n ? extractDefaultValues(component.componentNode)\n : {};\n\n // Apply defaults\n for (const [propName, defaultVal] of Object.entries(defaults)) {\n if (props[propName]) {\n props[propName].default = defaultVal;\n }\n }\n\n // Build composition meta\n let composition: CompositionMeta | null = null;\n if (component.compoundParts && component.compoundParts.size > 0) {\n const parts: PartMeta[] = [];\n for (const [partName, partType] of component.compoundParts) {\n const partProps: Record<string, PropMeta> = {};\n extractPropsFromType(checker, partType, partProps, sourceFilePath);\n parts.push({ name: partName, props: partProps });\n }\n\n composition = {\n pattern: 'compound',\n parts,\n required: [], // Could be inferred from usage patterns\n };\n }\n\n // Extract description from JSDoc\n let description = '';\n const componentSymbol = moduleExports.find(s => s.getName() === component.name);\n if (componentSymbol) {\n description = extractJSDocDescription(checker, componentSymbol);\n }\n\n // Collect export names\n const exportNames = moduleExports\n .filter(s => /^[A-Z]/.test(s.getName()))\n .map(s => s.getName());\n\n // Collect import dependencies (other components imported)\n const dependencies = extractDependencies(sourceFile);\n\n return {\n name: component.name,\n filePath,\n description,\n props,\n composition,\n exports: exportNames,\n dependencies,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Type → PropMeta extraction\n// ---------------------------------------------------------------------------\n\nfunction extractPropsFromType(\n checker: ts.TypeChecker,\n propsType: ts.Type,\n result: Record<string, PropMeta>,\n sourceFilePath: string,\n): void {\n for (const symbol of checker.getPropertiesOfType(propsType)) {\n const propName = symbol.getName();\n\n // Skip internal/private props\n if (propName.startsWith('_') || propName.startsWith('$')) continue;\n\n // Skip React internal props\n if (propName === 'key' || propName === 'ref') continue;\n\n const declarations = symbol.getDeclarations() ?? [];\n\n // Determine source: local vs inherited\n const isLocal = declarations.some(\n d => toPosixPath(d.getSourceFile().fileName) === sourceFilePath,\n );\n\n const referenceNode = declarations[0];\n if (!referenceNode) continue;\n\n const propType = checker.getTypeOfSymbolAtLocation(symbol, referenceNode);\n const serialized = serializePropType(checker, propType);\n const description = ts.displayPartsToString(symbol.getDocumentationComment(checker)).trim();\n const required = (symbol.flags & ts.SymbolFlags.Optional) === 0;\n\n // Extract @default from JSDoc tags\n let jsDocDefault: string | undefined;\n const jsDocTags = symbol.getJsDocTags(checker);\n const defaultTag = jsDocTags.find(t => t.name === 'default');\n if (defaultTag?.text) {\n jsDocDefault = ts.displayPartsToString(defaultTag.text).trim();\n }\n\n result[propName] = {\n name: propName,\n type: serialized.type,\n typeKind: serialized.typeKind,\n values: serialized.values,\n default: jsDocDefault,\n description: description || undefined,\n required,\n source: isLocal ? 'local' : 'inherited',\n };\n }\n}\n\n// ---------------------------------------------------------------------------\n// Type serializer: ts.Type → PropMeta shape\n// ---------------------------------------------------------------------------\n\nfunction serializePropType(\n checker: ts.TypeChecker,\n type: ts.Type,\n): Pick<PropMeta, 'type' | 'typeKind' | 'values'> {\n // Check for ReactNode/ReactElement BEFORE union decomposition,\n // because ReactNode is defined as a large union in React's types.\n const aliasSymbol = type.aliasSymbol;\n if (aliasSymbol) {\n const aliasName = aliasSymbol.getName();\n if (aliasName === 'ReactNode') {\n return { type: 'ReactNode', typeKind: 'node' };\n }\n if (aliasName === 'ReactElement') {\n return { type: 'ReactElement', typeKind: 'element' };\n }\n }\n\n // Handle union types (including optional which adds undefined)\n if (type.isUnion()) {\n const nonNullableTypes = type.types.filter(\n t => !((t.flags & ts.TypeFlags.Undefined) || (t.flags & ts.TypeFlags.Null) || (t.flags & ts.TypeFlags.Void)),\n );\n\n // Single type after filtering nullable\n if (nonNullableTypes.length === 1) {\n return serializePropType(checker, nonNullableTypes[0]);\n }\n\n // All string literals → enum\n if (nonNullableTypes.length > 0 && nonNullableTypes.every(t => t.isStringLiteral())) {\n const values = nonNullableTypes.map(t => (t as ts.StringLiteralType).value);\n return {\n type: values.map(v => `\"${v}\"`).join(' | '),\n typeKind: 'enum',\n values,\n };\n }\n\n // All boolean-like\n if (nonNullableTypes.every(t => isBooleanLike(t))) {\n return { type: 'boolean', typeKind: 'boolean' };\n }\n\n // Mixed union\n const typeStr = checker.typeToString(type, undefined, ts.TypeFormatFlags.NoTruncation);\n return { type: typeStr, typeKind: 'union' };\n }\n\n // Check for ReactNode / ReactElement\n const typeStr = checker.typeToString(type, undefined, ts.TypeFormatFlags.NoTruncation);\n if (typeStr.includes('ReactNode')) {\n return { type: 'ReactNode', typeKind: 'node' };\n }\n if (typeStr.includes('ReactElement') || typeStr.includes('JSX.Element')) {\n return { type: 'ReactElement', typeKind: 'element' };\n }\n\n // Function types\n if (type.getCallSignatures().length > 0) {\n return { type: typeStr, typeKind: 'function' };\n }\n\n // Primitives\n if (type.flags & ts.TypeFlags.String) return { type: 'string', typeKind: 'string' };\n if (type.flags & ts.TypeFlags.Number) return { type: 'number', typeKind: 'number' };\n if (type.flags & ts.TypeFlags.Boolean || type.flags & ts.TypeFlags.BooleanLiteral) {\n return { type: 'boolean', typeKind: 'boolean' };\n }\n\n // String literal (not in union)\n if (type.isStringLiteral()) {\n return { type: `\"${type.value}\"`, typeKind: 'enum', values: [type.value] };\n }\n\n // Array\n if (checker.isArrayType(type) || checker.isTupleType(type)) {\n return { type: typeStr, typeKind: 'array' };\n }\n\n // Object\n if (type.flags & ts.TypeFlags.Object) {\n return { type: typeStr, typeKind: 'object' };\n }\n\n return { type: typeStr, typeKind: 'custom' };\n}\n\n// ---------------------------------------------------------------------------\n// Default value extraction\n// ---------------------------------------------------------------------------\n\nfunction extractDefaultValues(node: ts.Node): Record<string, string> {\n const defaults: Record<string, string> = {};\n\n // Find function-like node\n let funcNode: ts.FunctionLikeDeclaration | null = null;\n if (ts.isFunctionDeclaration(node) || ts.isArrowFunction(node) || ts.isFunctionExpression(node)) {\n funcNode = node;\n }\n\n if (!funcNode?.parameters?.length) return defaults;\n\n const firstParam = funcNode.parameters[0];\n if (!ts.isObjectBindingPattern(firstParam.name)) return defaults;\n\n for (const element of firstParam.name.elements) {\n let propName: string | null = null;\n\n if (element.propertyName) {\n if (ts.isIdentifier(element.propertyName) || ts.isStringLiteral(element.propertyName)) {\n propName = element.propertyName.text;\n }\n } else if (ts.isIdentifier(element.name)) {\n propName = element.name.text;\n }\n\n if (!propName || !element.initializer) continue;\n\n const value = readLiteralValue(element.initializer);\n if (value !== undefined) {\n defaults[propName] = value;\n }\n }\n\n return defaults;\n}\n\nfunction extractDestructuredPropNames(node: ts.Node): Set<string> {\n const names = new Set<string>();\n\n let funcNode: ts.FunctionLikeDeclaration | null = null;\n if (ts.isFunctionDeclaration(node) || ts.isArrowFunction(node) || ts.isFunctionExpression(node)) {\n funcNode = node;\n }\n\n if (!funcNode?.parameters?.length) return names;\n\n const firstParam = funcNode.parameters[0];\n if (!ts.isObjectBindingPattern(firstParam.name)) return names;\n\n for (const element of firstParam.name.elements) {\n if (element.dotDotDotToken || !ts.isIdentifier(element.name)) continue;\n\n const propName = element.propertyName\n ? element.propertyName.getText()\n : element.name.text;\n\n if (propName === 'className' || propName === 'children' || propName === 'ref') {\n continue;\n }\n\n names.add(propName);\n }\n\n return names;\n}\n\nfunction readLiteralValue(expression: ts.Expression): string | undefined {\n if (ts.isStringLiteral(expression) || ts.isNoSubstitutionTemplateLiteral(expression)) {\n return expression.text;\n }\n if (ts.isNumericLiteral(expression)) {\n return expression.text;\n }\n if (expression.kind === ts.SyntaxKind.TrueKeyword) return 'true';\n if (expression.kind === ts.SyntaxKind.FalseKeyword) return 'false';\n if (expression.kind === ts.SyntaxKind.NullKeyword) return 'null';\n if (\n ts.isPrefixUnaryExpression(expression) &&\n expression.operator === ts.SyntaxKind.MinusToken &&\n ts.isNumericLiteral(expression.operand)\n ) {\n return `-${expression.operand.text}`;\n }\n\n return undefined;\n}\n\n// ---------------------------------------------------------------------------\n// JSDoc extraction\n// ---------------------------------------------------------------------------\n\nfunction extractJSDocDescription(checker: ts.TypeChecker, symbol: ts.Symbol): string {\n // Follow aliases\n let sym = symbol;\n if (sym.flags & ts.SymbolFlags.Alias) {\n sym = checker.getAliasedSymbol(sym);\n }\n\n const docComment = ts.displayPartsToString(sym.getDocumentationComment(checker)).trim();\n if (docComment) return docComment;\n\n // Try to get from the Props interface\n const decls = sym.getDeclarations();\n if (decls) {\n for (const decl of decls) {\n // Look for the Props type\n const sourceFile = decl.getSourceFile();\n for (const stmt of sourceFile.statements) {\n if (\n (ts.isInterfaceDeclaration(stmt) || ts.isTypeAliasDeclaration(stmt)) &&\n stmt.name.text === `${symbol.getName()}Props`\n ) {\n const propsDoc = ts.displayPartsToString(\n checker.getSymbolAtLocation(stmt.name)?.getDocumentationComment(checker) ?? [],\n ).trim();\n if (propsDoc) return propsDoc;\n }\n }\n }\n }\n\n return '';\n}\n\n// ---------------------------------------------------------------------------\n// Import dependency extraction\n// ---------------------------------------------------------------------------\n\nfunction extractDependencies(sourceFile: ts.SourceFile): string[] {\n const deps: string[] = [];\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n if (!ts.isStringLiteral(stmt.moduleSpecifier)) continue;\n\n const modulePath = stmt.moduleSpecifier.text;\n // Only relative imports to other components\n if (!modulePath.startsWith('.') && !modulePath.startsWith('/')) continue;\n\n const clause = stmt.importClause;\n if (!clause) continue;\n\n // Default import\n if (clause.name && /^[A-Z]/.test(clause.name.text)) {\n deps.push(clause.name.text);\n }\n\n // Named imports\n if (clause.namedBindings && ts.isNamedImports(clause.namedBindings)) {\n for (const element of clause.namedBindings.elements) {\n if (/^[A-Z]/.test(element.name.text)) {\n deps.push(element.name.text);\n }\n }\n }\n }\n return deps;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction unwrapExpression(expr: ts.Expression): ts.Expression {\n while (true) {\n if (ts.isParenthesizedExpression(expr)) {\n expr = expr.expression;\n } else if (ts.isAsExpression(expr) || ts.isTypeAssertionExpression(expr)) {\n expr = expr.expression;\n } else {\n return expr;\n }\n }\n}\n\nfunction isObjectAssignCall(callee: ts.Expression, sourceFile: ts.SourceFile): boolean {\n if (\n ts.isPropertyAccessExpression(callee) &&\n ts.isIdentifier(callee.expression) &&\n callee.expression.text === 'Object' &&\n callee.name.text === 'assign'\n ) {\n return true;\n }\n return false;\n}\n\nfunction isForwardRefCall(callee: ts.Expression): boolean {\n // React.forwardRef(...)\n if (ts.isPropertyAccessExpression(callee) && callee.name.text === 'forwardRef') {\n return true;\n }\n // forwardRef(...)\n if (ts.isIdentifier(callee) && callee.text === 'forwardRef') {\n return true;\n }\n return false;\n}\n\nfunction isMemoCall(callee: ts.Expression): boolean {\n if (ts.isPropertyAccessExpression(callee) && callee.name.text === 'memo') {\n return true;\n }\n if (ts.isIdentifier(callee) && callee.text === 'memo') {\n return true;\n }\n return false;\n}\n\nfunction isBooleanLike(type: ts.Type): boolean {\n return (\n (type.flags & ts.TypeFlags.BooleanLike) !== 0 ||\n type.flags === ts.TypeFlags.BooleanLiteral\n );\n}\n\nfunction toPosixPath(filePath: string): string {\n return filePath.replace(/\\\\/g, '/');\n}\n","import { existsSync, statSync } from \"node:fs\";\nimport { dirname, extname, join, resolve } from \"node:path\";\nimport ts from \"typescript\";\nimport type { PropDefinition } from '@fragments-sdk/core';\n\nexport interface AutoDetectedPropDefinition {\n type: PropDefinition[\"type\"];\n description: string;\n required: boolean;\n default?: unknown;\n values?: readonly string[];\n}\n\nexport interface AutoPropsExtractionResult {\n props: Record<string, AutoDetectedPropDefinition>;\n warnings: string[];\n resolved: boolean;\n}\n\ninterface ResolvedComponentSignature {\n propsTypeNode: ts.TypeNode | null;\n componentNode: ts.FunctionLikeDeclarationBase | null;\n}\n\nfunction toPosixPath(filePath: string): string {\n return filePath.replace(/\\\\/g, \"/\");\n}\n\nfunction isFile(filePath: string): boolean {\n if (!existsSync(filePath)) return false;\n try {\n return statSync(filePath).isFile();\n } catch {\n return false;\n }\n}\n\nfunction resolveModulePath(basePath: string): string | null {\n const candidates: string[] = [];\n const extension = extname(basePath);\n\n if (extension) {\n candidates.push(basePath);\n } else {\n candidates.push(\n `${basePath}.tsx`,\n `${basePath}.ts`,\n `${basePath}.jsx`,\n `${basePath}.js`,\n join(basePath, \"index.tsx\"),\n join(basePath, \"index.ts\"),\n join(basePath, \"index.jsx\"),\n join(basePath, \"index.js\")\n );\n }\n\n for (const candidate of candidates) {\n if (isFile(candidate)) {\n return resolve(candidate);\n }\n }\n\n return null;\n}\n\n/**\n * Resolve a component source file from the fragment file path + component import path.\n * Supports relative imports like \".\", \"./Button\", \"../components/Button\".\n */\nexport function resolveComponentSourcePath(\n fragmentFileAbsolutePath: string,\n componentImportPath: string | null\n): string | null {\n if (!componentImportPath) return null;\n if (!componentImportPath.startsWith(\".\")) return null;\n\n const fragmentDir = dirname(fragmentFileAbsolutePath);\n const basePath = resolve(fragmentDir, componentImportPath);\n return resolveModulePath(basePath);\n}\n\nfunction collectTopLevelDeclarations(sourceFile: ts.SourceFile): {\n typeDeclarations: Map<string, ts.InterfaceDeclaration | ts.TypeAliasDeclaration>;\n functionDeclarations: Map<string, ts.FunctionDeclaration>;\n variableDeclarations: Map<string, ts.VariableDeclaration>;\n} {\n const typeDeclarations = new Map<string, ts.InterfaceDeclaration | ts.TypeAliasDeclaration>();\n const functionDeclarations = new Map<string, ts.FunctionDeclaration>();\n const variableDeclarations = new Map<string, ts.VariableDeclaration>();\n\n for (const node of sourceFile.statements) {\n if (ts.isInterfaceDeclaration(node)) {\n typeDeclarations.set(node.name.text, node);\n continue;\n }\n\n if (ts.isTypeAliasDeclaration(node)) {\n typeDeclarations.set(node.name.text, node);\n continue;\n }\n\n if (ts.isFunctionDeclaration(node) && node.name) {\n functionDeclarations.set(node.name.text, node);\n continue;\n }\n\n if (ts.isVariableStatement(node)) {\n for (const declaration of node.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name)) {\n variableDeclarations.set(declaration.name.text, declaration);\n }\n }\n }\n }\n\n return { typeDeclarations, functionDeclarations, variableDeclarations };\n}\n\nfunction readDefaultValue(expression: ts.Expression): unknown {\n if (ts.isStringLiteral(expression) || ts.isNoSubstitutionTemplateLiteral(expression)) {\n return expression.text;\n }\n\n if (ts.isNumericLiteral(expression)) {\n return Number(expression.text);\n }\n\n if (expression.kind === ts.SyntaxKind.TrueKeyword) return true;\n if (expression.kind === ts.SyntaxKind.FalseKeyword) return false;\n if (expression.kind === ts.SyntaxKind.NullKeyword) return null;\n\n if (\n ts.isPrefixUnaryExpression(expression) &&\n expression.operator === ts.SyntaxKind.MinusToken &&\n ts.isNumericLiteral(expression.operand)\n ) {\n return -Number(expression.operand.text);\n }\n\n return undefined;\n}\n\nfunction extractDefaultValues(\n componentNode: ts.FunctionLikeDeclarationBase | null\n): Record<string, unknown> {\n const defaults: Record<string, unknown> = {};\n if (!componentNode?.parameters?.length) return defaults;\n\n const firstParam = componentNode.parameters[0];\n if (!ts.isObjectBindingPattern(firstParam.name)) return defaults;\n\n for (const element of firstParam.name.elements) {\n let propName: string | null = null;\n\n if (element.propertyName) {\n if (ts.isIdentifier(element.propertyName) || ts.isStringLiteral(element.propertyName)) {\n propName = element.propertyName.text;\n }\n } else if (ts.isIdentifier(element.name)) {\n propName = element.name.text;\n }\n\n if (!propName || !element.initializer) continue;\n\n const value = readDefaultValue(element.initializer);\n if (value !== undefined) {\n defaults[propName] = value;\n }\n }\n\n return defaults;\n}\n\nfunction isNullishType(type: ts.Type): boolean {\n return (\n (type.flags & ts.TypeFlags.Null) !== 0 ||\n (type.flags & ts.TypeFlags.Undefined) !== 0 ||\n (type.flags & ts.TypeFlags.Void) !== 0\n );\n}\n\nfunction isBooleanLikeType(type: ts.Type): boolean {\n return (\n (type.flags & ts.TypeFlags.BooleanLike) !== 0 ||\n type.flags === ts.TypeFlags.BooleanLiteral\n );\n}\n\nfunction inferPropType(\n type: ts.Type,\n checker: ts.TypeChecker\n): Pick<AutoDetectedPropDefinition, \"type\" | \"values\"> {\n const typeText = checker.typeToString(type, undefined, ts.TypeFormatFlags.NoTruncation);\n\n if (typeText.includes(\"ReactNode\")) {\n return { type: \"node\" };\n }\n if (typeText.includes(\"ReactElement\") || typeText.includes(\"JSX.Element\")) {\n return { type: \"element\" };\n }\n\n if (type.getCallSignatures().length > 0) {\n return { type: \"function\" };\n }\n\n if (checker.isArrayType(type) || checker.isTupleType(type)) {\n return { type: \"array\" };\n }\n\n if (type.isUnion()) {\n const nonNullableTypes = type.types.filter((unionType) => !isNullishType(unionType));\n\n if (nonNullableTypes.length === 1) {\n return inferPropType(nonNullableTypes[0], checker);\n }\n\n const stringLiteralValues = nonNullableTypes\n .filter((unionType) => (unionType.flags & ts.TypeFlags.StringLiteral) !== 0)\n .map((unionType) => (unionType as ts.StringLiteralType).value);\n\n if (stringLiteralValues.length > 0 && stringLiteralValues.length === nonNullableTypes.length) {\n return { type: \"enum\", values: stringLiteralValues };\n }\n\n if (nonNullableTypes.every((unionType) => isBooleanLikeType(unionType))) {\n return { type: \"boolean\" };\n }\n\n return { type: \"union\" };\n }\n\n if ((type.flags & ts.TypeFlags.StringLike) !== 0) {\n return { type: \"string\" };\n }\n if ((type.flags & ts.TypeFlags.NumberLike) !== 0) {\n return { type: \"number\" };\n }\n if ((type.flags & ts.TypeFlags.BooleanLike) !== 0) {\n return { type: \"boolean\" };\n }\n\n if ((type.flags & ts.TypeFlags.Object) !== 0) {\n return { type: \"object\" };\n }\n\n return { type: \"custom\" };\n}\n\nfunction resolveComponentSignature(\n exportName: string,\n declarations: ReturnType<typeof collectTopLevelDeclarations>,\n sourceFile: ts.SourceFile\n): ResolvedComponentSignature {\n const visitedNames = new Set<string>();\n\n const typeNodeFromFunction = (\n node: ts.FunctionLikeDeclarationBase\n ): ResolvedComponentSignature => ({\n propsTypeNode: node.parameters[0]?.type ?? null,\n componentNode: node,\n });\n\n const resolveFromExpression = (expression: ts.Expression): ResolvedComponentSignature => {\n if (ts.isParenthesizedExpression(expression)) {\n return resolveFromExpression(expression.expression);\n }\n if (ts.isAsExpression(expression) || ts.isTypeAssertionExpression(expression)) {\n return resolveFromExpression(expression.expression);\n }\n if (ts.isArrowFunction(expression) || ts.isFunctionExpression(expression)) {\n return typeNodeFromFunction(expression);\n }\n if (ts.isIdentifier(expression)) {\n return resolveFromIdentifier(expression.text);\n }\n\n if (ts.isCallExpression(expression)) {\n if (\n ts.isPropertyAccessExpression(expression.expression) &&\n expression.expression.name.text === \"forwardRef\"\n ) {\n const forwardRefPropsType = expression.typeArguments?.[1] ?? null;\n const innerArg = expression.arguments[0];\n const inner = innerArg && (ts.isArrowFunction(innerArg) || ts.isFunctionExpression(innerArg))\n ? typeNodeFromFunction(innerArg)\n : innerArg && ts.isIdentifier(innerArg)\n ? resolveFromIdentifier(innerArg.text)\n : { propsTypeNode: null, componentNode: null };\n\n return {\n propsTypeNode: forwardRefPropsType ?? inner.propsTypeNode,\n componentNode: inner.componentNode,\n };\n }\n\n if (\n ts.isPropertyAccessExpression(expression.expression) &&\n expression.expression.name.text === \"memo\" &&\n expression.arguments[0]\n ) {\n return resolveFromExpression(expression.arguments[0]);\n }\n\n if (\n ts.isPropertyAccessExpression(expression.expression) &&\n expression.expression.expression.getText(sourceFile) === \"Object\" &&\n expression.expression.name.text === \"assign\" &&\n expression.arguments[0]\n ) {\n return resolveFromExpression(expression.arguments[0]);\n }\n }\n\n return { propsTypeNode: null, componentNode: null };\n };\n\n const resolveFromVariable = (declaration: ts.VariableDeclaration): ResolvedComponentSignature => {\n if (\n declaration.type &&\n ts.isTypeReferenceNode(declaration.type) &&\n declaration.type.typeArguments?.length\n ) {\n const typeName = declaration.type.typeName.getText(sourceFile);\n if (typeName.includes(\"FC\") || typeName.includes(\"FunctionComponent\")) {\n const componentNode =\n declaration.initializer &&\n (ts.isArrowFunction(declaration.initializer) || ts.isFunctionExpression(declaration.initializer))\n ? declaration.initializer\n : null;\n\n return {\n propsTypeNode: declaration.type.typeArguments[0] ?? null,\n componentNode,\n };\n }\n }\n\n if (declaration.initializer) {\n return resolveFromExpression(declaration.initializer);\n }\n\n return { propsTypeNode: null, componentNode: null };\n };\n\n const resolveFromIdentifier = (name: string): ResolvedComponentSignature => {\n if (!name || visitedNames.has(name)) {\n return { propsTypeNode: null, componentNode: null };\n }\n visitedNames.add(name);\n\n const functionDeclaration = declarations.functionDeclarations.get(name);\n if (functionDeclaration) {\n return typeNodeFromFunction(functionDeclaration);\n }\n\n const variableDeclaration = declarations.variableDeclarations.get(name);\n if (variableDeclaration) {\n return resolveFromVariable(variableDeclaration);\n }\n\n return { propsTypeNode: null, componentNode: null };\n };\n\n return resolveFromIdentifier(exportName);\n}\n\n/**\n * Extract custom component props from a source file.\n * Custom props are identified as props whose declarations originate from the component's source file.\n */\nexport function extractCustomPropsFromComponentFile(\n componentFilePath: string,\n exportName: string\n): AutoPropsExtractionResult {\n const warnings: string[] = [];\n const resolvedPath = resolve(componentFilePath);\n\n if (!existsSync(resolvedPath)) {\n return {\n props: {},\n warnings: [`Component file not found: ${resolvedPath}`],\n resolved: false,\n };\n }\n\n const compilerOptions: ts.CompilerOptions = {\n target: ts.ScriptTarget.ESNext,\n module: ts.ModuleKind.ESNext,\n moduleResolution: ts.ModuleResolutionKind.Bundler,\n jsx: ts.JsxEmit.ReactJSX,\n allowSyntheticDefaultImports: true,\n esModuleInterop: true,\n skipLibCheck: true,\n strict: false,\n noEmit: true,\n };\n\n const program = ts.createProgram([resolvedPath], compilerOptions);\n const sourceFile = program.getSourceFile(resolvedPath);\n if (!sourceFile) {\n return {\n props: {},\n warnings: [`Unable to parse component source: ${resolvedPath}`],\n resolved: false,\n };\n }\n\n const checker = program.getTypeChecker();\n const declarations = collectTopLevelDeclarations(sourceFile);\n const signature = resolveComponentSignature(exportName, declarations, sourceFile);\n\n if (!signature.propsTypeNode) {\n return {\n props: {},\n warnings: [`Unable to resolve props type for export: ${exportName}`],\n resolved: false,\n };\n }\n\n const propsType = checker.getTypeFromTypeNode(signature.propsTypeNode);\n const defaultValues = extractDefaultValues(signature.componentNode);\n const sourceFilePath = toPosixPath(sourceFile.fileName);\n\n const extractedProps: Record<string, AutoDetectedPropDefinition> = {};\n for (const symbol of checker.getPropertiesOfType(propsType)) {\n const propName = symbol.getName();\n if (propName.startsWith(\"_\") || propName.startsWith(\"$\")) {\n continue;\n }\n\n const declarationsForSymbol = symbol.getDeclarations() ?? [];\n const localDeclarations = declarationsForSymbol.filter(\n (declaration) => toPosixPath(declaration.getSourceFile().fileName) === sourceFilePath\n );\n\n if (localDeclarations.length === 0) {\n continue;\n }\n\n const referenceNode = localDeclarations[0];\n const inferredType = inferPropType(checker.getTypeOfSymbolAtLocation(symbol, referenceNode), checker);\n const description = ts\n .displayPartsToString(symbol.getDocumentationComment(checker))\n .trim();\n\n extractedProps[propName] = {\n type: inferredType.type,\n description,\n required: (symbol.getFlags() & ts.SymbolFlags.Optional) === 0,\n ...(inferredType.values && { values: inferredType.values }),\n ...(defaultValues[propName] !== undefined && { default: defaultValues[propName] }),\n };\n }\n\n if (Object.keys(extractedProps).length === 0) {\n warnings.push(`Resolved props type for ${exportName}, but no local custom props were found`);\n }\n\n return {\n props: extractedProps,\n warnings,\n resolved: true,\n };\n}\n","/**\n * Token Resolver — resolves unresolved SCSS token values using actual sass compilation.\n *\n * The regex-based resolver in token-parser.ts cannot handle SCSS module namespaces,\n * functions (color.scale, math.div), or map lookups. This module provides a fallback\n * that compiles the actual SCSS sources to extract computed CSS custom property values.\n *\n * Used at build time only — no runtime sass dependency in the MCP server.\n */\n\nimport { resolve, dirname, basename } from 'node:path';\nimport { existsSync, readdirSync } from 'node:fs';\n\n/**\n * Round fractional RGB channel values produced by Sass color math.\n *\n * Sass functions like color.scale() and color.adjust() can produce\n * fractional values like rgb(217.8, 217.8, 217.8). This normalizes\n * them to clean integers: rgb(218, 218, 218).\n *\n * Alpha channels in rgba() are preserved as-is (they're legitimately fractional).\n */\nfunction roundRgbValues(value: string): string {\n return value\n .replace(\n /rgb\\(([^)]+)\\)/g,\n (_full, inner: string) => {\n const parts = inner.split(',').map(p => p.trim());\n const rounded = parts.map(p => {\n const num = parseFloat(p);\n return isNaN(num) ? p : String(Math.round(num));\n });\n return `rgb(${rounded.join(', ')})`;\n },\n )\n .replace(\n /rgba\\(([^)]+)\\)/g,\n (_full, inner: string) => {\n const parts = inner.split(',').map(p => p.trim());\n // Round RGB channels (first 3), preserve alpha as-is\n const rounded = parts.map((p, i) => {\n if (i >= 3) return p; // alpha channel — don't round\n const num = parseFloat(p);\n return isNaN(num) ? p : String(Math.round(num));\n });\n return `rgba(${rounded.join(', ')})`;\n },\n );\n}\n\n/**\n * Resolve unresolved SCSS token values by compiling the project's token SCSS.\n *\n * Generates a temporary SCSS string that imports the project's _variables.scss\n * and includes the fui-css-variables mixin, then compiles it with sass to extract\n * the actual computed values for all CSS custom properties.\n *\n * @param unresolvedTokens - Tokens with values containing #{} or $ that need resolution\n * @param tokensDir - Absolute path to the directory containing _variables.scss\n * @returns Map of token name → resolved CSS value (only for tokens that were unresolved)\n */\nexport async function resolveTokensWithSass(\n unresolvedTokens: Array<{ name: string; value: string }>,\n tokensDir: string,\n): Promise<Map<string, string>> {\n const resolvedMap = new Map<string, string>();\n\n // Filter to only tokens that actually need resolution\n const needsResolution = unresolvedTokens.filter(\n t => t.value.includes('#{') || t.value.includes('$'),\n );\n\n if (needsResolution.length === 0) {\n return resolvedMap;\n }\n\n try {\n // Dynamic import so sass is only loaded when needed (build-time only)\n const sass = await import('sass');\n\n // Find the _variables.scss file and determine the mixin name\n const variablesPath = findVariablesFile(tokensDir);\n if (!variablesPath) {\n return resolvedMap;\n }\n\n // Determine the module name for @use (filename without _ prefix and .scss suffix)\n const fileName = basename(variablesPath);\n const moduleName = fileName.replace(/^_/, '').replace(/\\.scss$/, '');\n\n // Generate a SCSS string that imports the variables and includes the mixin\n const scssSource = `\n@use '${moduleName}' as vars;\n:root { @include vars.fui-css-variables; }\n`;\n\n // Compile the SCSS with the tokens directory as a load path\n const compiled = sass.compileString(scssSource, {\n loadPaths: [tokensDir, dirname(tokensDir)],\n style: 'expanded',\n // Suppress sass deprecation warnings during build\n logger: { warn() {}, debug() {} } as never,\n });\n\n // Parse the compiled CSS for --fui-* custom property declarations\n const cssVarRegex = /(--[\\w-]+)\\s*:\\s*([^;]+)/g;\n let match: RegExpExecArray | null;\n const allResolved = new Map<string, string>();\n\n while ((match = cssVarRegex.exec(compiled.css)) !== null) {\n allResolved.set(match[1], roundRgbValues(match[2].trim()));\n }\n\n // Only return values for the tokens that were originally unresolved\n for (const token of needsResolution) {\n const value = allResolved.get(token.name);\n if (value !== undefined) {\n resolvedMap.set(token.name, value);\n }\n }\n } catch {\n // Sass compilation failure is non-fatal — fall back to regex-resolved values\n }\n\n return resolvedMap;\n}\n\n/**\n * Find the _variables.scss file in the tokens directory.\n */\nfunction findVariablesFile(tokensDir: string): string | null {\n const candidates = ['_variables.scss', 'variables.scss'];\n for (const name of candidates) {\n const path = resolve(tokensDir, name);\n if (existsSync(path)) {\n return path;\n }\n }\n\n // Fallback: look for any SCSS file containing 'css-variables' mixin\n try {\n const files = readdirSync(tokensDir).filter(f => f.endsWith('.scss'));\n for (const file of files) {\n const path = resolve(tokensDir, file);\n // We just need to find it exists; the @use import will handle the rest\n if (file.includes('variables') || file.includes('tokens')) {\n return path;\n }\n }\n } catch {\n // Directory read failure\n }\n\n return null;\n}\n"],"mappings":";;;;AAYA,OAAO,QAAQ;AACf,SAAqB,oBAA2C;AAChE,SAAS,SAAS,eAAqB;ACdvC,SAAS,cAAAA,aAAY,YAAAC,iBAAgB;AACrC,SAAS,WAAAC,UAAS,SAAS,QAAAC,OAAM,WAAAC,gBAAe;AAChD,OAAOC,SAAQ;ACQf,SAAS,WAAAD,UAAS,WAAAF,UAAS,gBAAgB;AAC3C,SAAS,cAAAF,aAAY,eAAAM,oBAAmB;;AFgFjC,SAAS,yBAAyB,cAA2C;AAClF,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,CAAC;IAC3D;AAGA,eAAW,SAAS,iBAAiB;AACnC,YAAM,QAAQ,YAAY,IAAI,MAAM,IAAI;AACxC,UAAI,UAAU,QAAW;AACvB,oBAAY,IAAI,MAAM,MAAM,KAAK;MACnC;IACF;EACF,QAAQ;EAER;AAEA,SAAO;AACT;AAKA,SAAS,kBAAkB,WAAkC;AAC3D,QAAM,aAAa,CAAC,mBAAmB,gBAAgB;AACvD,aAAW,QAAQ,YAAY;AAC7B,UAAM,OAAOE,SAAQ,WAAW,IAAI;AACpC,QAAIJ,YAAW,IAAI,GAAG;AACpB,aAAO;IACT;EACF;AAGA,MAAI;AACF,UAAM,QAAQM,aAAY,SAAS,EAAE,OAAO,CAAA,MAAK,EAAE,SAAS,OAAO,CAAC;AACpE,eAAW,QAAQ,OAAO;AACxB,YAAM,OAAOF,SAAQ,WAAW,IAAI;AAEpC,UAAI,KAAK,SAAS,WAAW,KAAK,KAAK,SAAS,QAAQ,GAAG;AACzD,eAAO;MACT;IACF;EACF,QAAQ;EAER;AAEA,SAAO;AACT;","names":["existsSync","statSync","dirname","join","resolve","ts","readdirSync","innerArg","typeStr","toPosixPath","extractDefaultValues","resolveFromExpression"]}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import {
|
|
2
|
+
generateRulesFiles
|
|
3
|
+
} from "./chunk-2W7DAUUS.js";
|
|
4
|
+
import {
|
|
5
|
+
AutoExtractionAdapter
|
|
6
|
+
} from "./chunk-NVHGG7GW.js";
|
|
7
|
+
import {
|
|
8
|
+
BLOCK_BOOST_PER_OCCURRENCE,
|
|
9
|
+
BUILTIN_TOOLS,
|
|
10
|
+
CORE_TOOLS,
|
|
11
|
+
DEFAULT_ENDPOINTS,
|
|
12
|
+
FragmentsJsonAdapter,
|
|
13
|
+
INFRA_TOOLS,
|
|
14
|
+
MINIMUM_SCORE_THRESHOLD,
|
|
15
|
+
SYNONYM_MAP,
|
|
16
|
+
ToolRegistry,
|
|
17
|
+
USE_CASE_TOKEN_CATEGORIES,
|
|
18
|
+
VIEWER_TOOLS,
|
|
19
|
+
createMcpServer,
|
|
20
|
+
createSandboxServer,
|
|
21
|
+
executeWithMiddleware,
|
|
22
|
+
startMcpServer,
|
|
23
|
+
telemetryMiddleware
|
|
24
|
+
} from "./chunk-WBOVO43F.js";
|
|
25
|
+
import {
|
|
26
|
+
BRAND
|
|
27
|
+
} from "./chunk-4SVS3AA3.js";
|
|
28
|
+
import {
|
|
29
|
+
loadConfigFile
|
|
30
|
+
} from "./chunk-FGIBLPSU.js";
|
|
31
|
+
|
|
32
|
+
// src/adapters/custom-json.ts
|
|
33
|
+
import { readFile } from "fs/promises";
|
|
34
|
+
import { existsSync } from "fs";
|
|
35
|
+
var CustomJsonAdapter = class {
|
|
36
|
+
constructor(filePath) {
|
|
37
|
+
this.filePath = filePath;
|
|
38
|
+
}
|
|
39
|
+
name = "custom-json";
|
|
40
|
+
discover() {
|
|
41
|
+
return existsSync(this.filePath) ? [this.filePath] : [];
|
|
42
|
+
}
|
|
43
|
+
async load(_projectRoot = "") {
|
|
44
|
+
if (!existsSync(this.filePath)) {
|
|
45
|
+
throw new Error(`Custom data file not found: ${this.filePath}`);
|
|
46
|
+
}
|
|
47
|
+
const content = await readFile(this.filePath, "utf-8");
|
|
48
|
+
const raw = JSON.parse(content);
|
|
49
|
+
if (!raw.components || typeof raw.components !== "object") {
|
|
50
|
+
throw new Error(
|
|
51
|
+
`Invalid design system data: "components" field is required and must be an object. File: ${this.filePath}`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
components: raw.components,
|
|
56
|
+
blocks: raw.blocks,
|
|
57
|
+
tokens: raw.tokens,
|
|
58
|
+
graph: raw.graph,
|
|
59
|
+
performanceSummary: raw.performanceSummary,
|
|
60
|
+
packageMap: new Map(
|
|
61
|
+
raw.packageMap ? Object.entries(raw.packageMap) : []
|
|
62
|
+
),
|
|
63
|
+
defaultPackageName: raw.defaultPackageName
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/search-config.ts
|
|
69
|
+
var DEFAULT_SEARCH_CONFIG = {
|
|
70
|
+
synonyms: SYNONYM_MAP,
|
|
71
|
+
useCaseTokenCategories: USE_CASE_TOKEN_CATEGORIES,
|
|
72
|
+
minimumScoreThreshold: MINIMUM_SCORE_THRESHOLD,
|
|
73
|
+
blockBoostPerOccurrence: BLOCK_BOOST_PER_OCCURRENCE,
|
|
74
|
+
vectorSearchUrl: "https://combative-jay-834.convex.site/search",
|
|
75
|
+
vectorSearchTimeoutMs: 3e3
|
|
76
|
+
};
|
|
77
|
+
export {
|
|
78
|
+
AutoExtractionAdapter,
|
|
79
|
+
BRAND,
|
|
80
|
+
BUILTIN_TOOLS,
|
|
81
|
+
CORE_TOOLS,
|
|
82
|
+
CustomJsonAdapter,
|
|
83
|
+
DEFAULT_ENDPOINTS,
|
|
84
|
+
DEFAULT_SEARCH_CONFIG,
|
|
85
|
+
FragmentsJsonAdapter,
|
|
86
|
+
INFRA_TOOLS,
|
|
87
|
+
ToolRegistry,
|
|
88
|
+
VIEWER_TOOLS,
|
|
89
|
+
createMcpServer,
|
|
90
|
+
createSandboxServer,
|
|
91
|
+
executeWithMiddleware,
|
|
92
|
+
generateRulesFiles,
|
|
93
|
+
loadConfigFile,
|
|
94
|
+
startMcpServer,
|
|
95
|
+
telemetryMiddleware
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/adapters/custom-json.ts","../src/search-config.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { existsSync } from 'node:fs';\nimport type { DesignSystemData } from '../types.js';\nimport type { DataAdapter } from './types.js';\n\nexport class CustomJsonAdapter implements DataAdapter {\n readonly name = 'custom-json';\n\n constructor(private filePath: string) {}\n\n discover(): string[] {\n return existsSync(this.filePath) ? [this.filePath] : [];\n }\n\n async load(_projectRoot = ''): Promise<DesignSystemData> {\n if (!existsSync(this.filePath)) {\n throw new Error(`Custom data file not found: ${this.filePath}`);\n }\n\n const content = await readFile(this.filePath, 'utf-8');\n const raw = JSON.parse(content) as Record<string, unknown>;\n\n // Validate required fields\n if (!raw.components || typeof raw.components !== 'object') {\n throw new Error(\n `Invalid design system data: \"components\" field is required and must be an object. ` +\n `File: ${this.filePath}`\n );\n }\n\n return {\n components: raw.components as DesignSystemData['components'],\n blocks: raw.blocks as DesignSystemData['blocks'],\n tokens: raw.tokens as DesignSystemData['tokens'],\n graph: raw.graph as DesignSystemData[\"graph\"],\n performanceSummary: raw.performanceSummary,\n packageMap: new Map(\n raw.packageMap\n ? Object.entries(raw.packageMap as Record<string, string>)\n : []\n ),\n defaultPackageName: raw.defaultPackageName as string | undefined,\n };\n }\n}\n","import { SYNONYM_MAP, USE_CASE_TOKEN_CATEGORIES } from './orama-index.js';\nimport { MINIMUM_SCORE_THRESHOLD, BLOCK_BOOST_PER_OCCURRENCE } from './scoring.js';\n\nexport interface SearchConfig {\n synonyms?: Record<string, string[]>;\n useCaseTokenCategories?: Record<string, string[]>;\n minimumScoreThreshold?: number;\n blockBoostPerOccurrence?: number;\n vectorSearchUrl?: string;\n vectorSearchTimeoutMs?: number;\n}\n\nexport const DEFAULT_SEARCH_CONFIG: Required<SearchConfig> = {\n synonyms: SYNONYM_MAP,\n useCaseTokenCategories: USE_CASE_TOKEN_CATEGORIES,\n minimumScoreThreshold: MINIMUM_SCORE_THRESHOLD,\n blockBoostPerOccurrence: BLOCK_BOOST_PER_OCCURRENCE,\n vectorSearchUrl: 'https://combative-jay-834.convex.site/search',\n vectorSearchTimeoutMs: 3000,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAIpB,IAAM,oBAAN,MAA+C;AAAA,EAGpD,YAAoB,UAAkB;AAAlB;AAAA,EAAmB;AAAA,EAF9B,OAAO;AAAA,EAIhB,WAAqB;AACnB,WAAO,WAAW,KAAK,QAAQ,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC;AAAA,EACxD;AAAA,EAEA,MAAM,KAAK,eAAe,IAA+B;AACvD,QAAI,CAAC,WAAW,KAAK,QAAQ,GAAG;AAC9B,YAAM,IAAI,MAAM,+BAA+B,KAAK,QAAQ,EAAE;AAAA,IAChE;AAEA,UAAM,UAAU,MAAM,SAAS,KAAK,UAAU,OAAO;AACrD,UAAM,MAAM,KAAK,MAAM,OAAO;AAG9B,QAAI,CAAC,IAAI,cAAc,OAAO,IAAI,eAAe,UAAU;AACzD,YAAM,IAAI;AAAA,QACR,2FACS,KAAK,QAAQ;AAAA,MACxB;AAAA,IACF;AAEA,WAAO;AAAA,MACL,YAAY,IAAI;AAAA,MAChB,QAAQ,IAAI;AAAA,MACZ,QAAQ,IAAI;AAAA,MACZ,OAAO,IAAI;AAAA,MACX,oBAAoB,IAAI;AAAA,MACxB,YAAY,IAAI;AAAA,QACd,IAAI,aACA,OAAO,QAAQ,IAAI,UAAoC,IACvD,CAAC;AAAA,MACP;AAAA,MACA,oBAAoB,IAAI;AAAA,IAC1B;AAAA,EACF;AACF;;;AChCO,IAAM,wBAAgD;AAAA,EAC3D,UAAU;AAAA,EACV,wBAAwB;AAAA,EACxB,uBAAuB;AAAA,EACvB,yBAAyB;AAAA,EACzB,iBAAiB;AAAA,EACjB,uBAAuB;AACzB;","names":[]}
|
package/dist/init.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// src/init.ts
|
|
2
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
3
|
+
import { join, dirname, relative } from "path";
|
|
4
|
+
var SERVER_ENTRY = {
|
|
5
|
+
command: "npx",
|
|
6
|
+
args: ["-y", "@fragments-sdk/mcp@latest"]
|
|
7
|
+
};
|
|
8
|
+
var CLIENT_TARGETS = [
|
|
9
|
+
{
|
|
10
|
+
name: "Claude Code",
|
|
11
|
+
key: "claude",
|
|
12
|
+
configPath: (root) => join(root, ".mcp.json"),
|
|
13
|
+
wrapperKey: "mcpServers",
|
|
14
|
+
serverEntry: SERVER_ENTRY
|
|
15
|
+
// Always offered — Claude Code uses a dotfile, no directory to detect.
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "Cursor",
|
|
19
|
+
key: "cursor",
|
|
20
|
+
configPath: (root) => join(root, ".cursor", "mcp.json"),
|
|
21
|
+
wrapperKey: "mcpServers",
|
|
22
|
+
serverEntry: SERVER_ENTRY,
|
|
23
|
+
detectDir: (root) => join(root, ".cursor")
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "VS Code",
|
|
27
|
+
key: "vscode",
|
|
28
|
+
configPath: (root) => join(root, ".vscode", "mcp.json"),
|
|
29
|
+
wrapperKey: "servers",
|
|
30
|
+
serverEntry: { type: "stdio", ...SERVER_ENTRY },
|
|
31
|
+
detectDir: (root) => join(root, ".vscode")
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "Windsurf",
|
|
35
|
+
key: "windsurf",
|
|
36
|
+
configPath: (root) => join(root, ".windsurf", "mcp.json"),
|
|
37
|
+
wrapperKey: "mcpServers",
|
|
38
|
+
serverEntry: SERVER_ENTRY,
|
|
39
|
+
detectDir: (root) => join(root, ".windsurf")
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
function hasFragmentsMcp(servers) {
|
|
43
|
+
return Object.values(servers).some((server) => {
|
|
44
|
+
const s = server;
|
|
45
|
+
return s.args?.some((arg) => arg.includes("@fragments-sdk/mcp"));
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function writeConfig(configPath, target) {
|
|
49
|
+
if (existsSync(configPath)) {
|
|
50
|
+
try {
|
|
51
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
52
|
+
const config2 = JSON.parse(raw);
|
|
53
|
+
const servers = config2[target.wrapperKey] || {};
|
|
54
|
+
if (servers.fragments || hasFragmentsMcp(servers)) {
|
|
55
|
+
return "exists";
|
|
56
|
+
}
|
|
57
|
+
servers.fragments = target.serverEntry;
|
|
58
|
+
config2[target.wrapperKey] = servers;
|
|
59
|
+
writeFileSync(configPath, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
60
|
+
return "added";
|
|
61
|
+
} catch {
|
|
62
|
+
return "could not parse existing config";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
66
|
+
const config = { [target.wrapperKey]: { fragments: target.serverEntry } };
|
|
67
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
68
|
+
return "created";
|
|
69
|
+
}
|
|
70
|
+
function runInit(options) {
|
|
71
|
+
const { projectRoot } = options;
|
|
72
|
+
let targets;
|
|
73
|
+
if (options.clients?.length) {
|
|
74
|
+
const valid = new Set(CLIENT_TARGETS.map((t) => t.key));
|
|
75
|
+
for (const c of options.clients) {
|
|
76
|
+
if (!valid.has(c)) {
|
|
77
|
+
console.error(`Unknown client "${c}". Valid: ${[...valid].join(", ")}`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
targets = CLIENT_TARGETS.filter((t) => options.clients.includes(t.key));
|
|
82
|
+
} else {
|
|
83
|
+
targets = CLIENT_TARGETS.filter((t) => {
|
|
84
|
+
if (t.key === "claude") return true;
|
|
85
|
+
return t.detectDir ? existsSync(t.detectDir(projectRoot)) : false;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (targets.length === 0) {
|
|
89
|
+
console.log(
|
|
90
|
+
"No MCP clients detected. Use --client to specify: claude, cursor, vscode, windsurf"
|
|
91
|
+
);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
console.log("\nFragments MCP \u2014 Init\n");
|
|
95
|
+
let configured = 0;
|
|
96
|
+
let skipped = 0;
|
|
97
|
+
for (const target of targets) {
|
|
98
|
+
const configPath = target.configPath(projectRoot);
|
|
99
|
+
const rel = relative(projectRoot, configPath) || configPath;
|
|
100
|
+
const result = writeConfig(configPath, target);
|
|
101
|
+
if (result === "created") {
|
|
102
|
+
console.log(` + ${target.name} \u2192 ${rel} (created)`);
|
|
103
|
+
configured++;
|
|
104
|
+
} else if (result === "added") {
|
|
105
|
+
console.log(` + ${target.name} \u2192 ${rel} (updated)`);
|
|
106
|
+
configured++;
|
|
107
|
+
} else if (result === "exists") {
|
|
108
|
+
console.log(` \xB7 ${target.name} \u2014 already configured`);
|
|
109
|
+
skipped++;
|
|
110
|
+
} else {
|
|
111
|
+
console.log(` ! ${target.name} \u2014 ${result}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const hasFragmentsJson = existsSync(join(projectRoot, "fragments.json"));
|
|
115
|
+
const hasTsConfig = existsSync(join(projectRoot, "tsconfig.json")) || existsSync(join(projectRoot, "tsconfig.app.json"));
|
|
116
|
+
console.log();
|
|
117
|
+
if (hasFragmentsJson) {
|
|
118
|
+
console.log(" Mode: fragments.json (compiled definitions)");
|
|
119
|
+
} else if (hasTsConfig) {
|
|
120
|
+
console.log(" Mode: auto-extraction (zero-config)");
|
|
121
|
+
} else {
|
|
122
|
+
console.log(" Mode: will auto-detect on first run");
|
|
123
|
+
}
|
|
124
|
+
console.log();
|
|
125
|
+
if (configured > 0) {
|
|
126
|
+
console.log(` Done \u2014 configured ${configured} client(s).`);
|
|
127
|
+
} else {
|
|
128
|
+
console.log(" Already configured \u2014 no changes needed.");
|
|
129
|
+
}
|
|
130
|
+
console.log();
|
|
131
|
+
console.log(" Next steps:");
|
|
132
|
+
console.log(" 1. Restart your editor to activate the MCP server");
|
|
133
|
+
console.log(' 2. Ask your AI assistant: "What components are available?"');
|
|
134
|
+
console.log();
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
runInit
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/init.ts"],"sourcesContent":["/**\n * `fragments-mcp init` — write MCP config for detected AI clients.\n *\n * Auto-detects Claude Code, Cursor, VS Code, and Windsurf, then merges a\n * \"fragments\" server entry into each client's config file. Idempotent —\n * skips clients that already have the server configured.\n */\n\nimport { existsSync, readFileSync, writeFileSync, mkdirSync } from \"node:fs\";\nimport { join, dirname, relative } from \"node:path\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type Client = \"claude\" | \"cursor\" | \"vscode\" | \"windsurf\";\n\ninterface ClientTarget {\n name: string;\n key: Client;\n /** Absolute path to the MCP config file. */\n configPath: (root: string) => string;\n /** Top-level key that holds server entries (\"mcpServers\" or \"servers\"). */\n wrapperKey: string;\n /** The server entry to write. */\n serverEntry: Record<string, unknown>;\n /** Directory whose existence signals the client is in use (optional). */\n detectDir?: (root: string) => string;\n}\n\nexport interface InitOptions {\n projectRoot: string;\n /** Explicit client list — overrides auto-detection. */\n clients?: Client[];\n}\n\n// ---------------------------------------------------------------------------\n// Client definitions\n// ---------------------------------------------------------------------------\n\nconst SERVER_ENTRY = {\n command: \"npx\",\n args: [\"-y\", \"@fragments-sdk/mcp@latest\"],\n};\n\nconst CLIENT_TARGETS: ClientTarget[] = [\n {\n name: \"Claude Code\",\n key: \"claude\",\n configPath: (root) => join(root, \".mcp.json\"),\n wrapperKey: \"mcpServers\",\n serverEntry: SERVER_ENTRY,\n // Always offered — Claude Code uses a dotfile, no directory to detect.\n },\n {\n name: \"Cursor\",\n key: \"cursor\",\n configPath: (root) => join(root, \".cursor\", \"mcp.json\"),\n wrapperKey: \"mcpServers\",\n serverEntry: SERVER_ENTRY,\n detectDir: (root) => join(root, \".cursor\"),\n },\n {\n name: \"VS Code\",\n key: \"vscode\",\n configPath: (root) => join(root, \".vscode\", \"mcp.json\"),\n wrapperKey: \"servers\",\n serverEntry: { type: \"stdio\", ...SERVER_ENTRY },\n detectDir: (root) => join(root, \".vscode\"),\n },\n {\n name: \"Windsurf\",\n key: \"windsurf\",\n configPath: (root) => join(root, \".windsurf\", \"mcp.json\"),\n wrapperKey: \"mcpServers\",\n serverEntry: SERVER_ENTRY,\n detectDir: (root) => join(root, \".windsurf\"),\n },\n];\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction hasFragmentsMcp(servers: Record<string, unknown>): boolean {\n return Object.values(servers).some((server) => {\n const s = server as { args?: string[] };\n return s.args?.some((arg: string) => arg.includes(\"@fragments-sdk/mcp\"));\n });\n}\n\ntype WriteResult = \"created\" | \"added\" | \"exists\" | string;\n\nfunction writeConfig(configPath: string, target: ClientTarget): WriteResult {\n if (existsSync(configPath)) {\n try {\n const raw = readFileSync(configPath, \"utf-8\");\n const config = JSON.parse(raw);\n const servers = config[target.wrapperKey] || {};\n\n if (servers.fragments || hasFragmentsMcp(servers)) {\n return \"exists\";\n }\n\n servers.fragments = target.serverEntry;\n config[target.wrapperKey] = servers;\n writeFileSync(configPath, JSON.stringify(config, null, 2) + \"\\n\", \"utf-8\");\n return \"added\";\n } catch {\n return \"could not parse existing config\";\n }\n }\n\n mkdirSync(dirname(configPath), { recursive: true });\n const config = { [target.wrapperKey]: { fragments: target.serverEntry } };\n writeFileSync(configPath, JSON.stringify(config, null, 2) + \"\\n\", \"utf-8\");\n return \"created\";\n}\n\n// ---------------------------------------------------------------------------\n// Main\n// ---------------------------------------------------------------------------\n\nexport function runInit(options: InitOptions): void {\n const { projectRoot } = options;\n\n // Resolve targets --------------------------------------------------------\n let targets: ClientTarget[];\n\n if (options.clients?.length) {\n const valid = new Set<string>(CLIENT_TARGETS.map((t) => t.key));\n for (const c of options.clients) {\n if (!valid.has(c)) {\n console.error(`Unknown client \"${c}\". Valid: ${[...valid].join(\", \")}`);\n process.exit(1);\n }\n }\n targets = CLIENT_TARGETS.filter((t) => options.clients!.includes(t.key));\n } else {\n // Auto-detect: always include Claude Code + any editors with existing dirs\n targets = CLIENT_TARGETS.filter((t) => {\n if (t.key === \"claude\") return true;\n return t.detectDir ? existsSync(t.detectDir(projectRoot)) : false;\n });\n }\n\n if (targets.length === 0) {\n console.log(\n \"No MCP clients detected. Use --client to specify: claude, cursor, vscode, windsurf\",\n );\n process.exit(1);\n }\n\n // Write configs ----------------------------------------------------------\n console.log(\"\\nFragments MCP \\u2014 Init\\n\");\n\n let configured = 0;\n let skipped = 0;\n\n for (const target of targets) {\n const configPath = target.configPath(projectRoot);\n const rel = relative(projectRoot, configPath) || configPath;\n const result = writeConfig(configPath, target);\n\n if (result === \"created\") {\n console.log(` + ${target.name} \\u2192 ${rel} (created)`);\n configured++;\n } else if (result === \"added\") {\n console.log(` + ${target.name} \\u2192 ${rel} (updated)`);\n configured++;\n } else if (result === \"exists\") {\n console.log(` · ${target.name} \\u2014 already configured`);\n skipped++;\n } else {\n console.log(` ! ${target.name} \\u2014 ${result}`);\n }\n }\n\n // Detection mode ---------------------------------------------------------\n const hasFragmentsJson = existsSync(join(projectRoot, \"fragments.json\"));\n const hasTsConfig =\n existsSync(join(projectRoot, \"tsconfig.json\")) ||\n existsSync(join(projectRoot, \"tsconfig.app.json\"));\n\n console.log();\n if (hasFragmentsJson) {\n console.log(\" Mode: fragments.json (compiled definitions)\");\n } else if (hasTsConfig) {\n console.log(\" Mode: auto-extraction (zero-config)\");\n } else {\n console.log(\" Mode: will auto-detect on first run\");\n }\n\n // Summary ----------------------------------------------------------------\n console.log();\n if (configured > 0) {\n console.log(` Done \\u2014 configured ${configured} client(s).`);\n } else {\n console.log(\" Already configured \\u2014 no changes needed.\");\n }\n\n console.log();\n console.log(\" Next steps:\");\n console.log(\" 1. Restart your editor to activate the MCP server\");\n console.log(' 2. Ask your AI assistant: \"What components are available?\"');\n console.log();\n}\n"],"mappings":";AAQA,SAAS,YAAY,cAAc,eAAe,iBAAiB;AACnE,SAAS,MAAM,SAAS,gBAAgB;AA+BxC,IAAM,eAAe;AAAA,EACnB,SAAS;AAAA,EACT,MAAM,C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