diff --git a/docs/introduction/overview.mdx b/docs/introduction/overview.mdx index 8a84cd868..85563b910 100644 --- a/docs/introduction/overview.mdx +++ b/docs/introduction/overview.mdx @@ -36,18 +36,24 @@ def baz(): pass ` - + +```python +from codegen import Codebase + +# Codegen builds a complete graph connecting +# functions, classes, imports and their relationships +codebase = Codebase("./") + +# Work with code without dealing with syntax trees or parsing +for function in codebase.functions: + # Comprehensive static analysis for references, dependencies, etc. + if not function.usages: + # Auto-handles references and imports to maintain correctness + function.remove() + +# Fast, in-memory code index +codebase.commit() +``` Codegen handles complex refactors while maintaining correctness, enabling a broad set of advanced code manipulation programs.