Skip to content

refactor: split constants.py (2876 lines) into submodules #501

Description

@vitali87

Problem

codebase_rag/constants.py is 2876 lines, far exceeding the project's 700-line soft limit. It contains unrelated concerns: file extensions, tree-sitter AST node types, CLI messages, language metadata, C++ operator maps, stdlib type maps, color enums, and more.

Suggested Structure

Split into a constants/ submodule:

  • constants/__init__.py - re-exports for backwards compatibility
  • constants/ast_nodes.py - tree-sitter node type constants (TS_IDENTIFIER, TS_ATTRIBUTE, etc.)
  • constants/languages.py - SupportedLanguage, language metadata, file extensions
  • constants/operators.py - C++ operator maps, stdlib type maps
  • constants/graph.py - NodeLabel, RelationshipType, key names
  • constants/cli.py - Color, StyleModifier, CLI messages, UI formatting

Affected Files

  • codebase_rag/constants.py (source of split)
  • All files importing from codebase_rag.constants or using the cs alias (widespread)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions