cintraai-coding-assistant[bot] commited on
Commit
bc13d11
·
unverified ·
1 Parent(s): a8328c1

Created codebase documentation file to assist with context-based code generation.

Browse files
Files changed (1) hide show
  1. cintra/documentation.json +7 -0
cintra/documentation.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "Chunker.py": "Description: This file provides functionality for chunking code into manageable segments based on token limits and breakpoints.\n\nDependencies: CodeParser, Utils\n\nFunctions:\n- Name: chunk\n Description: Divides code into chunks based on token limits and breakpoints.\n Parameters: content (str) - The code content to be chunked, token_limit (int) - The maximum number of tokens allowed in a chunk.\n Returns: dict - A dictionary containing the chunked code segments.\n\n- Name: get_chunk\n Description: Retrieves a specific chunk from the chunked codebase.\n Parameters: chunked_content (dict) - The dictionary of chunked code segments, chunk_number (int) - The number of the desired chunk.\n Returns: str - The code segment corresponding to the specified chunk number.\n\n- Name: print_chunks\n Description: Prints out the chunked code segments with a header for each chunk.\n Parameters: chunks (dict) - The dictionary of chunked code segments.\n Returns: None\n\n- Name: consolidate_chunks_into_file\n Description: Combines all chunked code segments into a single string for output.\n Parameters: chunks (dict) - The dictionary of chunked code segments.\n Returns: str - The consolidated code segments as a single string.\n\n- Name: count_lines\n Description: Counts the number of lines in the consolidated code segments.\n Parameters: consolidated_chunks (str) - The consolidated code segments as a single string.\n Returns: int - The total number of lines in the consolidated code.",
3
+ "CodeParser.py": "Description: This file serves as a code parser for various programming languages, allowing for the extraction of points of interest and comments from code files.\n\nDependencies: os, subprocess, typing, tree_sitter, logging\n\nFunctions:\n- Name: \\_\\_init\\_\\_\n Description: Initializes the CodeParser object with the specified file extensions.\n Parameters: file_extensions (Union[None, List[str], str]) - The file extensions to parse.\n Returns: None\n\n- Name: parse_code\n Description: Parses the provided code based on the file extension.\n Parameters: code (str) - The code to parse, file_extension (str) - The extension of the code file.\n Returns: Union[None, Node] - The root node of the parsed code.\n\n- Name: extract_points_of_interest\n Description: Recursively extracts points of interest from the parsed code.\n Parameters: node (Node) - The current node being processed, file_extension (str) - The extension of the code file.\n Returns: List[Tuple[Node, str]] - A list of tuples containing nodes of interest and their types.\n\n- Name: extract_comments\n Description: Recursively extracts comments from the parsed code.\n Parameters: node (Node) - The current node being processed, file_extension (str) - The extension of the code file.\n Returns: List[Tuple[Node, str]] - A list of tuples containing comments and their types.\n\n- Name: get_lines_for_points_of_interest\n Description: Retrieves the line numbers of points of interest in the code.\n Parameters: code (str) - The code to analyze, file_extension (str) - The extension of the code file.\n Returns: List[int] - A list of line numbers with points of interest.\n\n- Name: get_lines_for_comments\n Description: Retrieves the line numbers of comments in the code.\n Parameters: code (str) - The code to analyze, file_extension (str) - The extension of the code file.\n Returns: List[int] - A list of line numbers with comments.\n\n- Name: print_all_line_types\n Description: Prints the line numbers with their corresponding node types.\n Parameters: code (str) - The code to analyze, file_extension (str) - The extension of the code file.\n Returns: None\n\n- Name: map_line_to_node_type\n Description: Maps line numbers to node types recursively.\n Parameters: node (Node) - The current node being processed, line_to_node_type (Dict) - Mapping of line numbers to node types, depth (int) - The depth of recursion.\n Returns: Dict[int, List[str]] - A dictionary mapping line numbers to node types.\n\n- Name: print_simple_line_numbers_with_code\n Description: Prints the line numbers with their corresponding code lines.\n Parameters: code (str) - The code to display.\n Returns: None",
4
+ "app.py": "Description: This file utilizes the Streamlit library to create a simple user interface for selecting a value and displaying its square.\n\nDependencies: streamlit\n\nFunctions:\n- Name: slider\n Description: Creates a slider widget for selecting a numerical value.\n Parameters: None\n Returns: The selected value (int or float)\n\n- Name: write\n Description: Writes the provided values to the user interface.\n Parameters: values (any) - The values to be displayed.\n Returns: None",
5
+ "test_code_chunker.py": "Description: This file contains unit tests for the CodeChunker class, which is responsible for chunking code files based on token limits.\n\nDependencies: unittest, unittest.mock, Chunker, CodeChunker, load_json, tiktoken, json, os\n\nFunctions:\n- Name: mock_count_tokens\n Description: Mocks the count_tokens function to return the number of tokens in a text string.\n Parameters: string (str) - The text string to count tokens for, encoding_name (str) - The name of the encoding model (default: 'gpt-4').\n Returns: int - The number of tokens in the text string.\n\n- Name: TestCodeChunkerPython\n Description: Python test class for testing code chunking functionality.\n Parameters: N/A\n Returns: N/A\n\n- Name: TestCodeChunkerJavaScript\n Description: JavaScript test class for testing code chunking functionality.\n Parameters: N/A\n Returns: N/A\n\n- Name: TestCodeChunkerCSS\n Description: CSS test class for testing code chunking functionality.\n Parameters: N/A\n Returns: N/A\n\nEach test method within the test classes follows a similar structure:\n- Description: Tests chunking code with specific characteristics (e.g., simple code, routes, models, main, utilities, big class, react component, media query, simple styles).\n- Parameters: py_code/js_code/css_code (str) - The code to be chunked, token_limit (int) - The limit of tokens per chunk.\n- Returns: N/A",
6
+ "utils.py": "Description: This file provides functions for tokenizing text strings and loading JSON files.\n\nDependencies: tiktoken, json\n\nFunctions:\n- Name: count_tokens\n Description: Returns the number of tokens in a text string.\n Parameters: string (str) - The text string to tokenize, encoding_name (str) - The name of the encoding model to use.\n Returns: int - The number of tokens in the text string.\n\n- Name: load_json\n Description: Loads and parses a JSON file.\n Parameters: json_file (str) - The path to the JSON file to load.\n Returns: dict - The parsed JSON data from the file."
7
+ }