API Reference¶
Welcome to the Tenets API documentation. This section provides comprehensive documentation for all modules, classes, and functions in the Tenets package.
Quick Navigation¶
Core Packages¶
tenets¶
The main package containing core exports and initialization.
tenets.core¶
Core functionality including: - analysis - Multi-language code analysis - distiller - Context aggregation - ranking - Relevance scoring - nlp - NLP utilities - prompt - Prompt analysis - session - Session management
tenets.cli¶
Command-line interface: - app - Main CLI application - commands - Command implementations
tenets.models¶
Data models: - analysis - Analysis results - context - Context structures - tenet - Tenet models - summary - Summary models
tenets.storage¶
Storage backends: - cache - Caching layer - session_db - Session database - sqlite - SQLite backend
tenets.utils¶
Utilities: - scanner - File scanning - tokens - Token counting - logger - Logging utilities
tenets.viz¶
Visualization: - dependencies - Dependency graphs - complexity - Complexity visualization - hotspots - Code hotspots
Usage Examples¶
Basic Usage¶
from tenets import Tenets
# Initialize
tenets = Tenets()
# Build context
result = tenets.distill("implement user authentication")
print(result.content)
Advanced Usage¶
# Direct ranking
from tenets.core.ranking import RelevanceRanker
ranker = RelevanceRanker(algorithm="balanced")
files = ranker.rank(file_list, "add OAuth")
# Code analysis
from tenets.core.analysis import Analyzer
analyzer = Analyzer()
result = analyzer.analyze_file("app.py")
# Session management
from tenets.core.session import SessionManager
session = SessionManager()
session.create("feature-auth")
session.pin_file("auth.py")
Finding Documentation¶
- By Feature: Browse packages above
- By Name: Use the search box
- By Navigation: Use the sidebar tree
Documentation Tips
- Each module page shows all classes and functions
- Look for "Examples" sections in docstrings
- Check return types and parameters for usage hints