Skip to main content
Glama
MIT License
27,120
19,789
  • Linux
  • Apple
CssParseStrategy.ts•1.54 kB
import type { Node } from 'web-tree-sitter'; import type { ParseContext, ParseStrategy } from './ParseStrategy.js'; export class CssParseStrategy implements ParseStrategy { parseCapture( capture: { node: Node; name: string }, lines: string[], processedChunks: Set<string>, _context: ParseContext, ): string | null { const { node, name } = capture; const startRow = node.startPosition.row; const endRow = node.endPosition.row; if (!lines[startRow]) { return null; } // Process CSS-specific capture names const isCommentCapture = name.includes('comment'); const isSelectorCapture = name.includes('selector') || name.includes('definition.selector'); const isAtRuleCapture = name.includes('at_rule') || name.includes('definition.at_rule'); const shouldSelect = isCommentCapture || isSelectorCapture || isAtRuleCapture; if (!shouldSelect) { return null; } // Extract all lines for comments, only the first line for others let selectedLines: string[]; if (isCommentCapture) { selectedLines = lines.slice(startRow, endRow + 1); } else { // For selectors and at-rules, extract only the first line selectedLines = [lines[startRow]]; } if (selectedLines.length < 1) { return null; } const chunk = selectedLines.join('\n'); const normalizedChunk = chunk.trim(); if (processedChunks.has(normalizedChunk)) { return null; } processedChunks.add(normalizedChunk); return chunk; } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yamadashy/repomix'

If you have feedback or need assistance with the MCP directory API, please join our Discord server