cartog-core 0.10.1

Core types and utilities for cartog code graph indexer
Documentation
  • Coverage
  • 15.49%
    11 out of 71 items documented0 out of 20 items with examples
  • Size
  • Source code size: 17.32 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.91 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 1s Average build duration of successful builds.
  • all releases: 49s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • jrollin/cartog
    2 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jrollin

cartog-core

Core types and utilities for the cartog code graph indexer.

Overview

Foundation crate with zero internal dependencies. Defines the shared data model used by all other cartog crates: symbols, edges, and their metadata. Also provides pure utility functions like language detection.

How it works

Stable symbol IDs

Every symbol gets a deterministic ID built from its location in the code structure, not its position in the file:

file_path:kind:qualified_name

The qualified name encodes the parent chain with . separators:

  • Top-level function: src/auth.py:function:validate
  • Method in class: src/auth.py:method:TokenService.validate
  • Nested class: src/auth.py:class:Outer.Inner

This ID is invariant to line movements within a file — renaming or moving lines won't change it, only renaming the symbol or its parent chain will.

Builder pattern

Symbol::new() returns a symbol with sensible defaults (Public visibility, not async, no docstring). Builder-style setters (with_parent, with_signature, with_visibility, with_async, with_docstring) allow incremental customization without a 15-argument constructor.

Language detection

detect_language() maps file extensions to language names (e.g., .py"python", .tsx"tsx", .md"markdown"). It's a pure function with no tree-sitter dependency, which allows lightweight crates like cartog-watch and cartog-lsp to filter files without pulling in grammar crates.

Public API

Export Description
Symbol Code symbol with stable ID, kind, location, signature, visibility
SymbolKind Function, Class, Method, Variable, Import, Interface, Enum, TypeAlias, Trait, Module, Document
Edge Relationship between symbols (source → target)
EdgeKind Calls, Imports, Inherits, References, Raises, Implements, TypeOf
Visibility Public, Private, Protected
FileInfo Indexed file metadata (path, hash, language, symbol count)
ChangesResult Result of a git-changes query
symbol_id() Build a stable symbol ID from components
detect_language() Map file extension to language name

Crate dependencies

None (this is the root of the dependency graph).