├── .codegen
├── .gitignore
└── codemods
│ ├── no_link_backticks
│ └── no_link_backticks.py
│ ├── test_language
│ └── test_language.py
│ └── update_loggers
│ └── update_loggers.py
├── .github
├── CODEOWNERS
├── actions
│ ├── release-pypi
│ │ └── action.yml
│ ├── release-slack-bot
│ │ └── action.yml
│ ├── report
│ │ └── action.yml
│ ├── run-ats
│ │ ├── action.yml
│ │ ├── ats.sh
│ │ └── collect.sh
│ ├── setup-environment
│ │ └── action.yml
│ └── setup-oss-repos
│ │ └── action.yml
├── codecov.yml
├── dependabot.yml
├── pull_request_template.md
├── release.yml
└── workflows
│ ├── auto-release.yml
│ ├── cache-delete.yml
│ ├── generate-docs.yml
│ ├── mypy.yml
│ ├── pre-commit.yml
│ ├── release.yml
│ └── test.yml
├── .gitignore
├── .pre-commit-config.yaml
├── .vscode
└── settings.json.template
├── .watchmanconfig
├── CLA.md
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── README.md
├── architecture
├── 1. plumbing
│ └── file-discovery.md
├── 2. parsing
│ ├── A. Tree Sitter.md
│ ├── B. AST Construction.md
│ └── C. Directory Parsing.md
├── 3. imports-exports
│ ├── A. Imports.md
│ ├── B. Exports.md
│ └── C. TSConfig.md
├── 4. type-analysis
│ ├── A. Type Analysis.md
│ ├── B. Tree Walking.md
│ ├── C. Name Resolution.md
│ ├── D. Chained Attributes.md
│ ├── E. Function Calls.md
│ ├── F. Generics.md
│ ├── G. Subscript Expression.md
│ └── H. Graph Edges.md
├── 5. performing-edits
│ ├── A. Transactions.md
│ └── B. Transaction Manager.md
├── 6. incremental-computation
│ ├── A. Overview.md
│ ├── B. Change Detection.md
│ └── C. Graph Recomputation.md
├── architecture.md
└── external
│ ├── dependency-manager.md
│ └── type-engine.md
├── codegen-examples
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── STRUCTURE.md
├── examples
│ ├── ai_impact_analysis
│ │ ├── README.md
│ │ ├── dashboard
│ │ │ ├── README.md
│ │ │ ├── backend
│ │ │ │ └── api.py
│ │ │ └── frontend
│ │ │ │ ├── app
│ │ │ │ ├── favicon.ico
│ │ │ │ ├── globals.css
│ │ │ │ ├── layout.tsx
│ │ │ │ └── page.tsx
│ │ │ │ ├── components.json
│ │ │ │ ├── components
│ │ │ │ ├── contribution-timeline.tsx
│ │ │ │ ├── contributors-breakdown.tsx
│ │ │ │ ├── dashboard-header.tsx
│ │ │ │ ├── high-impact-symbols.tsx
│ │ │ │ ├── loading-screen.tsx
│ │ │ │ ├── repo-analysis-dashboard.tsx
│ │ │ │ ├── summary-cards.tsx
│ │ │ │ ├── theme-provider.tsx
│ │ │ │ ├── top-ai-files.tsx
│ │ │ │ └── ui
│ │ │ │ │ ├── button.tsx
│ │ │ │ │ ├── card.tsx
│ │ │ │ │ ├── chart.tsx
│ │ │ │ │ ├── input-otp.tsx
│ │ │ │ │ ├── input.tsx
│ │ │ │ │ ├── progress.tsx
│ │ │ │ │ ├── scroll-area.tsx
│ │ │ │ │ ├── skeleton.tsx
│ │ │ │ │ ├── use-mobile.tsx
│ │ │ │ │ └── use-toast.ts
│ │ │ │ ├── hooks
│ │ │ │ ├── use-mobile.tsx
│ │ │ │ └── use-toast.ts
│ │ │ │ ├── lib
│ │ │ │ ├── types.ts
│ │ │ │ └── utils.ts
│ │ │ │ ├── next.config.mjs
│ │ │ │ ├── package-lock.json
│ │ │ │ ├── package.json
│ │ │ │ ├── postcss.config.mjs
│ │ │ │ ├── styles
│ │ │ │ └── globals.css
│ │ │ │ ├── tailwind.config.js
│ │ │ │ └── tsconfig.json
│ │ └── run.py
│ ├── codegen-mcp-server
│ │ ├── README.md
│ │ ├── llms-install.md
│ │ ├── pyproject.toml
│ │ ├── server.py
│ │ └── uv.lock
│ ├── cyclomatic_complexity
│ │ ├── README.md
│ │ └── run.py
│ ├── delete_dead_code
│ │ ├── README.md
│ │ └── run.py
│ ├── dict_to_schema
│ │ ├── README.md
│ │ └── run.py
│ ├── document_functions
│ │ ├── README.md
│ │ └── run.py
│ ├── flask_to_fastapi_migration
│ │ ├── README.md
│ │ ├── input_repo
│ │ │ ├── main.py
│ │ │ ├── static
│ │ │ │ ├── index.html
│ │ │ │ ├── script.js
│ │ │ │ └── style.css
│ │ │ └── templates
│ │ │ │ ├── authors.html
│ │ │ │ ├── books.html
│ │ │ │ ├── categories.html
│ │ │ │ └── index.html
│ │ └── run.py
│ ├── fragment_to_shorthand
│ │ ├── README.md
│ │ └── run.py
│ ├── freezegun_to_timemachine_migration
│ │ ├── README.md
│ │ └── run.py
│ ├── generate_training_data
│ │ ├── README.md
│ │ └── run.py
│ ├── github_checks
│ │ ├── README.md
│ │ └── app.py
│ ├── linear_webhooks
│ │ ├── .env.template
│ │ ├── pyproject.toml
│ │ ├── uv.lock
│ │ └── webhooks.py
│ ├── modal_repo_analytics
│ │ ├── README.md
│ │ ├── api.py
│ │ └── pyproject.toml
│ ├── modal_repo_rag
│ │ ├── README.md
│ │ ├── api.py
│ │ └── pyproject.toml
│ ├── modules_dependencies
│ │ ├── README.md
│ │ └── run.py
│ ├── openapi_decorators
│ │ ├── README.md
│ │ └── run.py
│ ├── promises_to_async_await
│ │ ├── README.md
│ │ ├── convert_promises_twilio_repository.ipynb
│ │ ├── promise_to_async_await_test_cases.ts
│ │ ├── promises_to_async_await.ipynb
│ │ ├── run.py
│ │ └── utils.ts
│ ├── python2_to_python3
│ │ ├── README.md
│ │ ├── input_repo
│ │ │ └── main.py
│ │ └── run.py
│ ├── reexport_management
│ │ ├── README.md
│ │ ├── input_repo
│ │ │ ├── modules
│ │ │ │ ├── module_a
│ │ │ │ │ └── src
│ │ │ │ │ │ ├── functions.ts
│ │ │ │ │ │ └── shared
│ │ │ │ │ │ └── index.ts
│ │ │ │ ├── module_b
│ │ │ │ │ ├── imports.ts
│ │ │ │ │ └── src
│ │ │ │ │ │ ├── functions.ts
│ │ │ │ │ │ └── shared
│ │ │ │ │ │ └── exports.ts
│ │ │ │ └── module_c
│ │ │ │ │ ├── imports.ts
│ │ │ │ │ └── src
│ │ │ │ │ ├── functions.ts
│ │ │ │ │ └── shared
│ │ │ │ │ └── symbols
│ │ │ │ │ └── exports.ts
│ │ │ ├── package.json
│ │ │ └── tsconfig.json
│ │ └── run.py
│ ├── remove_default_exports
│ │ ├── README.md
│ │ ├── input_repo
│ │ │ ├── package.json
│ │ │ ├── src
│ │ │ │ ├── auth
│ │ │ │ │ ├── services
│ │ │ │ │ │ └── authenticator.ts
│ │ │ │ │ ├── shared
│ │ │ │ │ │ ├── authenticator.ts
│ │ │ │ │ │ └── token.ts
│ │ │ │ │ └── utils
│ │ │ │ │ │ └── token-generator.ts
│ │ │ │ ├── comments
│ │ │ │ │ ├── models
│ │ │ │ │ │ └── comment.ts
│ │ │ │ │ ├── services
│ │ │ │ │ │ └── comment-service.ts
│ │ │ │ │ └── shared
│ │ │ │ │ │ ├── service.ts
│ │ │ │ │ │ └── types.ts
│ │ │ │ ├── posts
│ │ │ │ │ ├── models
│ │ │ │ │ │ └── post.ts
│ │ │ │ │ ├── services
│ │ │ │ │ │ └── post-service.ts
│ │ │ │ │ └── shared
│ │ │ │ │ │ ├── service.ts
│ │ │ │ │ │ └── types.ts
│ │ │ │ ├── shared
│ │ │ │ │ └── index.ts
│ │ │ │ └── users
│ │ │ │ │ ├── models
│ │ │ │ │ └── user.ts
│ │ │ │ │ ├── services
│ │ │ │ │ └── user-service.ts
│ │ │ │ │ └── shared
│ │ │ │ │ ├── service.ts
│ │ │ │ │ └── types.ts
│ │ │ └── tsconfig.json
│ │ └── run.py
│ ├── removing_import_loops_in_pytorch
│ │ ├── import_loops.ipynb
│ │ └── utils.py
│ ├── repo_analytics
│ │ ├── README.md
│ │ └── run.py
│ ├── slack_chatbot
│ │ ├── .env.template
│ │ ├── README.md
│ │ ├── api.py
│ │ ├── pyproject.toml
│ │ └── uv.lock
│ ├── sqlalchemy_1.6_to_2.0
│ │ ├── README.md
│ │ ├── input_repo
│ │ │ ├── database.py
│ │ │ ├── main.py
│ │ │ ├── models.py
│ │ │ └── schemas.py
│ │ └── run.py
│ ├── sqlalchemy_soft_delete
│ │ ├── README.md
│ │ └── run.py
│ ├── sqlalchemy_type_annotations
│ │ ├── README.md
│ │ ├── input_repo
│ │ │ ├── README.md
│ │ │ ├── config
│ │ │ │ └── settings.py
│ │ │ ├── database
│ │ │ │ └── connection.py
│ │ │ └── models
│ │ │ │ ├── base.py
│ │ │ │ ├── organization.py
│ │ │ │ ├── transaction.py
│ │ │ │ └── user.py
│ │ └── run.py
│ ├── swebench_agent_run
│ │ ├── .env.template
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── constants.py
│ │ ├── entry_point.py
│ │ ├── local_run.ipynb
│ │ ├── pyproject.toml
│ │ ├── run_eval.py
│ │ └── test.py
│ ├── symbol-attributions
│ │ ├── README.md
│ │ └── run.py
│ ├── unittest_to_pytest
│ │ ├── README.md
│ │ ├── input_repo
│ │ │ ├── jj_classes
│ │ │ │ ├── castle.py
│ │ │ │ └── character.py
│ │ │ ├── run_tests.py
│ │ │ └── tests
│ │ │ │ ├── __init__.py
│ │ │ │ └── test_classes.py
│ │ └── run.py
│ ├── usesuspensequery_to_usesuspensequeries
│ │ ├── README.md
│ │ └── run.py
│ └── visualize_codebases
│ │ ├── README.md
│ │ ├── blast_radius.py
│ │ ├── call_trace.py
│ │ ├── dependency_trace.py
│ │ └── method_relationships.py
├── pyproject.toml
└── uv.lock
├── docs
├── .gitignore
├── README.md
├── _deprecated
│ ├── api-reference
│ │ ├── core
│ │ │ ├── Argument.mdx
│ │ │ ├── Assignment.mdx
│ │ │ ├── AssignmentStatement.mdx
│ │ │ ├── Attribute.mdx
│ │ │ ├── AwaitExpression.mdx
│ │ │ ├── BinaryExpression.mdx
│ │ │ ├── BlockStatement.mdx
│ │ │ ├── Boolean.mdx
│ │ │ ├── Callable.mdx
│ │ │ ├── CatchStatement.mdx
│ │ │ ├── ChainedAttribute.mdx
│ │ │ ├── Class.mdx
│ │ │ ├── CodeBlock.mdx
│ │ │ ├── CodeOwner.mdx
│ │ │ ├── Codebase.mdx
│ │ │ ├── Comment.mdx
│ │ │ ├── CommentGroup.mdx
│ │ │ ├── ComparisonExpression.mdx
│ │ │ ├── Decorator.mdx
│ │ │ ├── Dict.mdx
│ │ │ ├── Directory.mdx
│ │ │ ├── Editable.mdx
│ │ │ ├── Export.mdx
│ │ │ ├── ExportStatement.mdx
│ │ │ ├── Exportable.mdx
│ │ │ ├── Expression.mdx
│ │ │ ├── ExpressionGroup.mdx
│ │ │ ├── ExpressionStatement.mdx
│ │ │ ├── ExternalModule.mdx
│ │ │ ├── File.mdx
│ │ │ ├── FlagKwargs.mdx
│ │ │ ├── ForLoopStatement.mdx
│ │ │ ├── Function.mdx
│ │ │ ├── FunctionCall.mdx
│ │ │ ├── GenericType.mdx
│ │ │ ├── HasBlock.mdx
│ │ │ ├── HasName.mdx
│ │ │ ├── HasValue.mdx
│ │ │ ├── IfBlockStatement.mdx
│ │ │ ├── Import.mdx
│ │ │ ├── ImportStatement.mdx
│ │ │ ├── ImportType.mdx
│ │ │ ├── Importable.mdx
│ │ │ ├── Interface.mdx
│ │ │ ├── List.mdx
│ │ │ ├── MessageType.mdx
│ │ │ ├── MultiExpression.mdx
│ │ │ ├── MultiLineCollection.mdx
│ │ │ ├── Name.mdx
│ │ │ ├── NamedType.mdx
│ │ │ ├── NoneType.mdx
│ │ │ ├── Number.mdx
│ │ │ ├── Pair.mdx
│ │ │ ├── Parameter.mdx
│ │ │ ├── ParenthesizedExpression.mdx
│ │ │ ├── Placeholder.mdx
│ │ │ ├── PlaceholderType.mdx
│ │ │ ├── RaiseStatement.mdx
│ │ │ ├── ReturnStatement.mdx
│ │ │ ├── SourceFile.mdx
│ │ │ ├── Span.mdx
│ │ │ ├── Statement.mdx
│ │ │ ├── StatementType.mdx
│ │ │ ├── String.mdx
│ │ │ ├── StubPlaceholder.mdx
│ │ │ ├── SubscriptExpression.mdx
│ │ │ ├── SwitchCase.mdx
│ │ │ ├── SwitchStatement.mdx
│ │ │ ├── Symbol.mdx
│ │ │ ├── SymbolGroup.mdx
│ │ │ ├── SymbolStatement.mdx
│ │ │ ├── TernaryExpression.mdx
│ │ │ ├── TryCatchStatement.mdx
│ │ │ ├── Tuple.mdx
│ │ │ ├── TupleType.mdx
│ │ │ ├── Type.mdx
│ │ │ ├── TypeAlias.mdx
│ │ │ ├── TypePlaceholder.mdx
│ │ │ ├── Typeable.mdx
│ │ │ ├── UnaryExpression.mdx
│ │ │ ├── UnionType.mdx
│ │ │ ├── Unpack.mdx
│ │ │ ├── Unwrappable.mdx
│ │ │ ├── Usable.mdx
│ │ │ ├── Usage.mdx
│ │ │ ├── UsageKind.mdx
│ │ │ ├── UsageType.mdx
│ │ │ ├── Value.mdx
│ │ │ ├── WhileStatement.mdx
│ │ │ └── WithStatement.mdx
│ │ ├── index.mdx
│ │ ├── python
│ │ │ ├── PyAssignment.mdx
│ │ │ ├── PyAssignmentStatement.mdx
│ │ │ ├── PyAttribute.mdx
│ │ │ ├── PyBlockStatement.mdx
│ │ │ ├── PyBreakStatement.mdx
│ │ │ ├── PyCatchStatement.mdx
│ │ │ ├── PyChainedAttribute.mdx
│ │ │ ├── PyClass.mdx
│ │ │ ├── PyCodeBlock.mdx
│ │ │ ├── PyComment.mdx
│ │ │ ├── PyCommentGroup.mdx
│ │ │ ├── PyCommentType.mdx
│ │ │ ├── PyConditionalExpression.mdx
│ │ │ ├── PyDecorator.mdx
│ │ │ ├── PyFile.mdx
│ │ │ ├── PyForLoopStatement.mdx
│ │ │ ├── PyFunction.mdx
│ │ │ ├── PyGenericType.mdx
│ │ │ ├── PyHasBlock.mdx
│ │ │ ├── PyIfBlockStatement.mdx
│ │ │ ├── PyImport.mdx
│ │ │ ├── PyImportStatement.mdx
│ │ │ ├── PyMatchCase.mdx
│ │ │ ├── PyMatchStatement.mdx
│ │ │ ├── PyNamedType.mdx
│ │ │ ├── PyParameter.mdx
│ │ │ ├── PyPassStatement.mdx
│ │ │ ├── PyReturnTypePlaceholder.mdx
│ │ │ ├── PyString.mdx
│ │ │ ├── PySymbol.mdx
│ │ │ ├── PyTryCatchStatement.mdx
│ │ │ ├── PyUnionType.mdx
│ │ │ └── PyWhileStatement.mdx
│ │ └── typescript
│ │ │ ├── JSXElement.mdx
│ │ │ ├── JSXExpression.mdx
│ │ │ ├── JSXProp.mdx
│ │ │ ├── TSArrayType.mdx
│ │ │ ├── TSAssignment.mdx
│ │ │ ├── TSAssignmentStatement.mdx
│ │ │ ├── TSAttribute.mdx
│ │ │ ├── TSBlockStatement.mdx
│ │ │ ├── TSCatchStatement.mdx
│ │ │ ├── TSChainedAttribute.mdx
│ │ │ ├── TSClass.mdx
│ │ │ ├── TSCodeBlock.mdx
│ │ │ ├── TSComment.mdx
│ │ │ ├── TSCommentGroup.mdx
│ │ │ ├── TSCommentType.mdx
│ │ │ ├── TSConditionalType.mdx
│ │ │ ├── TSConfig.mdx
│ │ │ ├── TSDecorator.mdx
│ │ │ ├── TSDict.mdx
│ │ │ ├── TSEnum.mdx
│ │ │ ├── TSExport.mdx
│ │ │ ├── TSExpressionType.mdx
│ │ │ ├── TSFile.mdx
│ │ │ ├── TSForLoopStatement.mdx
│ │ │ ├── TSFunction.mdx
│ │ │ ├── TSFunctionType.mdx
│ │ │ ├── TSGenericType.mdx
│ │ │ ├── TSHasBlock.mdx
│ │ │ ├── TSIfBlockStatement.mdx
│ │ │ ├── TSImport.mdx
│ │ │ ├── TSImportStatement.mdx
│ │ │ ├── TSInterface.mdx
│ │ │ ├── TSLabeledStatement.mdx
│ │ │ ├── TSLookupType.mdx
│ │ │ ├── TSNamedType.mdx
│ │ │ ├── TSNamespace.mdx
│ │ │ ├── TSObjectType.mdx
│ │ │ ├── TSPair.mdx
│ │ │ ├── TSParameter.mdx
│ │ │ ├── TSQueryType.mdx
│ │ │ ├── TSReadonlyType.mdx
│ │ │ ├── TSReturnTypePlaceholder.mdx
│ │ │ ├── TSString.mdx
│ │ │ ├── TSSwitchCase.mdx
│ │ │ ├── TSSwitchStatement.mdx
│ │ │ ├── TSSymbol.mdx
│ │ │ ├── TSTernaryExpression.mdx
│ │ │ ├── TSTryCatchStatement.mdx
│ │ │ ├── TSTypeAlias.mdx
│ │ │ ├── TSUndefinedType.mdx
│ │ │ ├── TSUnionType.mdx
│ │ │ └── TSWhileStatement.mdx
│ ├── building-with-codegen
│ │ ├── at-a-glance.mdx
│ │ ├── calling-out-to-llms.mdx
│ │ ├── class-api.mdx
│ │ ├── codebase-visualization.mdx
│ │ ├── codegen-with-wsl.mdx
│ │ ├── collections.mdx
│ │ ├── comments-and-docstrings.mdx
│ │ ├── commit-and-reset.mdx
│ │ ├── dependencies-and-usages.mdx
│ │ ├── dot-codegen.mdx
│ │ ├── editables-and-behaviors.mdx
│ │ ├── exports.mdx
│ │ ├── external-modules.mdx
│ │ ├── files-and-directories.mdx
│ │ ├── flagging-symbols.mdx
│ │ ├── function-calls-and-callsites.mdx
│ │ ├── function-decorator.mdx
│ │ ├── git-operations.mdx
│ │ ├── imports.mdx
│ │ ├── inheritable-behaviors.mdx
│ │ ├── language-support.mdx
│ │ ├── local-variables.mdx
│ │ ├── moving-symbols.mdx
│ │ ├── parsing-codebases.mdx
│ │ ├── react-and-jsx.mdx
│ │ ├── reducing-conditions.mdx
│ │ ├── reusable-codemods.mdx
│ │ ├── semantic-code-search.mdx
│ │ ├── statements-and-code-blocks.mdx
│ │ ├── symbol-api.mdx
│ │ ├── the-editable-api.mdx
│ │ ├── traversing-the-call-graph.mdx
│ │ ├── type-annotations.mdx
│ │ └── variable-assignments.mdx
│ ├── cli
│ │ ├── about.mdx
│ │ ├── create.mdx
│ │ ├── expert.mdx
│ │ ├── init.mdx
│ │ ├── login.mdx
│ │ ├── notebook.mdx
│ │ ├── reset.mdx
│ │ ├── run.mdx
│ │ └── update.mdx
│ ├── graph-sitter
│ │ ├── about.mdx
│ │ ├── advanced-settings.mdx
│ │ ├── community.mdx
│ │ ├── faq.mdx
│ │ ├── getting-started.mdx
│ │ ├── guiding-principles.mdx
│ │ ├── how-it-works.mdx
│ │ ├── ide-usage.mdx
│ │ ├── installation.mdx
│ │ ├── overview.mdx
│ │ └── work-with-ai.mdx
│ └── tutorials
│ │ ├── at-a-glance.mdx
│ │ ├── attributions.mdx
│ │ ├── build-mcp.mdx
│ │ ├── codebase-analytics-dashboard.mdx
│ │ ├── codebase-visualization.mdx
│ │ ├── converting-default-exports.mdx
│ │ ├── creating-documentation.mdx
│ │ ├── deep-code-research.mdx
│ │ ├── deleting-dead-code.mdx
│ │ ├── fixing-import-loops-in-pytorch.mdx
│ │ ├── flask-to-fastapi.mdx
│ │ ├── increase-type-coverage.mdx
│ │ ├── manage-feature-flags.mdx
│ │ ├── managing-typescript-exports.mdx
│ │ ├── migrating-apis.mdx
│ │ ├── modularity.mdx
│ │ ├── neo4j-graph.mdx
│ │ ├── organize-your-codebase.mdx
│ │ ├── preparing-your-codebase-for-ai.mdx
│ │ ├── promise-to-async-await.mdx
│ │ ├── python2-to-python3.mdx
│ │ ├── react-modernization.mdx
│ │ ├── slack-bot.mdx
│ │ ├── sqlalchemy-1.6-to-2.0.mdx
│ │ ├── training-data.mdx
│ │ └── unittest-to-pytest.mdx
├── agents
│ ├── create-agent-run.mdx
│ └── get-agent-run.mdx
├── api-reference
│ └── openapi3.json
├── blog
│ ├── act-via-code.mdx
│ ├── codemod-frameworks.mdx
│ ├── devin.mdx
│ ├── fixing-import-loops.mdx
│ ├── posts.mdx
│ ├── promise-to-async-await-twilio.mdx
│ └── static-analysis-ai.mdx
├── capabilities
│ ├── capabilities.mdx
│ └── wake-up.mdx
├── changelog
│ └── changelog.mdx
├── conftest.py
├── docs.json
├── favicon.svg
├── gen
│ ├── capabilities.mdx
│ ├── faq.mdx
│ ├── integrations.mdx
│ └── introduction.mdx
├── graph-sitter
│ ├── about.mdx
│ ├── advanced-settings.mdx
│ ├── community.mdx
│ ├── faq.mdx
│ ├── getting-started.mdx
│ ├── guiding-principles.mdx
│ ├── how-it-works.mdx
│ ├── ide-usage.mdx
│ ├── installation.mdx
│ ├── overview.mdx
│ └── work-with-ai.mdx
├── images
│ ├── agent-permissions.png
│ ├── async-await.png
│ ├── blast-radius.png
│ ├── codegen-bot-intro.png
│ ├── codegen-thumbnail.png
│ ├── codegen.jpeg
│ ├── devin-edits-codemod.png
│ ├── explainer-text.png
│ ├── import-loops.png
│ ├── large-import-loop.png
│ ├── linear.png
│ ├── llm-configuration.png
│ ├── mine-amethyst.png
│ ├── neo4j-call-graph.png
│ ├── neo4j-class-hierarchy.png
│ ├── neo4j-class-methods.png
│ ├── neo4j-function-calls.png
│ ├── nether-portal.png
│ ├── problematic-import-loop.png
│ ├── python-extensions.png
│ ├── repo-rules.png
│ ├── sandbox-buttons.png
│ ├── set-interpreter.png
│ ├── setup-commands-ui.png
│ ├── slack.png
│ ├── system-prompt.png
│ ├── twilio-diff-after.png
│ ├── twilio-diff-before.png
│ ├── twilio-then.png
│ ├── valid-import-loop.png
│ ├── voyager-full.png
│ ├── voyager-performance.png
│ ├── voyager-retrieval.png
│ └── voyager.png
├── integrations
│ ├── circleci.mdx
│ ├── figma.mdx
│ ├── github.mdx
│ ├── linear.mdx
│ ├── notion.mdx
│ ├── postgres.mdx
│ ├── slack.mdx
│ └── web-search.mdx
├── introduction
│ ├── about.mdx
│ ├── api.mdx
│ ├── community.mdx
│ ├── faq.mdx
│ ├── guiding-principles.mdx
│ ├── how-it-works.mdx
│ ├── overview.mdx
│ └── prompting.mdx
├── logo
│ ├── dark.svg
│ └── light.svg
├── organizations
│ └── get-organizations.mdx
├── prism.css
├── samples
│ ├── sample.py
│ └── sample.tsx
├── sandboxes
│ ├── base-image.mdx
│ ├── editor.mdx
│ ├── environment-variables.mdx
│ ├── overview.mdx
│ ├── secrets.mdx
│ ├── setup-commands.mdx
│ └── web-preview.mdx
├── settings
│ ├── agent-permissions.mdx
│ ├── model-configuration.mdx
│ ├── organization-rules.mdx
│ ├── repo-rules.mdx
│ └── repo-rules.tsx
├── snippets
│ ├── Attribute.mdx
│ ├── GithubLinkNote.mdx
│ ├── HorizontalDivider.mdx
│ ├── Parameter.mdx
│ ├── ParameterWrapper.mdx
│ ├── Return.mdx
│ └── links.mdx
├── style.css
├── use-cases
│ ├── I. Upgrading APIs.md
│ ├── II. Improving Codebase Modularity.md
│ ├── III. Improving Type Coverage.md
│ └── IV. Analyzing Critical Code Paths.md
└── users
│ ├── get-user.mdx
│ └── get-users.mdx
├── examples.md
├── hatch.toml
├── install-hooks.sh
├── mypy.ini
├── package.json
├── pyproject.toml
├── renovate.json5
├── ruff.toml
├── scripts
├── disallowed-words-check.sh
├── install-deps.sh
├── profiling
│ ├── apis.py
│ └── profile.py
└── setup.sh
├── src
├── HIRING.md
├── codegen
│ ├── __init__.py
│ ├── agents
│ │ ├── README.md
│ │ ├── __init__.py
│ │ ├── agent.py
│ │ └── constants.py
│ ├── cli
│ │ ├── README.md
│ │ ├── __init__.py
│ │ ├── _env.py
│ │ ├── api
│ │ │ ├── client.py
│ │ │ ├── endpoints.py
│ │ │ ├── modal.py
│ │ │ ├── schemas.py
│ │ │ └── webapp_routes.py
│ │ ├── auth
│ │ │ ├── constants.py
│ │ │ ├── decorators.py
│ │ │ ├── login.py
│ │ │ ├── session.ipynb
│ │ │ ├── session.py
│ │ │ ├── token_manager.ipynb
│ │ │ └── token_manager.py
│ │ ├── cli.py
│ │ ├── codemod
│ │ │ └── convert.py
│ │ ├── commands
│ │ │ ├── config
│ │ │ │ └── main.py
│ │ │ ├── create
│ │ │ │ └── main.py
│ │ │ ├── deploy
│ │ │ │ └── main.py
│ │ │ ├── expert
│ │ │ │ └── main.py
│ │ │ ├── init
│ │ │ │ ├── main.py
│ │ │ │ └── render.py
│ │ │ ├── list
│ │ │ │ └── main.py
│ │ │ ├── login
│ │ │ │ └── main.py
│ │ │ ├── logout
│ │ │ │ └── main.py
│ │ │ ├── lsp
│ │ │ │ └── lsp.py
│ │ │ ├── notebook
│ │ │ │ └── main.py
│ │ │ ├── profile
│ │ │ │ └── main.py
│ │ │ ├── reset
│ │ │ │ └── main.py
│ │ │ ├── run
│ │ │ │ ├── main.ipynb
│ │ │ │ ├── main.py
│ │ │ │ ├── render.ipynb
│ │ │ │ ├── render.py
│ │ │ │ ├── run_cloud.py
│ │ │ │ ├── run_daemon.py
│ │ │ │ └── run_local.py
│ │ │ ├── run_on_pr
│ │ │ │ └── main.py
│ │ │ ├── serve
│ │ │ │ └── main.py
│ │ │ ├── start
│ │ │ │ ├── Dockerfile
│ │ │ │ ├── docker_container.py
│ │ │ │ ├── docker_fleet.py
│ │ │ │ └── main.py
│ │ │ ├── style_debug
│ │ │ │ └── main.py
│ │ │ └── update
│ │ │ │ └── main.py
│ │ ├── env
│ │ │ ├── constants.py
│ │ │ ├── enums.py
│ │ │ ├── global_env.ipynb
│ │ │ └── global_env.py
│ │ ├── errors.py
│ │ ├── git
│ │ │ ├── folder.py
│ │ │ ├── patch.ipynb
│ │ │ ├── patch.py
│ │ │ ├── reop.ipynb
│ │ │ ├── repo.py
│ │ │ └── url.ipynb
│ │ ├── mcp
│ │ │ ├── README.md
│ │ │ ├── resources
│ │ │ │ ├── system_prompt.py
│ │ │ │ └── system_setup_instructions.py
│ │ │ └── server.py
│ │ ├── rich
│ │ │ ├── codeblocks.py
│ │ │ ├── pretty_print.py
│ │ │ └── spinners.py
│ │ ├── sdk
│ │ │ ├── __init__.py
│ │ │ ├── decorator.py
│ │ │ ├── function.py
│ │ │ ├── functions.py
│ │ │ ├── models.py
│ │ │ └── pull_request.py
│ │ ├── utils
│ │ │ ├── codemod_manager.py
│ │ │ ├── codemods.py
│ │ │ ├── count_functions.py
│ │ │ ├── count_functions_2.py
│ │ │ ├── default_code.py
│ │ │ ├── function_finder.py
│ │ │ ├── json_schema.py
│ │ │ ├── notebooks.py
│ │ │ ├── schema.ipynb
│ │ │ ├── schema.py
│ │ │ └── url.py
│ │ └── workspace
│ │ │ ├── decorators.py
│ │ │ ├── docs_workspace.py
│ │ │ ├── examples_workspace.py
│ │ │ ├── initialize_workspace.py
│ │ │ └── venv_manager.py
│ ├── configs
│ │ ├── constants.py
│ │ ├── models
│ │ │ ├── base_config.py
│ │ │ ├── codebase.py
│ │ │ ├── repository.py
│ │ │ ├── secrets.py
│ │ │ └── utils.py
│ │ ├── session_manager.py
│ │ └── user_config.py
│ ├── extensions
│ │ ├── __init__.py
│ │ ├── attribution
│ │ │ ├── 3pp
│ │ │ │ ├── __init__.py
│ │ │ │ ├── cursor.py
│ │ │ │ └── windsurf.py
│ │ │ ├── cli.py
│ │ │ ├── git_history.py
│ │ │ └── main.py
│ │ ├── clients
│ │ │ └── linear.py
│ │ ├── events
│ │ │ ├── client.py
│ │ │ ├── codegen_app.py
│ │ │ ├── github.py
│ │ │ ├── github_types.py
│ │ │ ├── interface.py
│ │ │ ├── linear.py
│ │ │ ├── modal
│ │ │ │ ├── base.py
│ │ │ │ └── request_util.py
│ │ │ └── slack.py
│ │ ├── github
│ │ │ ├── __init__.py
│ │ │ └── types
│ │ │ │ ├── __init__.py
│ │ │ │ ├── author.py
│ │ │ │ ├── base.py
│ │ │ │ ├── commit.py
│ │ │ │ ├── enterprise.py
│ │ │ │ ├── events
│ │ │ │ ├── pull_request.py
│ │ │ │ └── push.py
│ │ │ │ ├── installation.py
│ │ │ │ ├── label.py
│ │ │ │ ├── organization.py
│ │ │ │ ├── pull_request.py
│ │ │ │ ├── push.py
│ │ │ │ └── pusher.py
│ │ ├── graph
│ │ │ ├── __init__.py
│ │ │ ├── create_graph.py
│ │ │ ├── main.py
│ │ │ ├── neo4j_exporter.py
│ │ │ └── utils.py
│ │ ├── index
│ │ │ ├── __init__.py
│ │ │ ├── code_index.py
│ │ │ ├── file_index.py
│ │ │ └── symbol_index.py
│ │ ├── linear
│ │ │ ├── __init__.py
│ │ │ ├── linear_client.py
│ │ │ └── types.py
│ │ ├── lsp
│ │ │ ├── codemods
│ │ │ │ ├── __init__.py
│ │ │ │ ├── base.py
│ │ │ │ ├── move_symbol_to_file.py
│ │ │ │ └── split_tests.py
│ │ │ ├── completion.py
│ │ │ ├── definition.py
│ │ │ ├── document_symbol.py
│ │ │ ├── execute.py
│ │ │ ├── io.py
│ │ │ ├── kind.py
│ │ │ ├── lsp.py
│ │ │ ├── progress.py
│ │ │ ├── protocol.py
│ │ │ ├── range.py
│ │ │ ├── server.py
│ │ │ └── utils.py
│ │ ├── mcp
│ │ │ ├── README.md
│ │ │ ├── codebase_mods.py
│ │ │ └── codebase_tools.py
│ │ ├── slack
│ │ │ └── types.py
│ │ └── swebench
│ │ │ ├── README.md
│ │ │ ├── __init__.py
│ │ │ ├── enums.py
│ │ │ ├── harness.py
│ │ │ ├── report.py
│ │ │ ├── subsets.py
│ │ │ ├── success_rates.py
│ │ │ ├── tests.py
│ │ │ └── utils.py
│ ├── git
│ │ ├── README.md
│ │ ├── __init__.py
│ │ ├── clients
│ │ │ ├── git_repo_client.py
│ │ │ └── github_client.py
│ │ ├── configs
│ │ │ └── constants.py
│ │ ├── models
│ │ │ ├── codemod_context.py
│ │ │ ├── github_named_user_context.py
│ │ │ ├── pr_options.py
│ │ │ ├── pr_part_context.py
│ │ │ └── pull_request_context.py
│ │ ├── py.typed
│ │ ├── repo_operator
│ │ │ ├── local_git_repo.py
│ │ │ └── repo_operator.py
│ │ ├── schemas
│ │ │ ├── enums.py
│ │ │ └── repo_config.py
│ │ └── utils
│ │ │ ├── clone.py
│ │ │ ├── clone_url.py
│ │ │ ├── codeowner_utils.py
│ │ │ ├── file_utils.py
│ │ │ ├── format.py
│ │ │ ├── language.py
│ │ │ ├── pr_review.py
│ │ │ └── remote_progress.py
│ ├── gsbuild
│ │ ├── README.md
│ │ └── build.py
│ ├── gscli
│ │ ├── README.md
│ │ ├── __init__.py
│ │ ├── backend
│ │ │ ├── __init__.py
│ │ │ ├── typestub_utils.py
│ │ │ └── utils.py
│ │ ├── cli.py
│ │ └── generate
│ │ │ ├── __init__.py
│ │ │ ├── commands.py
│ │ │ ├── runner_imports.py
│ │ │ ├── system_prompt.py
│ │ │ └── utils.py
│ ├── py.typed
│ ├── runner
│ │ ├── README.md
│ │ ├── __init__.py
│ │ ├── clients
│ │ │ ├── client.py
│ │ │ ├── codebase_client.py
│ │ │ └── docker_client.py
│ │ ├── constants
│ │ │ └── envvars.py
│ │ ├── diff
│ │ │ └── get_raw_diff.py
│ │ ├── enums
│ │ │ └── warmup_state.py
│ │ ├── models
│ │ │ ├── apis.py
│ │ │ └── codemod.py
│ │ ├── sandbox
│ │ │ ├── ephemeral_server.py
│ │ │ ├── executor.py
│ │ │ ├── middlewares.py
│ │ │ ├── repo.py
│ │ │ ├── runner.py
│ │ │ └── server.py
│ │ ├── servers
│ │ │ └── local_daemon.py
│ │ └── utils
│ │ │ ├── branch_name.py
│ │ │ └── exception_utils.py
│ ├── sdk
│ │ ├── README.md
│ │ ├── _proxy.py
│ │ ├── ai
│ │ │ ├── client.py
│ │ │ └── utils.py
│ │ ├── code_generation
│ │ │ ├── __init__.py
│ │ │ ├── changelog_generation.py
│ │ │ ├── codegen_sdk_codebase.py
│ │ │ ├── current_code_codebase.py
│ │ │ ├── doc_utils
│ │ │ │ ├── __init__.py
│ │ │ │ ├── generate_docs_json.py
│ │ │ │ ├── parse_docstring.py
│ │ │ │ ├── schemas.py
│ │ │ │ └── utils.py
│ │ │ ├── enums.py
│ │ │ ├── mdx_docs_generation.py
│ │ │ └── prompts
│ │ │ │ ├── __init__.py
│ │ │ │ ├── api_docs.py
│ │ │ │ └── utils.py
│ │ ├── codebase
│ │ │ ├── __init__.py
│ │ │ ├── codebase_ai.py
│ │ │ ├── codebase_analysis.py
│ │ │ ├── codebase_context.py
│ │ │ ├── config.py
│ │ │ ├── config_parser.py
│ │ │ ├── diff_lite.py
│ │ │ ├── factory
│ │ │ │ ├── codebase_factory.py
│ │ │ │ ├── get_session.ipynb
│ │ │ │ └── get_session.py
│ │ │ ├── flagging
│ │ │ │ ├── code_flag.py
│ │ │ │ ├── enums.py
│ │ │ │ ├── flags.py
│ │ │ │ ├── group.py
│ │ │ │ └── groupers
│ │ │ │ │ ├── all_grouper.py
│ │ │ │ │ ├── app_grouper.py
│ │ │ │ │ ├── base_grouper.py
│ │ │ │ │ ├── codeowner_grouper.py
│ │ │ │ │ ├── constants.py
│ │ │ │ │ ├── enums.py
│ │ │ │ │ ├── file_chunk_grouper.py
│ │ │ │ │ ├── file_grouper.py
│ │ │ │ │ ├── instance_grouper.py
│ │ │ │ │ └── utils.py
│ │ │ ├── io
│ │ │ │ ├── file_io.py
│ │ │ │ └── io.py
│ │ │ ├── multigraph.py
│ │ │ ├── node_classes
│ │ │ │ ├── __init__.py
│ │ │ │ ├── generic_node_classes.py
│ │ │ │ ├── node_classes.py
│ │ │ │ ├── py_node_classes.py
│ │ │ │ └── ts_node_classes.py
│ │ │ ├── progress
│ │ │ │ ├── progress.py
│ │ │ │ ├── stub_progress.py
│ │ │ │ ├── stub_task.py
│ │ │ │ └── task.py
│ │ │ ├── range_index.py
│ │ │ ├── resolution_stack.py
│ │ │ ├── span.py
│ │ │ ├── transaction_manager.py
│ │ │ ├── transactions.py
│ │ │ └── validation.py
│ │ ├── core
│ │ │ ├── __init__.py
│ │ │ ├── assignment.py
│ │ │ ├── autocommit
│ │ │ │ ├── __init__.py
│ │ │ │ ├── constants.py
│ │ │ │ ├── decorators.py
│ │ │ │ ├── manager.py
│ │ │ │ ├── ruff.toml
│ │ │ │ └── utils.py
│ │ │ ├── class_definition.py
│ │ │ ├── codebase.py
│ │ │ ├── codeowner.py
│ │ │ ├── dataclasses
│ │ │ │ └── usage.py
│ │ │ ├── detached_symbols
│ │ │ │ ├── __init__.py
│ │ │ │ ├── argument.py
│ │ │ │ ├── code_block.py
│ │ │ │ ├── decorator.py
│ │ │ │ ├── function_call.py
│ │ │ │ └── parameter.py
│ │ │ ├── directory.py
│ │ │ ├── export.py
│ │ │ ├── expressions
│ │ │ │ ├── __init__.py
│ │ │ │ ├── await_expression.py
│ │ │ │ ├── binary_expression.py
│ │ │ │ ├── boolean.py
│ │ │ │ ├── builtin.py
│ │ │ │ ├── chained_attribute.py
│ │ │ │ ├── comparison_expression.py
│ │ │ │ ├── defined_name.py
│ │ │ │ ├── expression.py
│ │ │ │ ├── generic_type.py
│ │ │ │ ├── multi_expression.py
│ │ │ │ ├── name.py
│ │ │ │ ├── named_type.py
│ │ │ │ ├── none_type.py
│ │ │ │ ├── number.py
│ │ │ │ ├── parenthesized_expression.py
│ │ │ │ ├── placeholder_type.py
│ │ │ │ ├── string.py
│ │ │ │ ├── subscript_expression.py
│ │ │ │ ├── ternary_expression.py
│ │ │ │ ├── tuple_type.py
│ │ │ │ ├── type.py
│ │ │ │ ├── unary_expression.py
│ │ │ │ ├── union_type.py
│ │ │ │ ├── unpack.py
│ │ │ │ └── value.py
│ │ │ ├── external
│ │ │ │ ├── dependency_manager.py
│ │ │ │ ├── external_process.py
│ │ │ │ └── language_engine.py
│ │ │ ├── external_module.py
│ │ │ ├── file.py
│ │ │ ├── function.py
│ │ │ ├── import_resolution.py
│ │ │ ├── interface.py
│ │ │ ├── interfaces
│ │ │ │ ├── __init__.py
│ │ │ │ ├── callable.py
│ │ │ │ ├── chainable.py
│ │ │ │ ├── conditional_block.py
│ │ │ │ ├── editable.py
│ │ │ │ ├── exportable.py
│ │ │ │ ├── has_attribute.py
│ │ │ │ ├── has_block.py
│ │ │ │ ├── has_name.py
│ │ │ │ ├── has_symbols.py
│ │ │ │ ├── has_value.py
│ │ │ │ ├── importable.py
│ │ │ │ ├── inherits.py
│ │ │ │ ├── parseable.py
│ │ │ │ ├── resolvable.py
│ │ │ │ ├── supports_generic.py
│ │ │ │ ├── typeable.py
│ │ │ │ ├── unwrappable.py
│ │ │ │ ├── usable.py
│ │ │ │ └── wrapper_expression.py
│ │ │ ├── node_id_factory.py
│ │ │ ├── parser.py
│ │ │ ├── placeholder
│ │ │ │ ├── __init__.py
│ │ │ │ ├── placeholder.py
│ │ │ │ ├── placeholder_stub.py
│ │ │ │ └── placeholder_type.py
│ │ │ ├── plugins
│ │ │ │ ├── __init__.py
│ │ │ │ ├── axios.py
│ │ │ │ ├── flask.py
│ │ │ │ ├── modal.py
│ │ │ │ └── plugin.py
│ │ │ ├── statements
│ │ │ │ ├── __init__.py
│ │ │ │ ├── assignment_statement.py
│ │ │ │ ├── attribute.py
│ │ │ │ ├── block_statement.py
│ │ │ │ ├── catch_statement.py
│ │ │ │ ├── comment.py
│ │ │ │ ├── export_statement.py
│ │ │ │ ├── expression_statement.py
│ │ │ │ ├── for_loop_statement.py
│ │ │ │ ├── if_block_statement.py
│ │ │ │ ├── import_statement.py
│ │ │ │ ├── raise_statement.py
│ │ │ │ ├── return_statement.py
│ │ │ │ ├── statement.py
│ │ │ │ ├── switch_case.py
│ │ │ │ ├── switch_statement.py
│ │ │ │ ├── symbol_statement.py
│ │ │ │ ├── try_catch_statement.py
│ │ │ │ └── while_statement.py
│ │ │ ├── symbol.py
│ │ │ ├── symbol_group.py
│ │ │ ├── symbol_groups
│ │ │ │ ├── __init__.py
│ │ │ │ ├── collection.py
│ │ │ │ ├── comment_group.py
│ │ │ │ ├── dict.py
│ │ │ │ ├── expression_group.py
│ │ │ │ ├── list.py
│ │ │ │ ├── multi_line_collection.py
│ │ │ │ ├── parents.py
│ │ │ │ ├── tuple.py
│ │ │ │ └── type_parameters.py
│ │ │ ├── type_alias.py
│ │ │ └── utils
│ │ │ │ └── cache_utils.py
│ │ ├── enums.py
│ │ ├── extensions
│ │ │ ├── autocommit.pyi
│ │ │ ├── autocommit.pyx
│ │ │ ├── py.typed
│ │ │ ├── resolution.pyi
│ │ │ ├── resolution.pyx
│ │ │ ├── sort.pyx
│ │ │ ├── utils.pyi
│ │ │ └── utils.pyx
│ │ ├── output
│ │ │ ├── ast.py
│ │ │ ├── constants.py
│ │ │ ├── inspect.py
│ │ │ ├── jsonable.py
│ │ │ ├── placeholder.py
│ │ │ └── utils.py
│ │ ├── py.typed
│ │ ├── python
│ │ │ ├── __init__.py
│ │ │ ├── assignment.py
│ │ │ ├── class_definition.py
│ │ │ ├── detached_symbols
│ │ │ │ ├── code_block.py
│ │ │ │ ├── decorator.py
│ │ │ │ └── parameter.py
│ │ │ ├── expressions
│ │ │ │ ├── chained_attribute.py
│ │ │ │ ├── conditional_expression.py
│ │ │ │ ├── generic_type.py
│ │ │ │ ├── named_type.py
│ │ │ │ ├── string.py
│ │ │ │ ├── type.py
│ │ │ │ └── union_type.py
│ │ │ ├── file.py
│ │ │ ├── function.py
│ │ │ ├── import_resolution.py
│ │ │ ├── interfaces
│ │ │ │ └── has_block.py
│ │ │ ├── placeholder
│ │ │ │ └── placeholder_return_type.py
│ │ │ ├── statements
│ │ │ │ ├── __init__.py
│ │ │ │ ├── assignment_statement.py
│ │ │ │ ├── attribute.py
│ │ │ │ ├── block_statement.py
│ │ │ │ ├── break_statement.py
│ │ │ │ ├── catch_statement.py
│ │ │ │ ├── comment.py
│ │ │ │ ├── for_loop_statement.py
│ │ │ │ ├── if_block_statement.py
│ │ │ │ ├── import_statement.py
│ │ │ │ ├── match_case.py
│ │ │ │ ├── match_statement.py
│ │ │ │ ├── pass_statement.py
│ │ │ │ ├── try_catch_statement.py
│ │ │ │ ├── while_statement.py
│ │ │ │ └── with_statement.py
│ │ │ ├── symbol.py
│ │ │ └── symbol_groups
│ │ │ │ └── comment_group.py
│ │ ├── system-prompt.txt
│ │ ├── topological_sort.py
│ │ ├── tree_sitter_parser.py
│ │ ├── types.py
│ │ ├── typescript
│ │ │ ├── __init__.py
│ │ │ ├── assignment.py
│ │ │ ├── class_definition.py
│ │ │ ├── config_parser.py
│ │ │ ├── detached_symbols
│ │ │ │ ├── code_block.py
│ │ │ │ ├── decorator.py
│ │ │ │ ├── jsx
│ │ │ │ │ ├── element.py
│ │ │ │ │ ├── expression.py
│ │ │ │ │ └── prop.py
│ │ │ │ ├── parameter.py
│ │ │ │ └── promise_chain.py
│ │ │ ├── enum_definition.py
│ │ │ ├── enums.py
│ │ │ ├── export.py
│ │ │ ├── expressions
│ │ │ │ ├── array_type.py
│ │ │ │ ├── chained_attribute.py
│ │ │ │ ├── conditional_type.py
│ │ │ │ ├── expression_type.py
│ │ │ │ ├── function_type.py
│ │ │ │ ├── generic_type.py
│ │ │ │ ├── lookup_type.py
│ │ │ │ ├── named_type.py
│ │ │ │ ├── object_type.py
│ │ │ │ ├── query_type.py
│ │ │ │ ├── readonly_type.py
│ │ │ │ ├── string.py
│ │ │ │ ├── ternary_expression.py
│ │ │ │ ├── type.py
│ │ │ │ ├── undefined_type.py
│ │ │ │ └── union_type.py
│ │ │ ├── external
│ │ │ │ ├── dependency_manager.py
│ │ │ │ ├── mega_racer.py
│ │ │ │ ├── ts_analyzer_engine.py
│ │ │ │ ├── ts_declassify
│ │ │ │ │ └── ts_declassify.py
│ │ │ │ └── typescript_analyzer
│ │ │ │ │ ├── .gitignore
│ │ │ │ │ ├── package.json
│ │ │ │ │ ├── rollup.config.js
│ │ │ │ │ ├── src
│ │ │ │ │ ├── analyzer.ts
│ │ │ │ │ ├── fs_proxy.ts
│ │ │ │ │ ├── fsi.ts
│ │ │ │ │ ├── get_type_at_position.ts
│ │ │ │ │ ├── index.ts
│ │ │ │ │ ├── run_full.ts
│ │ │ │ │ └── test_fsi.ts
│ │ │ │ │ └── tsconfig.json
│ │ │ ├── file.py
│ │ │ ├── function.py
│ │ │ ├── import_resolution.py
│ │ │ ├── interface.py
│ │ │ ├── interfaces
│ │ │ │ └── has_block.py
│ │ │ ├── namespace.py
│ │ │ ├── placeholder
│ │ │ │ └── placeholder_return_type.py
│ │ │ ├── statements
│ │ │ │ ├── __init__.py
│ │ │ │ ├── assignment_statement.py
│ │ │ │ ├── attribute.py
│ │ │ │ ├── block_statement.py
│ │ │ │ ├── catch_statement.py
│ │ │ │ ├── comment.py
│ │ │ │ ├── for_loop_statement.py
│ │ │ │ ├── if_block_statement.py
│ │ │ │ ├── import_statement.py
│ │ │ │ ├── labeled_statement.py
│ │ │ │ ├── switch_case.py
│ │ │ │ ├── switch_statement.py
│ │ │ │ ├── try_catch_statement.py
│ │ │ │ └── while_statement.py
│ │ │ ├── symbol.py
│ │ │ ├── symbol_groups
│ │ │ │ ├── comment_group.py
│ │ │ │ └── dict.py
│ │ │ ├── ts_config.py
│ │ │ └── type_alias.py
│ │ ├── utils.py
│ │ └── writer_decorators.py
│ ├── shared
│ │ ├── README.md
│ │ ├── __init__.py
│ │ ├── compilation
│ │ │ ├── README.md
│ │ │ ├── codeblock_validation.py
│ │ │ ├── exception_utils.py
│ │ │ ├── function_compilation.py
│ │ │ ├── function_construction.py
│ │ │ ├── function_imports.py
│ │ │ └── string_to_code.py
│ │ ├── decorators
│ │ │ └── docs.py
│ │ ├── enums
│ │ │ └── programming_language.py
│ │ ├── exceptions
│ │ │ ├── api.py
│ │ │ ├── compilation.py
│ │ │ └── control_flow.py
│ │ ├── logging
│ │ │ └── get_logger.py
│ │ ├── network
│ │ │ └── port.py
│ │ ├── path.py
│ │ ├── performance
│ │ │ ├── memory_utils.py
│ │ │ ├── stopwatch_utils.py
│ │ │ └── time_utils.py
│ │ └── string
│ │ │ └── csv_utils.py
│ └── visualizations
│ │ ├── enums.py
│ │ ├── py.typed
│ │ ├── visualization_manager.py
│ │ └── viz_utils.py
└── codemods
│ ├── README.md
│ ├── canonical
│ ├── __init__.py
│ ├── add_function_parameter_type_annotations
│ │ ├── __init__.py
│ │ └── add_function_parameter_type_annotations.py
│ ├── add_internal_to_non_exported_components
│ │ ├── __init__.py
│ │ └── add_internal_to_non_exported_components.py
│ ├── bang_bang_to_boolean
│ │ ├── __init__.py
│ │ └── bang_bang_to_boolean.py
│ ├── built_in_type_annotation
│ │ └── built_in_type_annotation.py
│ ├── change_component_tag_names
│ │ ├── __init__.py
│ │ └── change_component_tag_names.py
│ ├── classnames_to_backtick.py
│ ├── convert_array_type_to_square_bracket
│ │ ├── __init__.py
│ │ └── convert_array_type_to_square_bracket.py
│ ├── convert_attribute_to_decorator
│ │ ├── __init__.py
│ │ └── convert_attribute_to_decorator.py
│ ├── convert_comments_to_JSDoc_style
│ │ ├── __init__.py
│ │ └── convert_comments_to_JSDoc_style.py
│ ├── convert_docstring_to_google_style
│ │ ├── __init__.py
│ │ └── convert_docstring_to_google_style.py
│ ├── delete_unused_functions
│ │ └── delete_unused_functions.py
│ ├── emojify_py_files_codemod
│ │ └── emojify_py_files_codemod.py
│ ├── enum_mover
│ │ └── enum_mover.py
│ ├── insert_arguments_to_decorator
│ │ ├── __init__.py
│ │ └── insert_arguments_to_decorator.py
│ ├── invite_factory_create_params
│ │ ├── __init__.py
│ │ └── invite_factory_create_params.py
│ ├── js_to_esm_codemod
│ │ └── js_to_esm_codemod.py
│ ├── mark_as_internal_codemod
│ │ └── mark_as_internal_codemod.py
│ ├── mark_internal_to_module
│ │ └── mark_internal_to_module.py
│ ├── mark_is_boolean
│ │ ├── __init__.py
│ │ └── mark_is_boolean.py
│ ├── migrate_class_attributes
│ │ └── migrate_class_attributes.py
│ ├── move_enums_codemod
│ │ └── move_enums_codemod.py
│ ├── move_functions_to_new_file
│ │ └── move_functions_to_new_file.py
│ ├── openapi_add_response_none
│ │ └── openapi_add_response_none.py
│ ├── openapi_no_reference_request
│ │ └── openapi_no_reference_request.py
│ ├── pascal_case_symbols
│ │ ├── __init__.py
│ │ └── pascal_case_symbols.py
│ ├── pivot_return_types
│ │ ├── __init__.py
│ │ └── pivot_return_types.py
│ ├── refactor_react_components_into_separate_files
│ │ └── refactor_react_components_into_separate_files.py
│ ├── remove_indirect_imports
│ │ └── remove_indirect_imports.py
│ ├── rename_function_parameters
│ │ └── rename_function_parameters.py
│ ├── rename_local_variables
│ │ └── rename_local_variables.py
│ ├── replace_prop_values
│ │ └── replace_prop_values.py
│ ├── return_none_type_annotation
│ │ └── return_none_type_annotation.py
│ ├── split_decorators
│ │ ├── __init__.py
│ │ └── split_decorators.py
│ ├── split_file
│ │ └── split_file.py
│ ├── split_file_and_rename_symbols
│ │ └── split_file_and_rename_symbols.py
│ ├── split_large_files
│ │ └── split_large_files.py
│ ├── swap_call_site_imports
│ │ ├── __init__.py
│ │ └── swap_call_site_imports.py
│ ├── swap_class_attribute_usages
│ │ └── swap_class_attribute_usages.py
│ ├── update_optional_type_annotations
│ │ ├── __init__.py
│ │ └── update_optional_type_annotations.py
│ ├── update_union_types
│ │ ├── __init__.py
│ │ └── update_union_types.py
│ ├── use_named_kwargs
│ │ └── use_named_kwargs.py
│ ├── wrap_with_component
│ │ └── wrap_with_component.py
│ └── wrap_with_statement
│ │ └── wrap_with_statement.py
│ ├── codemod.py
│ └── eval
│ └── test_files
│ ├── sample_py_1
│ ├── expected
│ │ └── file.py
│ └── original
│ │ └── file.py
│ ├── sample_py_10
│ ├── expected
│ │ └── file.py
│ └── original
│ │ └── file.py
│ ├── sample_py_2
│ ├── expected
│ │ ├── file.py
│ │ └── foo.py
│ └── original
│ │ └── file.py
│ ├── sample_py_3
│ ├── expected
│ │ ├── decorators.py
│ │ └── file.py
│ └── original
│ │ ├── decorators.py
│ │ └── file.py
│ ├── sample_py_4
│ ├── expected
│ │ ├── file.py
│ │ └── main.py
│ └── original
│ │ ├── file.py
│ │ └── main.py
│ ├── sample_py_5
│ ├── expected
│ │ └── file.py
│ └── original
│ │ └── file.py
│ ├── sample_py_6
│ ├── expected
│ │ └── file.py
│ └── original
│ │ ├── file.py
│ │ └── unused_symbols.py
│ ├── sample_py_7
│ ├── expected
│ │ ├── bar
│ │ │ ├── enums.py
│ │ │ └── file.py
│ │ └── foo
│ │ │ ├── enums.py
│ │ │ └── file.py
│ └── original
│ │ ├── bar
│ │ ├── enums.py
│ │ └── file.py
│ │ └── foo
│ │ └── file.py
│ ├── sample_py_8
│ ├── expected
│ │ └── file.py
│ └── original
│ │ └── file.py
│ ├── sample_py_9
│ ├── expected
│ │ └── file.py
│ └── original
│ │ └── file.py
│ ├── sample_ts_1
│ ├── expected
│ │ └── file.ts
│ └── original
│ │ └── file.ts
│ ├── sample_ts_10
│ ├── expected
│ │ ├── types.ts
│ │ └── userService.ts
│ └── original
│ │ ├── types.ts
│ │ └── userService.ts
│ ├── sample_ts_2
│ ├── expected
│ │ ├── App.tsx
│ │ ├── Footer.tsx
│ │ ├── Header.tsx
│ │ ├── MainContent.tsx
│ │ ├── Sidebar.tsx
│ │ └── helpers.ts
│ └── original
│ │ ├── App.tsx
│ │ ├── Footer.tsx
│ │ ├── Header.tsx
│ │ └── helpers.ts
│ ├── sample_ts_3
│ ├── expected
│ │ ├── App.tsx
│ │ ├── Footer.tsx
│ │ └── Header.tsx
│ └── original
│ │ ├── App.tsx
│ │ ├── Footer.tsx
│ │ ├── Header.tsx
│ │ └── helpers.ts
│ ├── sample_ts_4
│ ├── expected
│ │ ├── App.tsx
│ │ ├── Footer.tsx
│ │ ├── Header.tsx
│ │ └── helpers.ts
│ └── original
│ │ ├── App.tsx
│ │ ├── Footer.tsx
│ │ ├── Header.tsx
│ │ └── helpers.ts
│ ├── sample_ts_5
│ ├── expected
│ │ ├── App.tsx
│ │ ├── user.router.js
│ │ └── userHelpers.ts
│ └── original
│ │ ├── App.tsx
│ │ ├── user.router.js
│ │ └── userHelpers.ts
│ ├── sample_ts_6
│ ├── expected
│ │ ├── App.tsx
│ │ ├── user.router.ts
│ │ └── userHelpers.ts
│ └── original
│ │ ├── App.tsx
│ │ ├── user.router.js
│ │ └── userHelpers.ts
│ ├── sample_ts_7
│ ├── expected
│ │ ├── app
│ │ │ ├── App.tsx
│ │ │ └── userHelpers.ts
│ │ └── misc
│ │ │ └── Misc.tsx
│ └── original
│ │ ├── app
│ │ ├── App.tsx
│ │ └── userHelpers.ts
│ │ └── misc
│ │ └── Misc.tsx
│ ├── sample_ts_8
│ ├── expected
│ │ ├── enums.ts
│ │ ├── types.ts
│ │ └── userService.ts
│ └── original
│ │ ├── types.ts
│ │ └── userService.ts
│ └── sample_ts_9
│ ├── expected
│ ├── types.ts
│ └── userService.ts
│ └── original
│ ├── types.ts
│ └── userService.ts
├── test_events.py
├── tests
├── __init__.py
├── conftest.py
├── integration
│ ├── __init__.py
│ ├── codegen
│ │ ├── cli
│ │ │ └── commands
│ │ │ │ ├── conftest.py
│ │ │ │ └── test_reset.py
│ │ ├── git
│ │ │ ├── codebase
│ │ │ │ ├── conftest.py
│ │ │ │ └── test_codebase_create_pr.py
│ │ │ ├── conftest.py
│ │ │ └── repo_operator
│ │ │ │ └── test_remote_repo_operator.py
│ │ ├── runner
│ │ │ ├── conftest.py
│ │ │ ├── test_create_branch.py
│ │ │ └── test_create_branch_with_grouping.py
│ │ ├── sdk
│ │ │ ├── code_generation
│ │ │ │ └── test_api_doc_generation.py
│ │ │ ├── core
│ │ │ │ ├── conftest.py
│ │ │ │ └── test_codeowners.py
│ │ │ └── typescript
│ │ │ │ ├── language_engine
│ │ │ │ └── test_node_engine.py
│ │ │ │ └── react
│ │ │ │ └── test_ts_declassify.py
│ │ └── test_imports.py
│ ├── codemod
│ │ ├── .gitignore
│ │ ├── __init__.py
│ │ ├── canonical
│ │ │ ├── bang_bang_to_boolean
│ │ │ │ └── test_vite
│ │ │ │ │ └── expected_diff.patch.skip
│ │ │ ├── move_functions_to_new_file
│ │ │ │ └── test_pylsp
│ │ │ │ │ └── expected_diff.patch.skip
│ │ │ ├── openapi_add_response_none
│ │ │ │ └── test_indra
│ │ │ │ │ └── expected_diff.patch.skip
│ │ │ └── split_large_files
│ │ │ │ └── test_vite
│ │ │ │ └── expected_diff.patch.skip
│ │ ├── conftest.py
│ │ ├── repos
│ │ │ ├── open_source
│ │ │ │ ├── airflow.json
│ │ │ │ ├── cypress.json
│ │ │ │ ├── deno_rest.json
│ │ │ │ ├── django.json
│ │ │ │ ├── fastapi.json
│ │ │ │ ├── flask-bones.json
│ │ │ │ ├── flask.json
│ │ │ │ ├── gradio.json
│ │ │ │ ├── graphrag.json
│ │ │ │ ├── hass.json
│ │ │ │ ├── indico.json
│ │ │ │ ├── indra.json
│ │ │ │ ├── jchat.json
│ │ │ │ ├── mypy.json
│ │ │ │ ├── nest.json
│ │ │ │ ├── papermark.json
│ │ │ │ ├── posthog.json
│ │ │ │ ├── pylsp.json
│ │ │ │ ├── redash.json
│ │ │ │ ├── remix_run_examples.json
│ │ │ │ ├── requests-oauthlib.json
│ │ │ │ ├── sqlglot.json
│ │ │ │ ├── suite.json
│ │ │ │ ├── transformers.json
│ │ │ │ ├── virtual_coffee.json
│ │ │ │ ├── vite.json
│ │ │ │ └── vscode.json
│ │ │ └── repos.json
│ │ ├── test_codemods.py
│ │ ├── test_diffs.py
│ │ ├── test_parse.py
│ │ └── test_verified_codemods.py
│ └── test_vector_index.py
├── shared
│ ├── README.md
│ ├── __init__.py
│ ├── codemod
│ │ ├── codebase_comparison_utils.py
│ │ ├── commands.py
│ │ ├── constants.py
│ │ ├── models.py
│ │ ├── test_discovery.py
│ │ └── verified_codemod_utils.py
│ ├── mocks
│ │ ├── __init__.py
│ │ └── mock_ai_helper.py
│ ├── skills
│ │ ├── decorators.py
│ │ ├── skill.py
│ │ ├── skill_implementation.py
│ │ ├── skill_test.py
│ │ ├── utils.py
│ │ └── verify_skill_output.py
│ └── utils
│ │ ├── normalize.py
│ │ └── recursion.py
├── unit
│ ├── codegen
│ │ ├── agents
│ │ │ ├── __init__.py
│ │ │ ├── test_agent.py
│ │ │ ├── test_api_client.py
│ │ │ └── test_simple_agent.py
│ │ ├── cli
│ │ │ └── commands
│ │ │ │ └── update
│ │ │ │ ├── data
│ │ │ │ └── response.json
│ │ │ │ └── test_update.py
│ │ ├── conftest.py
│ │ ├── extensions
│ │ │ ├── lsp
│ │ │ │ ├── conftest.py
│ │ │ │ ├── test_code_action.py
│ │ │ │ ├── test_definition.py
│ │ │ │ ├── test_document_symbols.py
│ │ │ │ ├── test_progress.py
│ │ │ │ ├── test_rename.py
│ │ │ │ ├── test_workspace_sync.py
│ │ │ │ └── utils.py
│ │ │ ├── test_message_annotation.py
│ │ │ ├── test_tools.py
│ │ │ └── test_utils.py
│ │ ├── git
│ │ │ └── utils
│ │ │ │ ├── test_clone_url.py
│ │ │ │ └── test_language_detection.py
│ │ ├── gscli
│ │ │ └── test_cli.py
│ │ ├── runner
│ │ │ ├── sandbox
│ │ │ │ ├── conftest.py
│ │ │ │ ├── test_executor.py
│ │ │ │ └── test_runner.py
│ │ │ └── utils
│ │ │ │ └── test_branch_name.py
│ │ ├── sdk
│ │ │ ├── benchmark
│ │ │ │ └── codebase
│ │ │ │ │ └── test_codebase_reset.py
│ │ │ ├── code_generation
│ │ │ │ ├── __init__.py
│ │ │ │ └── test_codemod_writer_decorators.py
│ │ │ ├── codebase
│ │ │ │ ├── __init__.py
│ │ │ │ ├── codebase_graph
│ │ │ │ │ ├── test_codebase_graph.py
│ │ │ │ │ ├── test_codebase_reset.py
│ │ │ │ │ └── test_validation.py
│ │ │ │ ├── file
│ │ │ │ │ ├── example.min.js
│ │ │ │ │ ├── test_file.py
│ │ │ │ │ ├── test_file_edit.py
│ │ │ │ │ ├── test_file_pink.py
│ │ │ │ │ └── test_get_relative_path.py
│ │ │ │ ├── file_graph
│ │ │ │ │ └── test_symbol_parent_statement.py
│ │ │ │ ├── flagging
│ │ │ │ │ ├── test_code_flag.py
│ │ │ │ │ └── test_group_all.py
│ │ │ │ ├── session
│ │ │ │ │ ├── target_python_file.py
│ │ │ │ │ ├── test_codebase_from_files.py
│ │ │ │ │ ├── test_codebase_from_string.py
│ │ │ │ │ ├── test_codebase_session_corruption.py
│ │ │ │ │ └── test_verify_output.py
│ │ │ │ └── transaction_manager
│ │ │ │ │ ├── test_transaction_manager.py
│ │ │ │ │ └── test_transaction_mangager_checks.py
│ │ │ ├── core
│ │ │ │ ├── interfaces
│ │ │ │ │ ├── test_files_interface.py
│ │ │ │ │ └── test_importable_dependencies.py
│ │ │ │ ├── test_codebase.py
│ │ │ │ ├── test_codeowner.py
│ │ │ │ ├── test_directory.py
│ │ │ │ └── utils
│ │ │ │ │ └── test_cache_utils.py
│ │ │ ├── io
│ │ │ │ └── test_file_io.py
│ │ │ ├── output
│ │ │ │ ├── snapshots
│ │ │ │ │ └── test_ast
│ │ │ │ │ │ ├── test_ast_basic
│ │ │ │ │ │ └── ast.json
│ │ │ │ │ │ └── test_ast_nested
│ │ │ │ │ │ └── ast-nested.json
│ │ │ │ ├── test_ast.py
│ │ │ │ └── test_json.py
│ │ │ ├── parser
│ │ │ │ ├── __init__.py
│ │ │ │ └── test_get_parser_by_filepath_or_extension.py
│ │ │ ├── python
│ │ │ │ ├── __init__.py
│ │ │ │ ├── autocommit
│ │ │ │ │ └── test_autocommit.py
│ │ │ │ ├── class_definition
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── test_class_add_attribute.py
│ │ │ │ │ ├── test_class_add_comment.py
│ │ │ │ │ ├── test_class_add_decorator.py
│ │ │ │ │ ├── test_class_add_method.py
│ │ │ │ │ ├── test_class_constructor_usages.py
│ │ │ │ │ ├── test_class_dependencies.py
│ │ │ │ │ ├── test_class_editable.py
│ │ │ │ │ ├── test_class_extended.py
│ │ │ │ │ ├── test_class_filter.py
│ │ │ │ │ ├── test_class_inherited_methods.py
│ │ │ │ │ ├── test_class_method_usages.py
│ │ │ │ │ ├── test_class_parent_class_names.py
│ │ │ │ │ ├── test_class_parent_classes.py
│ │ │ │ │ ├── test_class_properties.py
│ │ │ │ │ └── test_class_rename.py
│ │ │ │ ├── codebase
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── test_codebase.py
│ │ │ │ │ ├── test_codebase_auto_commit.py
│ │ │ │ │ ├── test_codebase_create_file.py
│ │ │ │ │ ├── test_codebase_git.py
│ │ │ │ │ ├── test_codebase_log.py
│ │ │ │ │ ├── test_codebase_meta.py
│ │ │ │ │ ├── test_codebase_raise_error.py
│ │ │ │ │ ├── test_codebase_reset.py
│ │ │ │ │ ├── test_codebase_resolution.py
│ │ │ │ │ └── test_control_flow.py
│ │ │ │ ├── comment_docstring
│ │ │ │ │ ├── test_comment.py
│ │ │ │ │ ├── test_comment_edit.py
│ │ │ │ │ ├── test_comment_insert_add.py
│ │ │ │ │ ├── test_docstring.py
│ │ │ │ │ ├── test_docstring_edit.py
│ │ │ │ │ ├── test_docstring_insert_add.py
│ │ │ │ │ ├── test_inline_comment.py
│ │ │ │ │ ├── test_inline_comment_edit.py
│ │ │ │ │ └── test_inline_comment_insert_add.py
│ │ │ │ ├── detached_symbols
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── argument
│ │ │ │ │ │ ├── __init__.py
│ │ │ │ │ │ ├── test_argument_edit.py
│ │ │ │ │ │ └── test_argument_remove.py
│ │ │ │ │ ├── code_block
│ │ │ │ │ │ ├── __init__.py
│ │ │ │ │ │ ├── test_code_block.py
│ │ │ │ │ │ ├── test_code_block_indent.py
│ │ │ │ │ │ ├── test_code_block_insert.py
│ │ │ │ │ │ ├── test_code_block_remove.py
│ │ │ │ │ │ ├── test_code_block_unwrap.py
│ │ │ │ │ │ └── test_code_block_wrap.py
│ │ │ │ │ ├── decorator
│ │ │ │ │ │ ├── __init__.py
│ │ │ │ │ │ ├── test_decorator_call.py
│ │ │ │ │ │ ├── test_decorator_name.py
│ │ │ │ │ │ ├── test_decorator_remove.py
│ │ │ │ │ │ └── test_insert_argument.py
│ │ │ │ │ ├── function_call
│ │ │ │ │ │ ├── __init__.py
│ │ │ │ │ │ ├── test_function_call.py
│ │ │ │ │ │ ├── test_function_call_add_argument.py
│ │ │ │ │ │ ├── test_function_call_from_usage.py
│ │ │ │ │ │ ├── test_function_call_is_awaited.py
│ │ │ │ │ │ ├── test_function_calls_from_symbol.py
│ │ │ │ │ │ └── test_manipulations_function_call.py
│ │ │ │ │ └── parameter
│ │ │ │ │ │ ├── __init__.py
│ │ │ │ │ │ ├── test_parameter_edit.py
│ │ │ │ │ │ ├── test_parameter_editable.py
│ │ │ │ │ │ ├── test_parameter_is_optional.py
│ │ │ │ │ │ ├── test_parameter_is_variadic.py
│ │ │ │ │ │ ├── test_parameter_properties.py
│ │ │ │ │ │ ├── test_parameter_remove.py
│ │ │ │ │ │ ├── test_parameter_rename.py
│ │ │ │ │ │ └── test_parameter_set_type_annotation.py
│ │ │ │ ├── directory
│ │ │ │ │ ├── test_directory.py
│ │ │ │ │ ├── test_directory_move.py
│ │ │ │ │ └── test_directory_remove.py
│ │ │ │ ├── editable
│ │ │ │ │ └── test_replace.py
│ │ │ │ ├── expressions
│ │ │ │ │ ├── test_binary_expression.py
│ │ │ │ │ ├── test_binary_reduce_condition.py
│ │ │ │ │ ├── test_boolean.py
│ │ │ │ │ ├── test_builtin_types.py
│ │ │ │ │ ├── test_chained_attribute_attribute_chain.py
│ │ │ │ │ ├── test_conditional_properties.py
│ │ │ │ │ ├── test_conditional_reduce_condition.py
│ │ │ │ │ ├── test_dict.py
│ │ │ │ │ ├── test_list.py
│ │ │ │ │ ├── test_number.py
│ │ │ │ │ ├── test_string.py
│ │ │ │ │ ├── test_tuple.py
│ │ │ │ │ ├── test_type.py
│ │ │ │ │ ├── test_unpacking.py
│ │ │ │ │ └── test_value.py
│ │ │ │ ├── file
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── test_ast_grep.py
│ │ │ │ │ ├── test_file_add_import.py
│ │ │ │ │ ├── test_file_add_import_from_import_string.py
│ │ │ │ │ ├── test_file_add_symbol_from_source.py
│ │ │ │ │ ├── test_file_editable.py
│ │ │ │ │ ├── test_file_exportable.py
│ │ │ │ │ ├── test_file_get_function_calls.py
│ │ │ │ │ ├── test_file_get_import_string.py
│ │ │ │ │ ├── test_file_global_calls.py
│ │ │ │ │ ├── test_file_owners.py
│ │ │ │ │ ├── test_file_properties.py
│ │ │ │ │ ├── test_file_remove.py
│ │ │ │ │ ├── test_file_reparse.py
│ │ │ │ │ ├── test_file_statements.py
│ │ │ │ │ ├── test_file_unicode.py
│ │ │ │ │ └── test_file_update_filepath.py
│ │ │ │ ├── function
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── test_function_async.py
│ │ │ │ │ ├── test_function_call_sites.py
│ │ │ │ │ ├── test_function_dependencies.py
│ │ │ │ │ ├── test_function_editable.py
│ │ │ │ │ ├── test_function_eq.py
│ │ │ │ │ ├── test_function_exportable.py
│ │ │ │ │ ├── test_function_flag.py
│ │ │ │ │ ├── test_function_function_calls.py
│ │ │ │ │ ├── test_function_get_parameter_by_index.py
│ │ │ │ │ ├── test_function_importable.py
│ │ │ │ │ ├── test_function_insert_statements.py
│ │ │ │ │ ├── test_function_move_to_file.py
│ │ │ │ │ ├── test_function_nested_functions.py
│ │ │ │ │ ├── test_function_parse.py
│ │ │ │ │ ├── test_function_prepend_statements.py
│ │ │ │ │ ├── test_function_properties.py
│ │ │ │ │ ├── test_function_remove.py
│ │ │ │ │ ├── test_function_rename.py
│ │ │ │ │ ├── test_function_set_docstring.py
│ │ │ │ │ ├── test_function_usages.py
│ │ │ │ │ └── test_manipulations_function.py
│ │ │ │ ├── global_var
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── test_global_var_editable.py
│ │ │ │ │ ├── test_global_var_exportable.py
│ │ │ │ │ ├── test_global_var_has_value.py
│ │ │ │ │ ├── test_global_var_importable.py
│ │ │ │ │ ├── test_global_var_properties.py
│ │ │ │ │ ├── test_global_var_remove.py
│ │ │ │ │ ├── test_global_var_rename.py
│ │ │ │ │ └── test_global_var_special.py
│ │ │ │ ├── import_resolution
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── test_has_import.py
│ │ │ │ │ ├── test_import_editable.py
│ │ │ │ │ ├── test_import_exportable.py
│ │ │ │ │ ├── test_import_from_import_statements.py
│ │ │ │ │ ├── test_import_relative.py
│ │ │ │ │ ├── test_import_remove.py
│ │ │ │ │ ├── test_import_rename.py
│ │ │ │ │ ├── test_import_resolution.py
│ │ │ │ │ ├── test_import_resolved_symbol.py
│ │ │ │ │ ├── test_import_set_import_module.py
│ │ │ │ │ ├── test_import_set_import_symbol_alias.py
│ │ │ │ │ └── test_is_dynamic.py
│ │ │ │ ├── statements
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── test_assignment_statement_remove.py
│ │ │ │ │ ├── test_assignment_statement_rename.py
│ │ │ │ │ ├── test_assignment_statement_set_assignment_value.py
│ │ │ │ │ ├── test_attribute_assignment_value.py
│ │ │ │ │ ├── test_attribute_get_usages.py
│ │ │ │ │ ├── test_attribute_properties.py
│ │ │ │ │ ├── test_attribute_remove.py
│ │ │ │ │ ├── test_attribute_rename.py
│ │ │ │ │ ├── test_attribute_set_type_annotation.py
│ │ │ │ │ ├── test_for_loop_statement.py
│ │ │ │ │ ├── test_if_block_reduce_block.py
│ │ │ │ │ ├── test_if_block_statement_properties.py
│ │ │ │ │ ├── test_import_statement.py
│ │ │ │ │ ├── test_match_statement.py
│ │ │ │ │ ├── test_try_catch_statement.py
│ │ │ │ │ ├── test_while_statement.py
│ │ │ │ │ └── test_with_statement_properties.py
│ │ │ │ ├── test_print.py
│ │ │ │ └── utils
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ └── test_file_contents.py
│ │ │ └── typescript
│ │ │ │ ├── __init__.py
│ │ │ │ ├── autocommit
│ │ │ │ └── test_autocommit.py
│ │ │ │ ├── class_definition
│ │ │ │ ├── test_abstract_class.py
│ │ │ │ ├── test_class_add_attribute.py
│ │ │ │ ├── test_class_add_decorator.py
│ │ │ │ ├── test_class_add_method.py
│ │ │ │ ├── test_class_attributes.py
│ │ │ │ ├── test_class_code_block.py
│ │ │ │ ├── test_class_comment.py
│ │ │ │ ├── test_class_constructor_usages.py
│ │ │ │ ├── test_class_definition_is_jsx.py
│ │ │ │ ├── test_class_dependencies.py
│ │ │ │ ├── test_class_filter.py
│ │ │ │ ├── test_class_is_exported.py
│ │ │ │ ├── test_class_method_usages.py
│ │ │ │ ├── test_class_parameters.py
│ │ │ │ ├── test_class_parent_class_names.py
│ │ │ │ ├── test_class_parent_classes.py
│ │ │ │ ├── test_class_rename.py
│ │ │ │ └── test_class_rename_class_attributes.py
│ │ │ │ ├── codebase
│ │ │ │ ├── test_codebase_exports.py
│ │ │ │ └── test_codebase_resolution.py
│ │ │ │ ├── comment_docstring
│ │ │ │ ├── __init__.py
│ │ │ │ ├── test_comment.py
│ │ │ │ ├── test_comment_edit.py
│ │ │ │ ├── test_comment_insert_add.py
│ │ │ │ ├── test_docstring.py
│ │ │ │ ├── test_docstring_edit.py
│ │ │ │ ├── test_docstring_insert_add.py
│ │ │ │ ├── test_inline_comment.py
│ │ │ │ ├── test_inline_comment_edit.py
│ │ │ │ └── test_inline_comment_insert_add.py
│ │ │ │ ├── detached_symbols
│ │ │ │ ├── argument
│ │ │ │ │ ├── test_argument_edit.py
│ │ │ │ │ └── test_fetch_parametes.py
│ │ │ │ ├── code_block
│ │ │ │ │ ├── test_code_block_get_local_var_assignment.py
│ │ │ │ │ ├── test_code_block_get_local_var_assignments.py
│ │ │ │ │ ├── test_code_block_get_variable_usages.py
│ │ │ │ │ ├── test_code_block_indent.py
│ │ │ │ │ ├── test_code_block_local_var_assignments.py
│ │ │ │ │ ├── test_code_block_unwrap.py
│ │ │ │ │ └── test_code_block_wrap.py
│ │ │ │ ├── decorator
│ │ │ │ │ ├── test_decorator_call.py
│ │ │ │ │ └── test_decorator_name.py
│ │ │ │ ├── function_call
│ │ │ │ │ ├── test_function_call_extended_source.py
│ │ │ │ │ ├── test_function_call_get_function_definition.py
│ │ │ │ │ ├── test_function_call_is_awaited.py
│ │ │ │ │ ├── test_function_call_predecessor.py
│ │ │ │ │ ├── test_function_call_rename.py
│ │ │ │ │ └── test_function_call_type_resolution.py
│ │ │ │ ├── parameter
│ │ │ │ │ ├── test_parameter_deconstructed.py
│ │ │ │ │ ├── test_parameter_edit.py
│ │ │ │ │ ├── test_parameter_is_optional.py
│ │ │ │ │ ├── test_parameter_is_variadic.py
│ │ │ │ │ └── test_parameter_value.py
│ │ │ │ └── ts_promise_chain
│ │ │ │ │ └── test_ts_promise_chain.py
│ │ │ │ ├── export
│ │ │ │ ├── test_directory_exports.py
│ │ │ │ ├── test_export_aliased.py
│ │ │ │ ├── test_export_export_statement.py
│ │ │ │ ├── test_export_get_import_string.py
│ │ │ │ ├── test_export_get_reexport_source.py
│ │ │ │ ├── test_export_rename.py
│ │ │ │ ├── test_export_resolve_export.py
│ │ │ │ ├── test_exportable_usages.py
│ │ │ │ ├── test_external_export.py
│ │ │ │ └── test_get_reexported_exports.py
│ │ │ │ ├── expressions
│ │ │ │ ├── __init__.py
│ │ │ │ ├── ternary_expression
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── test_ternary_properties.py
│ │ │ │ │ └── test_ternary_reduce_condition.py
│ │ │ │ ├── test_binary_expression.py
│ │ │ │ ├── test_binary_reduce_condition.py
│ │ │ │ ├── test_boolean.py
│ │ │ │ ├── test_builtin_types.py
│ │ │ │ ├── test_chained_attribute_attribute_chain.py
│ │ │ │ ├── test_dict.py
│ │ │ │ ├── test_expression.py
│ │ │ │ ├── test_list.py
│ │ │ │ ├── test_number.py
│ │ │ │ ├── test_string.py
│ │ │ │ └── test_type.py
│ │ │ │ ├── file
│ │ │ │ ├── __init__.py
│ │ │ │ ├── test_file_add_import.py
│ │ │ │ ├── test_file_add_symbol.py
│ │ │ │ ├── test_file_add_symbol_from_source.py
│ │ │ │ ├── test_file_editable.py
│ │ │ │ ├── test_file_export_statements.py
│ │ │ │ ├── test_file_get_config.py
│ │ │ │ ├── test_file_get_function.py
│ │ │ │ ├── test_file_get_function_calls.py
│ │ │ │ ├── test_file_get_global_var.py
│ │ │ │ ├── test_file_get_import_string.py
│ │ │ │ ├── test_file_get_symbol.py
│ │ │ │ ├── test_file_global_call.py
│ │ │ │ ├── test_file_global_vars.py
│ │ │ │ ├── test_file_graph.py
│ │ │ │ ├── test_file_import_statemets.py
│ │ │ │ ├── test_file_imports.py
│ │ │ │ ├── test_file_remove.py
│ │ │ │ ├── test_file_statements.py
│ │ │ │ ├── test_file_symbols.py
│ │ │ │ ├── test_file_unicode.py
│ │ │ │ ├── test_file_update_filepath.py
│ │ │ │ └── test_ts_config_properties.py
│ │ │ │ ├── function
│ │ │ │ ├── test_function_arrow.py
│ │ │ │ ├── test_function_assignments.py
│ │ │ │ ├── test_function_async.py
│ │ │ │ ├── test_function_call_sites.py
│ │ │ │ ├── test_function_calls_from_symbol.py
│ │ │ │ ├── test_function_code_block.py
│ │ │ │ ├── test_function_comment.py
│ │ │ │ ├── test_function_decorators.py
│ │ │ │ ├── test_function_dependencies.py
│ │ │ │ ├── test_function_docstring.py
│ │ │ │ ├── test_function_flag.py
│ │ │ │ ├── test_function_function_calls.py
│ │ │ │ ├── test_function_function_declaration_docstring.py
│ │ │ │ ├── test_function_get_import_string.py
│ │ │ │ ├── test_function_get_parameter_by_index.py
│ │ │ │ ├── test_function_is_exported.py
│ │ │ │ ├── test_function_is_reexported.py
│ │ │ │ ├── test_function_jsx.py
│ │ │ │ ├── test_function_level.py
│ │ │ │ ├── test_function_move_to_file.py
│ │ │ │ ├── test_function_nested_functions.py
│ │ │ │ ├── test_function_parameter_to_interface.py
│ │ │ │ ├── test_function_parameters.py
│ │ │ │ ├── test_function_prepend_statements.py
│ │ │ │ ├── test_function_rename.py
│ │ │ │ ├── test_function_return_statements.py
│ │ │ │ ├── test_function_return_type_annotation.py
│ │ │ │ ├── test_function_set_docstring.py
│ │ │ │ ├── test_function_set_return_type.py
│ │ │ │ └── test_function_usages.py
│ │ │ │ ├── global_var
│ │ │ │ ├── __init__.py
│ │ │ │ ├── test_global_var_comment.py
│ │ │ │ ├── test_global_var_dependencies.py
│ │ │ │ ├── test_global_var_get_import_string.py
│ │ │ │ ├── test_global_var_has_value.py
│ │ │ │ ├── test_global_var_inline_comment.py
│ │ │ │ ├── test_global_var_is_exported.py
│ │ │ │ ├── test_global_var_parsing.py
│ │ │ │ ├── test_global_var_rename.py
│ │ │ │ └── test_global_var_special.py
│ │ │ │ ├── import_resolution
│ │ │ │ ├── test_directory_import.py
│ │ │ │ ├── test_edge_case.py
│ │ │ │ ├── test_has_import.py
│ │ │ │ ├── test_import_from_export_statement.py
│ │ │ │ ├── test_import_resolution_get_import_string.py
│ │ │ │ ├── test_import_resolution_remove.py
│ │ │ │ ├── test_import_resolution_rename.py
│ │ │ │ ├── test_import_resolution_resolve_import.py
│ │ │ │ ├── test_import_resolution_set_import_module.py
│ │ │ │ ├── test_import_resolution_set_import_symbol_alias.py
│ │ │ │ └── test_is_dynamic.py
│ │ │ │ ├── interface
│ │ │ │ ├── test_interface_attributes.py
│ │ │ │ ├── test_interface_dependencies.py
│ │ │ │ ├── test_interface_get_attribute.py
│ │ │ │ └── test_interface_parents.py
│ │ │ │ ├── language_engine
│ │ │ │ └── test_v8_engine.py
│ │ │ │ ├── move_symbol_to_file
│ │ │ │ └── test_move_tsx_to_file.py
│ │ │ │ ├── namespace
│ │ │ │ ├── test_namespace.py
│ │ │ │ ├── test_namespace_complex_examples.py
│ │ │ │ ├── test_namespace_modifications.py
│ │ │ │ └── test_namespace_usage.py
│ │ │ │ ├── react
│ │ │ │ └── test_interface_props.py
│ │ │ │ ├── statements
│ │ │ │ ├── __init__.py
│ │ │ │ ├── assignment_statement
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── test_assignment_statement_get_local_usages.py
│ │ │ │ │ ├── test_assignment_statement_get_variable_usages.py
│ │ │ │ │ ├── test_assignment_statement_type_annotation.py
│ │ │ │ │ └── test_assignment_statement_type_resolution.py
│ │ │ │ ├── attribute
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── test_attribute_get_local_usages.py
│ │ │ │ │ ├── test_attribute_properties.py
│ │ │ │ │ ├── test_attribute_rename.py
│ │ │ │ │ └── test_attribute_set_type_annotation.py
│ │ │ │ ├── for_loop_statement
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ └── test_for_loop_statement.py
│ │ │ │ ├── if_block_statement
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── test_if_block_reduce_block.py
│ │ │ │ │ └── test_if_block_statement_properties.py
│ │ │ │ ├── statement
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ └── test_statement_get_variable_usages.py
│ │ │ │ ├── switch_statement
│ │ │ │ │ └── test_switch_statement.py
│ │ │ │ ├── try_catch_statement
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ └── test_try_catch_statement.py
│ │ │ │ └── while_statement
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ └── test_while_statement.py
│ │ │ │ ├── test_print.py
│ │ │ │ ├── tsx
│ │ │ │ ├── test_tsx_edit.py
│ │ │ │ └── test_tsx_parsing.py
│ │ │ │ └── type
│ │ │ │ ├── test_type_attributes.py
│ │ │ │ └── test_type_dependencies.py
│ │ └── shared
│ │ │ └── compilation
│ │ │ ├── test_codeblock_validation.py
│ │ │ ├── test_function_compilation.py
│ │ │ ├── test_function_construction.py
│ │ │ └── test_string_to_code.py
│ ├── codemods
│ │ └── test_codemod.py
│ └── skills
│ │ ├── __init__.py
│ │ ├── implementations
│ │ ├── ai_skills.py
│ │ ├── asyncify_skills.py
│ │ ├── code_block_skills.py
│ │ ├── comment_skills.py
│ │ ├── decorator_skills.py
│ │ ├── eval_skills.py
│ │ ├── example_skills.py
│ │ ├── export_skills.py
│ │ ├── expressions
│ │ │ ├── dict.py
│ │ │ ├── list.py
│ │ │ └── type.py
│ │ ├── feature_flag_deletion_skill.py
│ │ ├── function_skills.py
│ │ ├── global_var_skills.py
│ │ ├── graph_viz
│ │ │ ├── graph_viz_app_imports.py
│ │ │ ├── graph_viz_call_graph.py
│ │ │ ├── graph_viz_dead_code.py
│ │ │ ├── graph_viz_dir_tree.py
│ │ │ └── graph_viz_foreign_key.py
│ │ ├── guides
│ │ │ ├── code-quality-metrics
│ │ │ │ ├── import-loops.py
│ │ │ │ ├── large-files.py
│ │ │ │ ├── missing-documentation.py
│ │ │ │ ├── unnamed-kwargs.py
│ │ │ │ ├── untyped-attributes.py
│ │ │ │ ├── untyped-parameters.py
│ │ │ │ └── untyped-return-types.py
│ │ │ ├── codebase-ai.py
│ │ │ ├── complex-renaming.py
│ │ │ ├── creating-documentation.py
│ │ │ ├── deleting-dead-code.py
│ │ │ ├── increase-type-coverage.py
│ │ │ ├── manipulating-collections.py
│ │ │ └── organize-your-codebase.py
│ │ ├── if_statement_skills.py
│ │ ├── move_symbols_skills.py
│ │ └── type_inheritance_skills.py
│ │ ├── snapshots
│ │ └── test_skills
│ │ │ └── test_all_example_skills
│ │ │ ├── call_graph_filter-PYTHON-case-0
│ │ │ └── call_graph_filter_unnamed.json
│ │ │ ├── call_graph_from_node-PYTHON-case-0
│ │ │ └── call_graph_from_node_unnamed.json
│ │ │ ├── call_paths_between_nodes-PYTHON-case-0
│ │ │ └── call_paths_between_nodes_unnamed.json
│ │ │ ├── dead_code-PYTHON-case-0
│ │ │ └── dead_code_unnamed.json
│ │ │ ├── file_app_import_graph-PYTHON-case-0
│ │ │ └── file_app_import_graph_unnamed.json
│ │ │ ├── foreign_key_graph-PYTHON-case-0
│ │ │ └── foreign_key_graph_unnamed.json
│ │ │ └── repo_dir_tree-PYTHON-case-0
│ │ │ └── repo_dir_tree_unnamed.json
│ │ └── test_skills.py
└── workspace
│ └── test_workspace_operations.py
└── uv.lock
/.codegen/.gitignore:
--------------------------------------------------------------------------------
1 | # Codegen
2 | docs/
3 | examples/
4 | prompts/
5 | jupyter/
6 | .venv/
7 | .env
8 | codegen-system-prompt.txt
9 |
10 | # Python cache files
11 | **/__pycache__/
12 | *.py[cod]
13 | *$py.class
14 | *.txt
15 | *.pyc
16 |
--------------------------------------------------------------------------------
/.codegen/codemods/test_language/test_language.py:
--------------------------------------------------------------------------------
1 | import codegen
2 | from codegen.sdk.core.codebase import Codebase
3 | from codegen.shared.enums.programming_language import ProgrammingLanguage
4 |
5 |
6 | @codegen.function("test-language", subdirectories=["src/codegen/cli"], language=ProgrammingLanguage.PYTHON)
7 | def run(codebase: Codebase):
8 | file = codebase.get_file("src/codegen/cli/errors.py")
9 | print(f"File: {file.path}")
10 | for s in file.symbols:
11 | print(s.name)
12 |
13 |
14 | if __name__ == "__main__":
15 | print("Parsing codebase...")
16 | codebase = Codebase("./")
17 |
18 | print("Running...")
19 | run(codebase)
20 |
--------------------------------------------------------------------------------
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @codegen-sh/codegen-sdk @codegen-team
2 | **/skills @codegen-sh/capabilities @codegen-team @codegen-sh/capabilities
3 | **/code_generation @codegen-sh/codegen-sdk @codegen-team
4 |
--------------------------------------------------------------------------------
/.github/actions/release-pypi/action.yml:
--------------------------------------------------------------------------------
1 | name: "Release PyPI"
2 | description: "Release PyPI"
3 | inputs:
4 | pypi-token:
5 | required: true
6 | description: "PyPI token"
7 | runs:
8 | using: "composite"
9 | steps:
10 | - name: Release PyPI
11 | shell: bash
12 | run: |
13 | export UV_PUBLISH_PASSWORD="${{ inputs.pypi-token }}"
14 | export UV_PUBLISH_USERNAME="__token__"
15 | uv publish --publish-url https://upload.pypi.org/legacy/
16 |
--------------------------------------------------------------------------------
/.github/actions/run-ats/collect.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | TESTS_TO_RUN=$(uv run --frozen pytest --collect-only ${PYTEST_ARGS} -q --disable-warnings --no-summary --no-header)
3 | TESTS_TO_RUN=$(echo "${TESTS_TO_RUN}" | head -n -2)
4 | echo $TESTS_TO_RUN
5 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "pip" # See documentation for possible values
9 | directory: "/" # Location of package manifests
10 | schedule:
11 | interval: "weekly"
12 |
13 | - package-ecosystem: "npm" # See documentation for possible values
14 | directory: "/" # Location of package manifests
15 | schedule:
16 | interval: "weekly"
17 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | # Motivation
2 |
3 |
4 |
5 | # Content
6 |
7 |
8 |
9 | # Testing
10 |
11 |
12 |
13 | # Please check the following before marking your PR as ready for review
14 |
15 | - [ ] I have added tests for my changes
16 | - [ ] I have updated the documentation or added new documentation as needed
17 |
--------------------------------------------------------------------------------
/.github/release.yml:
--------------------------------------------------------------------------------
1 | changelog:
2 | categories:
3 | - title: BREAKING CHANGES! 🚨
4 | labels:
5 | - breaking-change
6 | - unburdened by what has been
7 | - title: Other Changes
8 | labels:
9 | - "*"
10 |
--------------------------------------------------------------------------------
/.vscode/settings.json.template:
--------------------------------------------------------------------------------
1 | {
2 | "editor.formatOnSave": true,
3 | "[python]": {
4 | "editor.defaultFormatter": "charliermarsh.ruff",
5 | "editor.codeActionsOnSave": {
6 | "source.fixAll": true
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
2 |
--------------------------------------------------------------------------------
/architecture/4. type-analysis/F. Generics.md:
--------------------------------------------------------------------------------
1 | # Generics Analysis
2 |
3 | TODO
4 |
5 | ## Next Step
6 |
7 | After generics analysis, the system handles [Subscript Expressions](./G.%20Subscript%20Expression.md) for array and dictionary access.
8 |
--------------------------------------------------------------------------------
/architecture/4. type-analysis/G. Subscript Expression.md:
--------------------------------------------------------------------------------
1 | # Subscript Expression
2 |
3 | TODO
4 |
5 | ## Next Step
6 |
7 | After handling subscript expressions, the system builds [Graph Edges](./H.%20Graph%20Edges.md) to represent relationships between types and symbols.
8 |
--------------------------------------------------------------------------------
/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/app/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/app/favicon.ico
--------------------------------------------------------------------------------
/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/app/page.tsx:
--------------------------------------------------------------------------------
1 | import { RepoAnalysisDashboard } from "@/components/repo-analysis-dashboard";
2 |
3 | export default function Home() {
4 | return (
5 |
6 |
7 |
8 | );
9 | }
10 |
--------------------------------------------------------------------------------
/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/components.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://ui.shadcn.com/schema.json",
3 | "style": "default",
4 | "rsc": true,
5 | "tsx": true,
6 | "tailwind": {
7 | "config": "tailwind.config.ts",
8 | "css": "app/globals.css",
9 | "baseColor": "neutral",
10 | "cssVariables": true,
11 | "prefix": ""
12 | },
13 | "aliases": {
14 | "components": "@/components",
15 | "utils": "@/lib/utils",
16 | "ui": "@/components/ui",
17 | "lib": "@/lib",
18 | "hooks": "@/hooks"
19 | },
20 | "iconLibrary": "lucide"
21 | }
22 |
--------------------------------------------------------------------------------
/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/components/dashboard-header.tsx:
--------------------------------------------------------------------------------
1 | import { Code2 } from "lucide-react";
2 |
3 | export function DashboardHeader() {
4 | return (
5 |
6 |
7 |
8 |
9 | AI Code Impact Analysis
10 |
11 |
12 |
13 | Analyze AI-generated code contributions in your repository
14 |
15 |
16 |
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/components/loading-screen.tsx:
--------------------------------------------------------------------------------
1 | import { Loader2 } from "lucide-react";
2 |
3 | export function LoadingScreen() {
4 | return (
5 |
6 |
7 |
8 |
9 | Analyzing Repository
10 |
11 |
This may take a few seconds...
12 |
13 |
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/components/theme-provider.tsx:
--------------------------------------------------------------------------------
1 | "use client";
2 |
3 | import {
4 | ThemeProvider as NextThemesProvider,
5 | type ThemeProviderProps,
6 | } from "next-themes";
7 | import * as React from "react";
8 |
9 | export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
10 | return {children};
11 | }
12 |
--------------------------------------------------------------------------------
/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/components/ui/skeleton.tsx:
--------------------------------------------------------------------------------
1 | import { cn } from "@/lib/utils";
2 |
3 | function Skeleton({
4 | className,
5 | ...props
6 | }: React.HTMLAttributes) {
7 | return (
8 |
12 | );
13 | }
14 |
15 | export { Skeleton };
16 |
--------------------------------------------------------------------------------
/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/components/ui/use-mobile.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 |
3 | const MOBILE_BREAKPOINT = 768;
4 |
5 | export function useIsMobile() {
6 | const [isMobile, setIsMobile] = React.useState(
7 | undefined,
8 | );
9 |
10 | React.useEffect(() => {
11 | const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
12 | const onChange = () => {
13 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
14 | };
15 | mql.addEventListener("change", onChange);
16 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
17 | return () => mql.removeEventListener("change", onChange);
18 | }, []);
19 |
20 | return !!isMobile;
21 | }
22 |
--------------------------------------------------------------------------------
/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/hooks/use-mobile.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 |
3 | const MOBILE_BREAKPOINT = 768;
4 |
5 | export function useIsMobile() {
6 | const [isMobile, setIsMobile] = React.useState(
7 | undefined,
8 | );
9 |
10 | React.useEffect(() => {
11 | const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
12 | const onChange = () => {
13 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
14 | };
15 | mql.addEventListener("change", onChange);
16 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
17 | return () => mql.removeEventListener("change", onChange);
18 | }, []);
19 |
20 | return !!isMobile;
21 | }
22 |
--------------------------------------------------------------------------------
/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/lib/types.ts:
--------------------------------------------------------------------------------
1 | export interface AnalysisData {
2 | stats: {
3 | total_commits: number;
4 | ai_commits: number;
5 | ai_percentage: number;
6 | top_ai_files: [string, number][];
7 | ai_file_count: number;
8 | total_file_count: number;
9 | };
10 | ai_symbol_count: number;
11 | total_symbol_count: number;
12 | high_impact_symbols: HighImpactSymbol[];
13 | timeline: Timeline[];
14 | contributors: [string, number][];
15 | }
16 |
17 | export interface HighImpactSymbol {
18 | name: string;
19 | filepath: string;
20 | usage_count: number;
21 | last_editor: string;
22 | }
23 |
24 | export interface Timeline {
25 | date: string;
26 | count: number;
27 | }
28 |
--------------------------------------------------------------------------------
/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/lib/utils.ts:
--------------------------------------------------------------------------------
1 | import { type ClassValue, clsx } from "clsx";
2 | import { twMerge } from "tailwind-merge";
3 |
4 | export function cn(...inputs: ClassValue[]) {
5 | return twMerge(clsx(inputs));
6 | }
7 |
--------------------------------------------------------------------------------
/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/postcss.config.mjs:
--------------------------------------------------------------------------------
1 | /** @type {import('postcss-load-config').Config} */
2 | const config = {
3 | plugins: {
4 | tailwindcss: {},
5 | },
6 | };
7 |
8 | export default config;
9 |
--------------------------------------------------------------------------------
/codegen-examples/examples/ai_impact_analysis/dashboard/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["dom", "dom.iterable", "esnext"],
4 | "allowJs": true,
5 | "target": "ES6",
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "noEmit": true,
9 | "esModuleInterop": true,
10 | "module": "esnext",
11 | "moduleResolution": "bundler",
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "jsx": "preserve",
15 | "incremental": true,
16 | "plugins": [
17 | {
18 | "name": "next"
19 | }
20 | ],
21 | "paths": {
22 | "@/*": ["./*"]
23 | }
24 | },
25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
26 | "exclude": ["node_modules"]
27 | }
28 |
--------------------------------------------------------------------------------
/codegen-examples/examples/codegen-mcp-server/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "codegen-mcp-server"
3 | version = "0.1.0"
4 | description = "MCP server implementation adding tools for the Codegen SDK"
5 | readme = "README.md"
6 | requires-python = ">=3.12"
7 | dependencies = [
8 | "codegen>=0.14.5",
9 | "uvicorn>=0.27.1",
10 | "fastapi>=0.110.0",
11 | "pydantic>=2.6.3",
12 | "rich>=13.7.1",
13 | "click>=8.1.7",
14 | "mcp[cli]>=1.2.1",
15 | ]
16 |
17 | [tool.poetry.scripts]
18 | codegen-mcp-server = "server:main"
19 | [project.scripts]
20 | codegen-mcp-server = "server:main"
21 |
--------------------------------------------------------------------------------
/codegen-examples/examples/flask_to_fastapi_migration/input_repo/static/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Library
6 |
7 |
8 |
9 |
10 |
11 | Welcome to the Library
12 |
14 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/codegen-examples/examples/flask_to_fastapi_migration/input_repo/static/script.js:
--------------------------------------------------------------------------------
1 | console.log("Static JavaScript file loaded successfully!");
2 |
--------------------------------------------------------------------------------
/codegen-examples/examples/flask_to_fastapi_migration/input_repo/static/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: Arial, sans-serif;
3 | background-color: #f9f9f9;
4 | margin: 0;
5 | padding: 0;
6 | }
7 |
8 | h1 {
9 | color: #333;
10 | text-align: center;
11 | margin-top: 20px;
12 | }
13 |
14 | ul {
15 | list-style-type: none;
16 | padding: 0;
17 | text-align: center;
18 | }
19 |
20 | li {
21 | margin: 10px 0;
22 | }
23 |
24 | a {
25 | text-decoration: none;
26 | color: #007bff;
27 | }
28 |
29 | a:hover {
30 | color: #0056b3;
31 | }
32 |
--------------------------------------------------------------------------------
/codegen-examples/examples/flask_to_fastapi_migration/input_repo/templates/authors.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Authors
6 |
7 |
8 |
9 | Authors
10 |
11 | {% for author in authors %}
12 | - {{ author }}
13 | {% endfor %}
14 |
15 | Back to Home
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/codegen-examples/examples/flask_to_fastapi_migration/input_repo/templates/books.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Books
6 |
7 |
8 |
9 | Books
10 |
11 | {% for book in books %}
12 | - {{ book.title }} by {{ book.author }} ({{ book.category }})
13 | {% endfor %}
14 |
15 | Back to Home
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/codegen-examples/examples/flask_to_fastapi_migration/input_repo/templates/categories.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Categories
6 |
7 |
8 |
9 | Categories
10 |
11 | {% for category in categories %}
12 | - {{ category }}
13 | {% endfor %}
14 |
15 | Back to Home
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/codegen-examples/examples/flask_to_fastapi_migration/input_repo/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Library
6 |
7 |
8 |
9 | Welcome to the Library
10 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/codegen-examples/examples/linear_webhooks/.env.template:
--------------------------------------------------------------------------------
1 | LINEAR_ACCESS_TOKEN="..."
2 | LINEAR_SIGNING_SECRET="..."
3 | LINEAR_TEAM_ID="..."
4 |
--------------------------------------------------------------------------------
/codegen-examples/examples/linear_webhooks/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "linear-webhook-example"
3 | version = "0.1.0"
4 | description = "Linear webhook example for Codegen"
5 | requires-python = ">=3.13"
6 | dependencies = ["codegen>=0.22.2", "modal>=0.73.25"]
7 |
--------------------------------------------------------------------------------
/codegen-examples/examples/modal_repo_analytics/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "codegen-repo-analyzer"
3 | version = "0.1.0"
4 | description = "Modal API endpoint for analyzing GitHub repositories using Codegen"
5 | requires-python = ">=3.13"
6 | dependencies = ["modal>=0.73.25", "fastapi[standard]", "codegen>=0.5.30"]
7 |
--------------------------------------------------------------------------------
/codegen-examples/examples/modal_repo_rag/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "codegen-rag-qa"
3 | version = "0.1.0"
4 | description = "Modal API endpoint for embeddings-based RAG & Q&A on Codegen"
5 | requires-python = ">=3.13"
6 | dependencies = [
7 | "modal>=0.73.25",
8 | "fastapi[standard]",
9 | "codegen>=0.5.30",
10 | "openai>=1.1.0",
11 | ]
12 |
--------------------------------------------------------------------------------
/codegen-examples/examples/reexport_management/input_repo/modules/module_a/src/functions.ts:
--------------------------------------------------------------------------------
1 | export const calculateSum = (a: number, b: number): number => {
2 | return a + b;
3 | };
4 |
5 | export const formatName = (firstName: string, lastName: string): string => {
6 | return `${firstName} ${lastName}`;
7 | };
8 |
9 | export const generateId = (): string => {
10 | return Math.random().toString(36).substring(7);
11 | };
12 |
13 | export const validateEmail = (email: string): boolean => {
14 | const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
15 | return emailRegex.test(email);
16 | };
17 |
18 | export const capitalize = (str: string): string => {
19 | return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
20 | };
21 |
--------------------------------------------------------------------------------
/codegen-examples/examples/reexport_management/input_repo/modules/module_a/src/shared/index.ts:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/codegen-examples/examples/reexport_management/input_repo/modules/module_a/src/shared/index.ts
--------------------------------------------------------------------------------
/codegen-examples/examples/reexport_management/input_repo/modules/module_b/imports.ts:
--------------------------------------------------------------------------------
1 | export {
2 | calculateSum,
3 | formatName,
4 | capitalize,
5 | } from "../module_a/src/functions";
6 | export { validateEmail } from "../module_c/src/shared/symbols/exports";
7 |
--------------------------------------------------------------------------------
/codegen-examples/examples/reexport_management/input_repo/modules/module_b/src/shared/exports.ts:
--------------------------------------------------------------------------------
1 | export { calculateSum, formatName, capitalize } from "../../imports";
2 | export { validateEmail } from "../../imports";
3 |
--------------------------------------------------------------------------------
/codegen-examples/examples/reexport_management/input_repo/modules/module_c/imports.ts:
--------------------------------------------------------------------------------
1 | export { validateEmail, generateId } from "../module_a/src/functions";
2 | export {
3 | calculateAverage,
4 | multiply,
5 | createUserProfile,
6 | } from "../module_b/src/functions";
7 |
--------------------------------------------------------------------------------
/codegen-examples/examples/reexport_management/input_repo/modules/module_c/src/shared/symbols/exports.ts:
--------------------------------------------------------------------------------
1 | export { validateEmail, generateId } from "../../../imports";
2 | export {
3 | calculateAverage,
4 | multiply,
5 | createUserProfile,
6 | } from "../../../imports";
7 |
--------------------------------------------------------------------------------
/codegen-examples/examples/reexport_management/input_repo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "default-exports-test",
3 | "version": "1.0.0",
4 | "description": "Test codebase for converting default exports",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "devDependencies": {
13 | "typescript": "^5.0.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/codegen-examples/examples/reexport_management/input_repo/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": "./",
4 | "paths": {
5 | "*": ["modules/*"]
6 | }
7 | },
8 | "include": ["modules/**/*"]
9 | }
10 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "default-exports-test",
3 | "version": "1.0.0",
4 | "description": "Test codebase for converting default exports",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "devDependencies": {
13 | "typescript": "^5.0.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/auth/services/authenticator.ts:
--------------------------------------------------------------------------------
1 | // Original file keeps default export
2 | export default class Authenticator {
3 | authenticate(token: string): boolean {
4 | return token.length > 0;
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/auth/shared/authenticator.ts:
--------------------------------------------------------------------------------
1 | // Should be converted to named export
2 | export { default } from "../services/authenticator";
3 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/auth/shared/token.ts:
--------------------------------------------------------------------------------
1 | // Should be converted to named export
2 | export { default as generateToken } from "../utils/token-generator";
3 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/auth/utils/token-generator.ts:
--------------------------------------------------------------------------------
1 | // Original file keeps default export
2 | export default function generateToken(): string {
3 | return Math.random().toString(36);
4 | }
5 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/comments/models/comment.ts:
--------------------------------------------------------------------------------
1 | // Original file keeps default export
2 | export default interface Comment {
3 | id: string;
4 | postId: string;
5 | text: string;
6 | }
7 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/comments/services/comment-service.ts:
--------------------------------------------------------------------------------
1 | // Original file keeps default export
2 | import type Comment from "../models/comment";
3 |
4 | export default class CommentService {
5 | getComment(id: string): Comment {
6 | return { id, postId: "123", text: "Great post!" };
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/comments/shared/service.ts:
--------------------------------------------------------------------------------
1 | // Should be converted to named export
2 | export { default as CommentService } from "../services/comment-service";
3 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/comments/shared/types.ts:
--------------------------------------------------------------------------------
1 | // Should be converted to named export
2 | export { default as Comment } from "../models/comment";
3 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/posts/models/post.ts:
--------------------------------------------------------------------------------
1 | // Original file keeps default export
2 | export default interface Post {
3 | id: string;
4 | title: string;
5 | content: string;
6 | }
7 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/posts/services/post-service.ts:
--------------------------------------------------------------------------------
1 | // Original file keeps default export
2 | import type Post from "../models/post";
3 |
4 | export default class PostService {
5 | getPost(id: string): Post {
6 | return { id, title: "Hello", content: "World" };
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/posts/shared/service.ts:
--------------------------------------------------------------------------------
1 | // Should be converted to named export
2 | export { default as PostService } from "../services/post-service";
3 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/posts/shared/types.ts:
--------------------------------------------------------------------------------
1 | // Should be converted to named export
2 | export { default as Post } from "../models/post";
3 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/shared/index.ts:
--------------------------------------------------------------------------------
1 | // All of these should be converted to named exports
2 | export { default as Auth } from "../auth/services/authenticator";
3 | export { default as Token } from "../auth/utils/token-generator";
4 | export { default as UserModel } from "../users/models/user";
5 | export { default as PostModel } from "../posts/models/post";
6 | export { default as CommentModel } from "../comments/models/comment";
7 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/users/models/user.ts:
--------------------------------------------------------------------------------
1 | // Original file keeps default export
2 | export default interface User {
3 | id: string;
4 | name: string;
5 | email: string;
6 | }
7 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/users/services/user-service.ts:
--------------------------------------------------------------------------------
1 | // Original file keeps default export
2 | import type User from "../models/user";
3 |
4 | export default class UserService {
5 | getUser(id: string): User {
6 | return { id, name: "John", email: "john@example.com" };
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/users/shared/service.ts:
--------------------------------------------------------------------------------
1 | // Should be converted to named export
2 | export { default as UserService } from "../services/user-service";
3 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/src/users/shared/types.ts:
--------------------------------------------------------------------------------
1 | // Should be converted to named export
2 | export { default as User } from "../models/user";
3 |
--------------------------------------------------------------------------------
/codegen-examples/examples/remove_default_exports/input_repo/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2020",
4 | "module": "commonjs",
5 | "strict": true,
6 | "esModuleInterop": true,
7 | "skipLibCheck": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "baseUrl": "./",
10 | "paths": {
11 | "@/*": ["src/*"]
12 | }
13 | },
14 | "include": ["../../src/**/*"],
15 | "exclude": ["node_modules"]
16 | }
17 |
--------------------------------------------------------------------------------
/codegen-examples/examples/slack_chatbot/.env.template:
--------------------------------------------------------------------------------
1 | SLACK_SIGNING_SECRET="..."
2 | SLACK_BOT_TOKEN="..."
3 | OPENAI_API_KEY="..."
4 |
--------------------------------------------------------------------------------
/codegen-examples/examples/slack_chatbot/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "fastapi-slack-bot"
3 | version = "0.1.0"
4 | description = "Slack chatbot for answering questions about FastAPI's implementation using Codegen"
5 | requires-python = ">=3.13"
6 | dependencies = [
7 | "modal>=0.73.25",
8 | "slack-bolt>=1.18.0",
9 | "codegen>=0.5.30",
10 | "openai>=1.1.0",
11 | ]
12 |
--------------------------------------------------------------------------------
/codegen-examples/examples/sqlalchemy_1.6_to_2.0/input_repo/database.py:
--------------------------------------------------------------------------------
1 | # database.py
2 | from sqlalchemy import create_engine
3 | from sqlalchemy.ext.declarative import declarative_base
4 | from sqlalchemy.orm import sessionmaker
5 |
6 | SQLALCHEMY_DATABASE_URL = "postgresql://user:password@localhost/dbname" # Change to your database URL
7 |
8 | engine = create_engine(SQLALCHEMY_DATABASE_URL)
9 | SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
10 |
11 | Base = declarative_base()
12 |
--------------------------------------------------------------------------------
/codegen-examples/examples/sqlalchemy_1.6_to_2.0/input_repo/models.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy import Column, Integer, String, ForeignKey
2 | from sqlalchemy.orm import relationship
3 | from database import Base
4 |
5 | class Publisher(Base):
6 | __tablename__ = "publishers"
7 |
8 | id = Column(Integer, primary_key=True, index=True)
9 | name = Column(String, unique=True, index=True)
10 | books = relationship("Book", backref="publisher")
11 |
12 |
13 | class Book(Base):
14 | __tablename__ = "books"
15 |
16 | id = Column(Integer, primary_key=True, index=True)
17 | title = Column(String, index=True)
18 | author = Column(String, index=True)
19 | description = Column(String)
20 | publisher_id = Column(Integer, ForeignKey("publishers.id"))
21 |
--------------------------------------------------------------------------------
/codegen-examples/examples/sqlalchemy_1.6_to_2.0/input_repo/schemas.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 | from typing import List, Optional
3 |
4 | class PublisherBase(BaseModel):
5 | name: str
6 |
7 | class PublisherCreate(PublisherBase):
8 | pass
9 |
10 | class Publisher(PublisherBase):
11 | id: int
12 | books: List["Book"] = []
13 |
14 | class Config:
15 | orm_mode = True
16 |
17 | class BookBase(BaseModel):
18 | title: str
19 | author: str
20 | description: str
21 | publisher_id: Optional[int]
22 |
23 | class BookCreate(BookBase):
24 | pass
25 |
26 | class Book(BookBase):
27 | id: int
28 | publisher: Optional[Publisher]
29 |
30 | class Config:
31 | orm_mode = True
32 |
--------------------------------------------------------------------------------
/codegen-examples/examples/sqlalchemy_type_annotations/input_repo/README.md:
--------------------------------------------------------------------------------
1 | # SQLAlchemy Type Notations Example
2 |
3 | A minimal repository for testing SQLAlchemy type annotations and database patterns.
4 |
5 | ## Purpose
6 |
7 | - Test SQLAlchemy type annotations
8 | - Experiment with database patterns
9 | - Quick prototyping environment
10 |
--------------------------------------------------------------------------------
/codegen-examples/examples/sqlalchemy_type_annotations/input_repo/config/settings.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | DATABASE_URL = os.getenv("DATABASE_URL", "postgresql://user:pass@localhost:5432/db")
4 |
--------------------------------------------------------------------------------
/codegen-examples/examples/sqlalchemy_type_annotations/input_repo/database/connection.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy import create_engine
2 | from sqlalchemy.orm import sessionmaker
3 | from ..config.settings import DATABASE_URL
4 |
5 | engine = create_engine(DATABASE_URL)
6 | SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
7 |
--------------------------------------------------------------------------------
/codegen-examples/examples/sqlalchemy_type_annotations/input_repo/models/base.py:
--------------------------------------------------------------------------------
1 | from sqlalchemy.ext.declarative import declarative_base
2 | from sqlalchemy.orm import Session
3 |
4 | Base = declarative_base()
5 |
6 |
7 | def get_db() -> Session:
8 | # Placeholder for DB session creation
9 | pass
10 |
--------------------------------------------------------------------------------
/codegen-examples/examples/sqlalchemy_type_annotations/input_repo/models/organization.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | from sqlalchemy import Column, Integer, String, DateTime
4 | from sqlalchemy.orm import relationship
5 | from .base import Base
6 |
7 |
8 | class Organization(Base):
9 | __tablename__ = "organizations"
10 |
11 | id = Column(Integer, primary_key=True)
12 | name = Column(String(200))
13 | xero_organization_id = Column(String(50), unique=True)
14 | stripe_customer_id = Column(String(100))
15 | updated_at = Column(DateTime)
16 |
17 | # Relationships
18 | users = relationship("User", back_populates="organization")
19 | transactions = relationship("Transaction", back_populates="organization")
20 |
--------------------------------------------------------------------------------
/codegen-examples/examples/sqlalchemy_type_annotations/input_repo/models/user.py:
--------------------------------------------------------------------------------
1 |
2 | from sqlalchemy import Column, Integer, String, ForeignKey, Boolean
3 | from sqlalchemy.orm import relationship
4 | from .base import Base
5 |
6 |
7 | class User(Base):
8 | __tablename__ = "users"
9 |
10 | id = Column(Integer, primary_key=True)
11 | email = Column(String(255), unique=True)
12 | username = Column(String(100))
13 | is_active = Column(Boolean, default=True)
14 | organization_id = Column(Integer, ForeignKey("organizations.id"))
15 |
16 | # Relationships
17 | organization = relationship("Organization", back_populates="users")
18 | transactions = relationship("Transaction", back_populates="user")
19 |
--------------------------------------------------------------------------------
/codegen-examples/examples/swebench_agent_run/.env.template:
--------------------------------------------------------------------------------
1 | OPENAI_API_KEY= # Your OpenAI API key
2 | ANTHROPIC_API_KEY= # Your Anthropic API key
3 | LANGSMITH_API_KEY= # Your Langsmith API key
4 | LANGCHAIN_TRACING_V2= # `true` for tracing, `false` for no tracing
5 | LANGCHAIN_PROJECT= # Your Langchain project
6 | RELACE_API= # Your Relace API key
7 |
--------------------------------------------------------------------------------
/codegen-examples/examples/swebench_agent_run/.gitignore:
--------------------------------------------------------------------------------
1 | .env.db
2 |
--------------------------------------------------------------------------------
/codegen-examples/examples/swebench_agent_run/constants.py:
--------------------------------------------------------------------------------
1 | from codegen.extensions.swebench.enums import SWEBenchDataset
2 | from codegen.extensions.swebench.enums import SWEBenchLiteSubset
3 |
4 |
5 | DATASET_DICT = {
6 | "lite": SWEBenchDataset.LITE,
7 | "full": SWEBenchDataset.FULL,
8 | "verified": SWEBenchDataset.VERIFIED,
9 | "lite_small": SWEBenchLiteSubset.LITE_SMALL,
10 | "lite_medium": SWEBenchLiteSubset.LITE_MEDIUM,
11 | "lite_large": SWEBenchLiteSubset.LITE_LARGE,
12 | }
13 |
--------------------------------------------------------------------------------
/codegen-examples/examples/swebench_agent_run/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "swebench-agent-run"
3 | version = "0.1.0"
4 | description = "Add your description here"
5 | readme = "README.md"
6 | requires-python = ">=3.12, <3.14"
7 | dependencies = ["modal>=0.73.25"]
8 |
9 | [tool.setuptools]
10 | py-modules = ["entry_point", "run_eval"]
11 |
--------------------------------------------------------------------------------
/codegen-examples/examples/swebench_agent_run/test.py:
--------------------------------------------------------------------------------
1 | from codegen import Codebase
2 | import modal
3 |
4 | image = modal.Image.debian_slim(python_version="3.13").apt_install("git").pip_install("fastapi[standard]").run_commands("pip install codegen")
5 |
6 | app = modal.App(name="codegen-examples", image=image, secrets=[modal.Secret.from_dotenv()])
7 |
8 |
9 | @app.function()
10 | def run_agent(AgentClass):
11 | codebase = Codebase.from_repo(repo_full_name="pallets/flask")
12 | agent = AgentClass(codebase)
13 | agent.run(prompt="Tell me about the codebase and the files in it.")
14 | return True
15 |
--------------------------------------------------------------------------------
/codegen-examples/examples/unittest_to_pytest/input_repo/jj_classes/character.py:
--------------------------------------------------------------------------------
1 | # jj_classes/character.py
2 |
3 |
4 | class Character:
5 | """Defines the Character class."""
6 |
7 | def __init__(self, name):
8 | """Initialize the character."""
9 | if not name:
10 | raise ValueError("Character name cannot be empty.")
11 | self._name = name
12 | self._powerup = None
13 |
14 | @property
15 | def name(self):
16 | return self._name
17 |
18 | @property
19 | def powerup(self):
20 | return self._powerup
21 |
22 | @powerup.setter
23 | def powerup(self, value):
24 | self._powerup = value
25 |
--------------------------------------------------------------------------------
/codegen-examples/examples/unittest_to_pytest/input_repo/run_tests.py:
--------------------------------------------------------------------------------
1 | # run_tests.py
2 |
3 | import unittest
4 |
5 | if __name__ == "__main__":
6 | loader = unittest.TestLoader()
7 | tests = loader.discover("tests")
8 | test_runner = unittest.TextTestRunner()
9 | test_runner.run(tests)
10 |
--------------------------------------------------------------------------------
/codegen-examples/examples/unittest_to_pytest/input_repo/tests/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/codegen-examples/examples/unittest_to_pytest/input_repo/tests/__init__.py
--------------------------------------------------------------------------------
/docs/.gitignore:
--------------------------------------------------------------------------------
1 | OLD/*
2 |
--------------------------------------------------------------------------------
/docs/README.md:
--------------------------------------------------------------------------------
1 | # Codegen Docs
2 |
3 | ## Development
4 |
5 | From within the `docs/` subdirectory:
6 |
7 | ```bash
8 | npm i -g mintlify
9 | mintlify dev --port 3333
10 | ```
11 |
12 | You should then get hot reloading. Also recommend installing the `MDX` extension for VSCode.
13 |
14 | ## Adding New Pages
15 |
16 | - Edit the page as a `.mdx` doc
17 | - Make sure to edit `mint.json` so it appears in the UI
18 |
--------------------------------------------------------------------------------
/docs/agents/create-agent-run.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | openapi: post /v1/organizations/{org_id}/agent/run
3 | ---
--------------------------------------------------------------------------------
/docs/agents/get-agent-run.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | openapi: get /v1/organizations/{org_id}/agent/run/{agent_run_id}
3 | ---
--------------------------------------------------------------------------------
/docs/gen/faq.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: "Frequently Asked Questions"
3 | sidebarTitle: "FAQ"
4 | icon: "square-question"
5 | iconType: "solid"
6 | ---
7 |
8 |
9 |
10 | Claude 3.7. Our code agent is roughly comparable with Claude Code.
11 |
12 |
13 | Yes! For now. Get it while it's hot.
14 |
15 |
16 | Codegen stores this data in their private cloud. We are SOC-2 compliant. [Learn more](/introduction/about)
17 |
18 |
--------------------------------------------------------------------------------
/docs/images/agent-permissions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/agent-permissions.png
--------------------------------------------------------------------------------
/docs/images/async-await.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/async-await.png
--------------------------------------------------------------------------------
/docs/images/blast-radius.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/blast-radius.png
--------------------------------------------------------------------------------
/docs/images/codegen-bot-intro.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/codegen-bot-intro.png
--------------------------------------------------------------------------------
/docs/images/codegen-thumbnail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/codegen-thumbnail.png
--------------------------------------------------------------------------------
/docs/images/codegen.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/codegen.jpeg
--------------------------------------------------------------------------------
/docs/images/devin-edits-codemod.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/devin-edits-codemod.png
--------------------------------------------------------------------------------
/docs/images/explainer-text.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/explainer-text.png
--------------------------------------------------------------------------------
/docs/images/import-loops.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/import-loops.png
--------------------------------------------------------------------------------
/docs/images/large-import-loop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/large-import-loop.png
--------------------------------------------------------------------------------
/docs/images/linear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/linear.png
--------------------------------------------------------------------------------
/docs/images/llm-configuration.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/llm-configuration.png
--------------------------------------------------------------------------------
/docs/images/mine-amethyst.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/mine-amethyst.png
--------------------------------------------------------------------------------
/docs/images/neo4j-call-graph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/neo4j-call-graph.png
--------------------------------------------------------------------------------
/docs/images/neo4j-class-hierarchy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/neo4j-class-hierarchy.png
--------------------------------------------------------------------------------
/docs/images/neo4j-class-methods.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/neo4j-class-methods.png
--------------------------------------------------------------------------------
/docs/images/neo4j-function-calls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/neo4j-function-calls.png
--------------------------------------------------------------------------------
/docs/images/nether-portal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/nether-portal.png
--------------------------------------------------------------------------------
/docs/images/problematic-import-loop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/problematic-import-loop.png
--------------------------------------------------------------------------------
/docs/images/python-extensions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/python-extensions.png
--------------------------------------------------------------------------------
/docs/images/repo-rules.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/repo-rules.png
--------------------------------------------------------------------------------
/docs/images/sandbox-buttons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/sandbox-buttons.png
--------------------------------------------------------------------------------
/docs/images/set-interpreter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/set-interpreter.png
--------------------------------------------------------------------------------
/docs/images/setup-commands-ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/setup-commands-ui.png
--------------------------------------------------------------------------------
/docs/images/slack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/slack.png
--------------------------------------------------------------------------------
/docs/images/system-prompt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/system-prompt.png
--------------------------------------------------------------------------------
/docs/images/twilio-diff-after.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/twilio-diff-after.png
--------------------------------------------------------------------------------
/docs/images/twilio-diff-before.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/twilio-diff-before.png
--------------------------------------------------------------------------------
/docs/images/twilio-then.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/twilio-then.png
--------------------------------------------------------------------------------
/docs/images/valid-import-loop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/valid-import-loop.png
--------------------------------------------------------------------------------
/docs/images/voyager-full.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/voyager-full.png
--------------------------------------------------------------------------------
/docs/images/voyager-performance.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/voyager-performance.png
--------------------------------------------------------------------------------
/docs/images/voyager-retrieval.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/voyager-retrieval.png
--------------------------------------------------------------------------------
/docs/images/voyager.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/images/voyager.png
--------------------------------------------------------------------------------
/docs/organizations/get-organizations.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | openapi: get /v1/organizations
3 | ---
--------------------------------------------------------------------------------
/docs/snippets/Attribute.mdx:
--------------------------------------------------------------------------------
1 | export const Attribute = ({ type, description }) => (
2 |
3 |
4 | {type}
5 |
6 |
{description}
7 |
8 | )
--------------------------------------------------------------------------------
/docs/snippets/GithubLinkNote.mdx:
--------------------------------------------------------------------------------
1 | export const GithubLinkNote = ({link}) => (
2 |
3 |
4 |
5 | )
6 |
--------------------------------------------------------------------------------
/docs/snippets/HorizontalDivider.mdx:
--------------------------------------------------------------------------------
1 | export const HorizontalDivider = ({light=false}) => (
2 |
6 | )
--------------------------------------------------------------------------------
/docs/snippets/ParameterWrapper.mdx:
--------------------------------------------------------------------------------
1 | export const ParameterWrapper = ({ children }) => (
2 |
3 |
Parameters
4 |
5 | {children}
6 |
7 |
8 | )
--------------------------------------------------------------------------------
/docs/snippets/Return.mdx:
--------------------------------------------------------------------------------
1 | export const Return = ({return_type, description}) => (
2 |
3 |
Returns
4 |
5 |
6 |
7 |
8 | {return_type}
9 |
10 |
11 |
{description}
12 |
13 |
14 |
15 | )
--------------------------------------------------------------------------------
/docs/snippets/links.mdx:
--------------------------------------------------------------------------------
1 | export const COMMUNITY_SLACK_URL = "https://community.codegen.com";
2 |
3 | export const CODEGEN_SDK_GITHUB_URL =
4 | "https://github.com/codegen-sh/codegen-sdk";
5 |
6 | export const CODEGEN_SDK_EXAMPLES_GITHUB_URL =
7 | "https://github.com/codegen-sh/codegen-examples";
8 |
9 | export const CODEGEN_SYSTEM_PROMPT = "https://raw.githubusercontent.com/codegen-sh/codegen-sdk/refs/heads/develop/src/codegen/sdk/system-prompt.txt"
--------------------------------------------------------------------------------
/docs/style.css:
--------------------------------------------------------------------------------
1 | .dark .bg-codeblock {
2 | background-color: #15141b !important;
3 | }
4 |
--------------------------------------------------------------------------------
/docs/use-cases/I. Upgrading APIs.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/use-cases/I. Upgrading APIs.md
--------------------------------------------------------------------------------
/docs/use-cases/II. Improving Codebase Modularity.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/use-cases/II. Improving Codebase Modularity.md
--------------------------------------------------------------------------------
/docs/use-cases/III. Improving Type Coverage.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/use-cases/III. Improving Type Coverage.md
--------------------------------------------------------------------------------
/docs/use-cases/IV. Analyzing Critical Code Paths.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/docs/use-cases/IV. Analyzing Critical Code Paths.md
--------------------------------------------------------------------------------
/docs/users/get-user.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | openapi: get /v1/organizations/{org_id}/users/{user_id}
3 | ---
--------------------------------------------------------------------------------
/docs/users/get-users.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | openapi: get /v1/organizations/{org_id}/users
3 | ---
--------------------------------------------------------------------------------
/examples.md:
--------------------------------------------------------------------------------
1 | # Codegen Examples
2 |
3 | For practical examples of using Codegen in real-world scenarios, please visit our dedicated examples repository:
4 |
5 | [github.com/codegen-sh/codegen-examples](https://github.com/codegen-sh/codegen-examples)
6 |
7 | For docs and tutorials, please visit [docs.codegen.com](https://docs.codegen.com)
8 |
--------------------------------------------------------------------------------
/install-hooks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # directory of this script
4 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
5 |
6 | # directory of the git hooks
7 | GITHOOKS_DIR="${SCRIPT_DIR}/../githooks"
8 |
9 | # directory where the hooks should be installed
10 | INSTALL_DIR="${SCRIPT_DIR}/../.git/hooks"
11 |
12 | # loop through the files in the githooks directory
13 | for HOOK in $(ls "${GITHOOKS_DIR}"); do
14 | # create a symbolic link in the .git/hooks directory
15 | ln -sf "${GITHOOKS_DIR}/${HOOK}" "${INSTALL_DIR}/${HOOK}"
16 |
17 | # change permissions to make the hook executable
18 | chmod +x "${INSTALL_DIR}/${HOOK}"
19 | done
20 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "release": {
4 | "branches": ["develop"],
5 | "plugins": [
6 | "@semantic-release/commit-analyzer",
7 | "@semantic-release/release-notes-generator",
8 | "@semantic-release/github"
9 | ]
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/renovate.json5:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3 | "extends": [
4 | "config:recommended",
5 | ":automergeLinters",
6 | ":automergeMinor",
7 | ":automergePatch",
8 | // ":enablePreCommit",
9 | ":maintainLockFilesWeekly",
10 | "group:githubArtifactActions",
11 | "schedule:automergeWeekly"
12 | ],
13 | lockFileMaintenance: {
14 | enabled: true,
15 | "automerge": true
16 | },
17 | }
18 |
--------------------------------------------------------------------------------
/scripts/setup.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | uv tool install pre-commit --with pre-commit-uv
3 | uv tool install deptry
4 | uv tool update-shell
5 | uv venv && source .venv/bin/activate
6 | uv sync
7 | pre-commit install
8 | pre-commit install-hooks
9 |
--------------------------------------------------------------------------------
/src/HIRING.md:
--------------------------------------------------------------------------------
1 | # Hiring
2 |
3 | Are you excited about static analysis and codebase transformation? We're hiring!
4 |
5 | For current openings and to apply, visit [codegen.com/careers](https://codegen.com/careers).
6 |
--------------------------------------------------------------------------------
/src/codegen/__init__.py:
--------------------------------------------------------------------------------
1 | from codegen.agents.agent import Agent
2 | from codegen.cli.sdk.decorator import function
3 | from codegen.cli.sdk.functions import Function
4 | from codegen.extensions.events.codegen_app import CodegenApp
5 | from codegen.sdk.core.codebase import Codebase
6 | from codegen.shared.enums.programming_language import ProgrammingLanguage
7 |
8 | __all__ = ["Agent", "Codebase", "CodegenApp", "Function", "ProgrammingLanguage", "function"]
9 |
--------------------------------------------------------------------------------
/src/codegen/agents/__init__.py:
--------------------------------------------------------------------------------
1 | """Codegen Agent API module."""
2 |
3 | from codegen.agents.agent import Agent
4 |
5 | __all__ = ["Agent"]
6 |
--------------------------------------------------------------------------------
/src/codegen/agents/constants.py:
--------------------------------------------------------------------------------
1 | CODEGEN_BASE_API_URL = "https://codegen-sh--rest-api.modal.run"
2 |
--------------------------------------------------------------------------------
/src/codegen/cli/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/cli/__init__.py
--------------------------------------------------------------------------------
/src/codegen/cli/_env.py:
--------------------------------------------------------------------------------
1 | ENV = ""
2 |
--------------------------------------------------------------------------------
/src/codegen/cli/api/webapp_routes.py:
--------------------------------------------------------------------------------
1 | # Urls linking to the webapp
2 | from codegen.cli.utils.url import generate_webapp_url
3 |
4 | USER_SECRETS_ROUTE = generate_webapp_url(path="cli-token")
5 |
--------------------------------------------------------------------------------
/src/codegen/cli/auth/constants.py:
--------------------------------------------------------------------------------
1 | from pathlib import Path
2 |
3 | # Base directories
4 | CONFIG_DIR = Path("~/.config/codegen-sh").expanduser()
5 | CODEGEN_DIR = Path(".codegen")
6 | PROMPTS_DIR = CODEGEN_DIR / "prompts"
7 |
8 | # Subdirectories
9 | DOCS_DIR = CODEGEN_DIR / "docs"
10 | EXAMPLES_DIR = CODEGEN_DIR / "examples"
11 |
12 | # Files
13 | AUTH_FILE = CONFIG_DIR / "auth.json"
14 |
--------------------------------------------------------------------------------
/src/codegen/cli/codemod/convert.py:
--------------------------------------------------------------------------------
1 | from textwrap import indent
2 |
3 |
4 | def convert_to_cli(input: str, language: str, name: str) -> str:
5 | return f"""
6 | # Run this codemod using `codegen run {name}` OR the `run_codemod` MCP tool.
7 | # Important: if you run this as a regular python file, you MUST run it such that
8 | # the base directory './' is the base of your codebase, otherwise it will not work.
9 | import codegen
10 | from codegen import Codebase
11 |
12 |
13 | @codegen.function('{name}')
14 | def run(codebase: Codebase):
15 | {indent(input, " ")}
16 |
17 |
18 | if __name__ == "__main__":
19 | print('Parsing codebase...')
20 | codebase = Codebase("./")
21 |
22 | print('Running function...')
23 | codegen.run(run)
24 | """
25 |
26 |
27 | def convert_to_ui(input: str) -> str:
28 | return input
29 |
--------------------------------------------------------------------------------
/src/codegen/cli/commands/init/render.py:
--------------------------------------------------------------------------------
1 | from pathlib import Path
2 |
3 |
4 | def get_success_message(codegen_dir: Path, docs_dir: Path, examples_dir: Path) -> str:
5 | """Get the success message to display after initialization."""
6 | return """📁 .codegen configuration folder created:
7 | [dim]codemods/[/dim] Your codemod implementations
8 | [dim].venv/[/dim] Python virtual environment (gitignored)
9 | [dim]codegen-system-prompt.txt[/dim] AI system prompt (gitignored)"""
10 |
--------------------------------------------------------------------------------
/src/codegen/cli/commands/login/main.py:
--------------------------------------------------------------------------------
1 | import rich_click as click
2 |
3 | from codegen.cli.auth.login import login_routine
4 | from codegen.cli.auth.token_manager import get_current_token
5 |
6 |
7 | @click.command(name="login")
8 | @click.option("--token", required=False, help="API token for authentication")
9 | def login_command(token: str):
10 | """Store authentication token."""
11 | # Check if already authenticated
12 | if get_current_token():
13 | msg = "Already authenticated. Use 'codegen logout' to clear the token."
14 | raise click.ClickException(msg)
15 |
16 | login_routine(token)
17 |
--------------------------------------------------------------------------------
/src/codegen/cli/commands/logout/main.py:
--------------------------------------------------------------------------------
1 | import rich
2 | import rich_click as click
3 |
4 | from codegen.cli.auth.token_manager import TokenManager
5 |
6 |
7 | @click.command(name="logout")
8 | def logout_command():
9 | """Clear stored authentication token."""
10 | token_manager = TokenManager()
11 | token_manager.clear_token()
12 | rich.print("Successfully logged out")
13 |
--------------------------------------------------------------------------------
/src/codegen/cli/commands/lsp/lsp.py:
--------------------------------------------------------------------------------
1 | import logging
2 |
3 | import click
4 |
5 | from codegen.shared.logging.get_logger import get_logger
6 |
7 | logger = get_logger(__name__)
8 |
9 |
10 | @click.command(name="lsp")
11 | def lsp_command():
12 | try:
13 | from codegen.extensions.lsp.lsp import server
14 | except (ImportError, ModuleNotFoundError):
15 | logger.exception("LSP is not installed. Please install it with `uv tool install codegen[lsp] --prerelease=allow`")
16 | return
17 | logging.basicConfig(level=logging.INFO)
18 | server.start_io()
19 |
--------------------------------------------------------------------------------
/src/codegen/cli/commands/style_debug/main.py:
--------------------------------------------------------------------------------
1 | """Debug command to visualize CLI styling components."""
2 |
3 | import time
4 |
5 | import rich_click as click
6 |
7 | from codegen.cli.rich.spinners import create_spinner
8 |
9 |
10 | @click.command(name="style-debug")
11 | @click.option("--text", default="Loading...", help="Text to show in the spinner")
12 | def style_debug_command(text: str):
13 | """Debug command to visualize CLI styling (spinners, etc)."""
14 | try:
15 | with create_spinner(text) as status:
16 | # Run indefinitely until Ctrl+C
17 | while True:
18 | time.sleep(0.1)
19 | except KeyboardInterrupt:
20 | # Exit gracefully on Ctrl+C
21 | pass
22 |
--------------------------------------------------------------------------------
/src/codegen/cli/env/constants.py:
--------------------------------------------------------------------------------
1 | from codegen.cli.env.enums import Environment
2 |
3 | DEFAULT_ENV = Environment.PRODUCTION
4 |
--------------------------------------------------------------------------------
/src/codegen/cli/env/enums.py:
--------------------------------------------------------------------------------
1 | from enum import StrEnum
2 |
3 |
4 | class Environment(StrEnum):
5 | PRODUCTION = "prod"
6 | STAGING = "staging"
7 | DEVELOP = "develop"
8 |
--------------------------------------------------------------------------------
/src/codegen/cli/git/folder.py:
--------------------------------------------------------------------------------
1 | import os
2 | from pathlib import Path
3 |
4 |
5 | # TODO: move to codegen.git module
6 | def get_git_folder(path: os.PathLike | None = None) -> Path | None:
7 | if path is None:
8 | path = Path.cwd()
9 | path = Path(path)
10 | while path != path.root:
11 | if (path / ".git").exists():
12 | return path
13 | path = path.parent
14 | return None
15 |
--------------------------------------------------------------------------------
/src/codegen/cli/git/repo.py:
--------------------------------------------------------------------------------
1 | import os
2 | from pathlib import Path
3 |
4 | from pygit2.repository import Repository
5 |
6 | from codegen.cli.git.folder import get_git_folder
7 |
8 |
9 | # TODO: move to codegen.git module
10 | def get_git_repo(path: os.PathLike | None = None) -> Repository | None:
11 | if path is None:
12 | path = Path.cwd()
13 | git_folder = get_git_folder(path)
14 | if git_folder is None:
15 | return None
16 | return Repository(str(git_folder))
17 |
--------------------------------------------------------------------------------
/src/codegen/cli/mcp/resources/system_setup_instructions.py:
--------------------------------------------------------------------------------
1 | SETUP_INSTRUCTIONS = """
2 |
3 | 1. Ensure you have `uv` installed. If you don't have it installed, you can install it by running `uv install uv`.
4 | 2. install codegen with the command `uv tool install codegen`.
5 | 3. initialize the codegen project with the command `codegen init`.
6 | - This will create a virtual environment and install the dependencies.
7 | 4. To run codemods ensure that the terminal has activated the virtual environment by running `source ./.codegen/.venv/bin/activate`.
8 |
9 |
10 | That's it! You're all set up.
11 | """
12 |
--------------------------------------------------------------------------------
/src/codegen/cli/rich/spinners.py:
--------------------------------------------------------------------------------
1 | """Consistent spinner styles for the CLI."""
2 |
3 | from dataclasses import dataclass
4 |
5 | from rich.status import Status
6 |
7 |
8 | @dataclass
9 | class SpinnerConfig:
10 | """Configuration for a consistent spinner style."""
11 |
12 | text: str
13 | spinner: str = "dots"
14 | style: str = "bold"
15 | spinner_style: str = "blue"
16 |
17 |
18 | def create_spinner(text: str) -> Status:
19 | """Create a spinner with consistent styling.
20 |
21 | Args:
22 | text: The text to show next to the spinner
23 |
24 | Returns:
25 | A rich Status object with consistent styling
26 |
27 | """
28 | config = SpinnerConfig(text)
29 | return Status(f"[{config.style}]{config.text}", spinner=config.spinner, spinner_style=config.spinner_style)
30 |
--------------------------------------------------------------------------------
/src/codegen/cli/sdk/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/cli/sdk/__init__.py
--------------------------------------------------------------------------------
/src/codegen/cli/sdk/models.py:
--------------------------------------------------------------------------------
1 | from dataclasses import dataclass
2 |
3 |
4 | @dataclass
5 | class PullRequest:
6 | """A pull request created by a codemod."""
7 |
8 | url: str
9 | number: int
10 | title: str
11 |
--------------------------------------------------------------------------------
/src/codegen/cli/utils/count_functions_2.py:
--------------------------------------------------------------------------------
1 | NumberType = int | float
2 |
--------------------------------------------------------------------------------
/src/codegen/cli/utils/default_code.py:
--------------------------------------------------------------------------------
1 | DEFAULT_CODEMOD = '''import codegen
2 | from codegen.sdk.core.codebase import Codebase
3 |
4 |
5 | @codegen.function("{name}")
6 | def run(codebase: Codebase):
7 | """Add a description of what this codemod does."""
8 | # Add your code here
9 | print('Total files: ', len(codebase.files))
10 | print('Total functions: ', len(codebase.functions))
11 | print('Total imports: ', len(codebase.imports))
12 |
13 |
14 | if __name__ == "__main__":
15 | print('Parsing codebase...')
16 | codebase = Codebase("./")
17 |
18 | print('Running...')
19 | run(codebase)
20 | '''
21 |
--------------------------------------------------------------------------------
/src/codegen/cli/utils/schema.py:
--------------------------------------------------------------------------------
1 | from typing import Self
2 |
3 | from pydantic import BaseModel
4 |
5 |
6 | class SafeBaseModel(BaseModel):
7 | @classmethod
8 | def model_validate(cls, data: dict) -> "Self":
9 | try:
10 | return super().model_validate(data)
11 | except Exception as e:
12 | print(e)
13 | return None
14 |
15 | def __str__(self) -> str:
16 | return self.model_dump_json(indent=4)
17 |
18 |
19 | class CodemodConfig(BaseModel):
20 | """Configuration for a codemod."""
21 |
22 | name: str
23 | codemod_id: int
24 | description: str | None = None
25 | created_at: str
26 | created_by: str
27 |
--------------------------------------------------------------------------------
/src/codegen/cli/workspace/docs_workspace.py:
--------------------------------------------------------------------------------
1 | import shutil
2 | from pathlib import Path
3 |
4 | from rich.status import Status
5 |
6 |
7 | def populate_api_docs(dest: Path, api_docs: dict[str, str], status: Status):
8 | """Writes all API docs to the docs folder"""
9 | status.update("Populating API documentation...")
10 | # Remove existing docs
11 | shutil.rmtree(dest, ignore_errors=True)
12 | dest.mkdir(parents=True, exist_ok=True)
13 |
14 | # Populate docs
15 | for file, content in api_docs.items():
16 | dest_file = dest / file
17 | dest_file.parent.mkdir(parents=True, exist_ok=True)
18 | dest_file.write_text(content)
19 |
--------------------------------------------------------------------------------
/src/codegen/configs/constants.py:
--------------------------------------------------------------------------------
1 | from pathlib import Path
2 |
3 | CODEGEN_DIR_NAME = ".codegen"
4 | ENV_FILENAME = ".env"
5 |
6 | # ====[ Codegen internal config ]====
7 | CODEGEN_REPO_ROOT = Path(__file__).parent.parent.parent.parent.parent
8 | CODEGEN_DIR_PATH = CODEGEN_REPO_ROOT / CODEGEN_DIR_NAME
9 |
10 | # ====[ User session config ]====
11 | PROMPTS_DIR = Path(CODEGEN_DIR_NAME) / "prompts"
12 | DOCS_DIR = Path(CODEGEN_DIR_NAME) / "docs"
13 | EXAMPLES_DIR = Path(CODEGEN_DIR_NAME) / "examples"
14 |
15 |
16 | # ====[ User global config paths ]====
17 | GLOBAL_CONFIG_DIR = Path("~/.config/codegen-sh").expanduser()
18 | AUTH_FILE = GLOBAL_CONFIG_DIR / "auth.json"
19 | SESSION_FILE = GLOBAL_CONFIG_DIR / "session.json"
20 | GLOBAL_ENV_FILE = GLOBAL_CONFIG_DIR / ENV_FILENAME
21 |
--------------------------------------------------------------------------------
/src/codegen/configs/models/secrets.py:
--------------------------------------------------------------------------------
1 | from codegen.configs.models.base_config import BaseConfig
2 |
3 |
4 | class SecretsConfig(BaseConfig):
5 | """Configuration for various API secrets and tokens.
6 |
7 | Loads from environment variables.
8 | Falls back to .env file for missing values.
9 | """
10 |
11 | def __init__(self, prefix: str = "", *args, **kwargs) -> None:
12 | super().__init__(prefix=prefix, *args, **kwargs)
13 |
14 | github_token: str | None = None
15 | openai_api_key: str | None = None
16 | linear_api_key: str | None = None
17 |
--------------------------------------------------------------------------------
/src/codegen/configs/models/utils.py:
--------------------------------------------------------------------------------
1 | from pydantic_settings import SettingsConfigDict
2 |
3 |
4 | def get_setting_config(prefix: str) -> SettingsConfigDict:
5 | return SettingsConfigDict(
6 | env_prefix=f"{prefix}_",
7 | case_sensitive=False,
8 | extra="ignore",
9 | )
10 |
--------------------------------------------------------------------------------
/src/codegen/extensions/__init__.py:
--------------------------------------------------------------------------------
1 | """Extensions for the codegen package."""
2 |
3 | from codegen.extensions.index.code_index import CodeIndex
4 | from codegen.extensions.index.file_index import FileIndex
5 |
6 | __all__ = ["CodeIndex", "FileIndex"]
7 |
--------------------------------------------------------------------------------
/src/codegen/extensions/attribution/3pp/__init__.py:
--------------------------------------------------------------------------------
1 | """Code for fetching attributions from 3rd party products."""
2 |
--------------------------------------------------------------------------------
/src/codegen/extensions/events/interface.py:
--------------------------------------------------------------------------------
1 | from typing import Protocol
2 |
3 | import modal # deptry: ignore
4 |
5 |
6 | class EventHandlerManagerProtocol(Protocol):
7 | def subscribe_handler_to_webhook(self, func_name: str, modal_app: modal.App, event_name):
8 | pass
9 |
10 | def unsubscribe_handler_to_webhook(self, func_name: str, modal_app: modal.App, event_name):
11 | pass
12 |
13 | def unsubscribe_all_handlers(self):
14 | pass
15 |
--------------------------------------------------------------------------------
/src/codegen/extensions/github/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/extensions/github/__init__.py
--------------------------------------------------------------------------------
/src/codegen/extensions/github/types/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/extensions/github/types/__init__.py
--------------------------------------------------------------------------------
/src/codegen/extensions/github/types/author.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 |
3 |
4 | class GitHubAuthor(BaseModel):
5 | name: str
6 | email: str
7 | username: str
8 |
--------------------------------------------------------------------------------
/src/codegen/extensions/github/types/commit.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 |
3 | from .author import GitHubAuthor
4 |
5 |
6 | class GitHubCommit(BaseModel):
7 | id: str
8 | tree_id: str
9 | distinct: bool
10 | message: str
11 | timestamp: str
12 | url: str
13 | author: GitHubAuthor
14 | committer: GitHubAuthor
15 | added: list[str]
16 | removed: list[str]
17 | modified: list[str]
18 |
--------------------------------------------------------------------------------
/src/codegen/extensions/github/types/enterprise.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 |
3 |
4 | class GitHubEnterprise(BaseModel):
5 | id: int
6 | slug: str
7 | name: str
8 | node_id: str
9 | avatar_url: str
10 | description: str
11 | website_url: str
12 | html_url: str
13 | created_at: str
14 | updated_at: str
15 |
--------------------------------------------------------------------------------
/src/codegen/extensions/github/types/installation.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 |
3 |
4 | class GitHubInstallation(BaseModel):
5 | id: int
6 | node_id: str
7 |
--------------------------------------------------------------------------------
/src/codegen/extensions/github/types/label.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 |
3 |
4 | class GitHubLabel(BaseModel):
5 | id: int
6 | node_id: str
7 | url: str
8 | name: str
9 | color: str
10 | default: bool
11 | description: str | None
12 |
--------------------------------------------------------------------------------
/src/codegen/extensions/github/types/organization.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 |
3 |
4 | class GitHubOrganization(BaseModel):
5 | login: str
6 | id: int
7 | node_id: str
8 | url: str
9 | repos_url: str
10 | events_url: str
11 | hooks_url: str
12 | issues_url: str
13 | members_url: str
14 | public_members_url: str
15 | avatar_url: str
16 | description: str
17 |
--------------------------------------------------------------------------------
/src/codegen/extensions/github/types/pusher.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 |
3 |
4 | class GitHubPusher(BaseModel):
5 | name: str
6 | email: str
7 |
--------------------------------------------------------------------------------
/src/codegen/extensions/graph/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/extensions/graph/__init__.py
--------------------------------------------------------------------------------
/src/codegen/extensions/index/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/extensions/index/__init__.py
--------------------------------------------------------------------------------
/src/codegen/extensions/linear/__init__.py:
--------------------------------------------------------------------------------
1 | from .linear_client import LinearClient
2 |
3 | __all__ = ["LinearClient"]
4 |
--------------------------------------------------------------------------------
/src/codegen/extensions/lsp/codemods/__init__.py:
--------------------------------------------------------------------------------
1 | from codegen.extensions.lsp.codemods.base import CodeAction
2 | from codegen.extensions.lsp.codemods.split_tests import SplitTests
3 |
4 | ACTIONS: list[CodeAction] = [SplitTests()]
5 |
--------------------------------------------------------------------------------
/src/codegen/extensions/lsp/completion.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/extensions/lsp/completion.py
--------------------------------------------------------------------------------
/src/codegen/extensions/lsp/utils.py:
--------------------------------------------------------------------------------
1 | from pathlib import Path
2 |
3 | from pygls.uris import to_fs_path
4 |
5 |
6 | def get_path(uri: str) -> Path:
7 | return Path(to_fs_path(uri)).absolute()
8 |
--------------------------------------------------------------------------------
/src/codegen/extensions/swebench/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/extensions/swebench/__init__.py
--------------------------------------------------------------------------------
/src/codegen/extensions/swebench/enums.py:
--------------------------------------------------------------------------------
1 | from enum import Enum
2 |
3 |
4 | class SWEBenchDataset(Enum):
5 | LITE = "princeton-nlp/SWE-bench_Lite"
6 | FULL = "princeton-nlp/SWE-bench"
7 | VERIFIED = "princeton-nlp/SWE-bench-verified"
8 |
9 |
10 | class SWEBenchLiteSubset(Enum):
11 | LITE_SMALL = "lite_small"
12 | LITE_MEDIUM = "lite_medium"
13 | LITE_LARGE = "lite_large"
14 |
--------------------------------------------------------------------------------
/src/codegen/git/README.md:
--------------------------------------------------------------------------------
1 | # Codegen Git
2 |
3 | A codegen module to supports git operations on codebase.
4 |
5 | ### Dependencies
6 |
7 | - [codegen.sdk](https://github.com/codegen-sh/codegen-sdk/tree/develop/src/codegen/sdk)
8 | - [codegen.shared](https://github.com/codegen-sh/codegen-sdk/tree/develop/src/codegen/shared)
9 |
--------------------------------------------------------------------------------
/src/codegen/git/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/git/__init__.py
--------------------------------------------------------------------------------
/src/codegen/git/configs/constants.py:
--------------------------------------------------------------------------------
1 | """Git related constants"""
2 |
3 | CODEGEN_BOT_NAME = "codegen-sh[bot]"
4 | CODEGEN_BOT_EMAIL = "131295404+codegen-sh[bot]@users.noreply.github.com"
5 | CODEOWNERS_FILEPATHS = [".github/CODEOWNERS", "CODEOWNERS", "docs/CODEOWNERS"]
6 |
--------------------------------------------------------------------------------
/src/codegen/git/models/github_named_user_context.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 |
3 |
4 | class GithubNamedUserContext(BaseModel):
5 | """Represents a GitHub user parsed from a webhook payload"""
6 |
7 | login: str
8 | email: str | None = None
9 |
10 | @classmethod
11 | def from_payload(cls, payload: dict) -> "GithubNamedUserContext":
12 | return cls(login=payload.get("login"), email=payload.get("email"))
13 |
--------------------------------------------------------------------------------
/src/codegen/git/models/pr_options.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 |
3 | from codegen.shared.decorators.docs import apidoc
4 |
5 |
6 | @apidoc
7 | class PROptions(BaseModel):
8 | """Options for generating a PR.
9 |
10 | Attributes:
11 | title: The title of the pull request.
12 | body: The body content of the pull request.
13 | labels: A list of labels to be added to the pull request.
14 | force_push_head_branch: Whether to force push the head branch.
15 | """
16 |
17 | title: str | None = None
18 | body: str | None = None
19 | labels: list[str] | None = None # TODO: not used until we add labels to GithubPullRequestModel
20 | force_push_head_branch: bool | None = None
21 |
--------------------------------------------------------------------------------
/src/codegen/git/models/pr_part_context.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 |
3 |
4 | class PRPartContext(BaseModel):
5 | """Represents a GitHub pull request part parsed from a webhook payload"""
6 |
7 | ref: str
8 | sha: str
9 |
10 | @classmethod
11 | def from_payload(cls, payload: dict) -> "PRPartContext":
12 | return cls(ref=payload.get("ref"), sha=payload.get("sha"))
13 |
--------------------------------------------------------------------------------
/src/codegen/git/py.typed:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/git/py.typed
--------------------------------------------------------------------------------
/src/codegen/gsbuild/README.md:
--------------------------------------------------------------------------------
1 | # Codegen GS Build
2 |
3 | A codegen module that builds the codegen SDK.
4 |
--------------------------------------------------------------------------------
/src/codegen/gscli/README.md:
--------------------------------------------------------------------------------
1 | # Codegen GS CLI
2 |
3 | This module to be moved out into `src/code_generation`
4 |
--------------------------------------------------------------------------------
/src/codegen/gscli/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/gscli/__init__.py
--------------------------------------------------------------------------------
/src/codegen/gscli/backend/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/gscli/backend/__init__.py
--------------------------------------------------------------------------------
/src/codegen/gscli/backend/utils.py:
--------------------------------------------------------------------------------
1 | ########################################################################################################################
2 | # MISC
3 | ########################################################################################################################
4 |
5 |
6 | def filepath_to_modulename(filepath: str) -> str:
7 | """Used to convert a an app ref passed in as a filepath to a module"""
8 | module = filepath.removesuffix(".py")
9 | return module.replace("/", ".")
10 |
--------------------------------------------------------------------------------
/src/codegen/gscli/cli.py:
--------------------------------------------------------------------------------
1 | #!/bin/python
2 |
3 | import click
4 |
5 | from codegen.gscli.generate.commands import generate
6 |
7 |
8 | @click.group()
9 | def main() -> None:
10 | pass
11 |
12 |
13 | # ============= Import all command groups =============
14 | main.add_command(generate)
15 |
16 |
17 | if __name__ == "__main__":
18 | main()
19 |
--------------------------------------------------------------------------------
/src/codegen/gscli/generate/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/gscli/generate/__init__.py
--------------------------------------------------------------------------------
/src/codegen/py.typed:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/py.typed
--------------------------------------------------------------------------------
/src/codegen/runner/README.md:
--------------------------------------------------------------------------------
1 | # Codegen Runner
2 |
3 | A module to run functions with managed state + lifecycle.
4 |
5 | ### Dependencies
6 |
7 | - [codegen.sdk](https://github.com/codegen-sh/codegen-sdk/tree/develop/src/codegen/sdk)
8 | - [codegen.git](https://github.com/codegen-sh/codegen-sdk/tree/develop/src/codegen/git)
9 | - [codegen.shared](https://github.com/codegen-sh/codegen-sdk/tree/develop/src/codegen/shared)
10 |
--------------------------------------------------------------------------------
/src/codegen/runner/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/runner/__init__.py
--------------------------------------------------------------------------------
/src/codegen/runner/constants/envvars.py:
--------------------------------------------------------------------------------
1 | """Environment variables used in the sandbox."""
2 |
3 | # ==== [ Environment variable names ] ====
4 | FEATURE_FLAGS_BASE64 = "FEATURE_FLAGS_BASE64"
5 | REPO_CONFIG_BASE64 = "REPO_CONFIG_BASE64"
6 | GITHUB_TOKEN = "GITHUB_TOKEN"
7 |
--------------------------------------------------------------------------------
/src/codegen/runner/enums/warmup_state.py:
--------------------------------------------------------------------------------
1 | from enum import StrEnum
2 |
3 |
4 | class WarmupState(StrEnum):
5 | PENDING = "PENDING"
6 | COMPLETED = "COMPLETED"
7 | FAILED = "FAILED"
8 |
--------------------------------------------------------------------------------
/src/codegen/runner/utils/branch_name.py:
--------------------------------------------------------------------------------
1 | from uuid import uuid4
2 |
3 | from codegen.sdk.codebase.flagging.group import Group
4 |
5 |
6 | def get_head_branch_name(branch_name: str | None, group: Group | None = None) -> str:
7 | if branch_name is None:
8 | branch_name = f"codegen-{uuid4()}"
9 | if group:
10 | return f"{branch_name}-group-{group.id}"
11 | return branch_name
12 |
--------------------------------------------------------------------------------
/src/codegen/runner/utils/exception_utils.py:
--------------------------------------------------------------------------------
1 | from codegen.shared.exceptions.control_flow import StopCodemodException
2 |
3 |
4 | def update_observation_meta(
5 | e: StopCodemodException,
6 | observation_meta: dict | None = None,
7 | ) -> dict:
8 | observation_meta = observation_meta or {}
9 | observation_meta.update(
10 | {
11 | "stop_codemod_exception_type": e.__class__.__name__,
12 | "threshold": e.threshold,
13 | },
14 | )
15 | return observation_meta
16 |
--------------------------------------------------------------------------------
/src/codegen/sdk/ai/client.py:
--------------------------------------------------------------------------------
1 | from openai import OpenAI
2 |
3 |
4 | def get_openai_client(key: str) -> OpenAI:
5 | return OpenAI(api_key=key)
6 |
--------------------------------------------------------------------------------
/src/codegen/sdk/ai/utils.py:
--------------------------------------------------------------------------------
1 | import tiktoken
2 |
3 | ENCODERS = {
4 | "gpt-4o": tiktoken.encoding_for_model("gpt-4o"),
5 | }
6 |
7 |
8 | def count_tokens(s: str, model_name: str = "gpt-4o") -> int:
9 | """Uses tiktoken"""
10 | if s is None:
11 | return 0
12 | enc = ENCODERS.get(model_name, None)
13 | if not enc:
14 | ENCODERS[model_name] = tiktoken.encoding_for_model(model_name)
15 | enc = ENCODERS[model_name]
16 | tokens = enc.encode(s)
17 | return len(tokens)
18 |
--------------------------------------------------------------------------------
/src/codegen/sdk/code_generation/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/code_generation/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/code_generation/codegen_sdk_codebase.py:
--------------------------------------------------------------------------------
1 | import os.path
2 |
3 | from codegen.sdk.code_generation.current_code_codebase import get_codegen_codebase_base_path, get_current_code_codebase
4 | from codegen.sdk.core.codebase import Codebase
5 |
6 |
7 | def get_codegen_sdk_subdirectories() -> list[str]:
8 | base = get_codegen_codebase_base_path()
9 | return [os.path.join(base, "codegen/sdk"), os.path.join(base, "codemods")]
10 |
11 |
12 | def get_codegen_sdk_codebase() -> Codebase:
13 | """Grabs a Codebase w/ GraphSitter content. Responsible for figuring out where it is, e.g. in Modal or local"""
14 | codebase = get_current_code_codebase(subdirectories=get_codegen_sdk_subdirectories())
15 | return codebase
16 |
--------------------------------------------------------------------------------
/src/codegen/sdk/code_generation/doc_utils/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/code_generation/doc_utils/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/code_generation/enums.py:
--------------------------------------------------------------------------------
1 | from enum import StrEnum
2 |
3 |
4 | class DocumentationDecorators(StrEnum):
5 | PYTHON = "py_apidoc"
6 | TYPESCRIPT = "ts_apidoc"
7 | CODEMOD = "canonical"
8 | GENERAL_API = "apidoc"
9 |
--------------------------------------------------------------------------------
/src/codegen/sdk/code_generation/prompts/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/code_generation/prompts/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/codebase/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/codebase/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/codebase/config_parser.py:
--------------------------------------------------------------------------------
1 | from abc import ABC, abstractmethod
2 | from typing import TYPE_CHECKING
3 |
4 | from codegen.shared.enums.programming_language import ProgrammingLanguage
5 |
6 | if TYPE_CHECKING:
7 | from codegen.sdk.codebase.codebase_context import CodebaseContext
8 |
9 |
10 | class ConfigParser(ABC):
11 | def __init__(self):
12 | pass
13 |
14 | @abstractmethod
15 | def parse_configs(self, codebase_context: "CodebaseContext"): ...
16 |
17 |
18 | def get_config_parser_for_language(language: ProgrammingLanguage, codebase_context: "CodebaseContext") -> ConfigParser | None:
19 | from codegen.sdk.typescript.config_parser import TSConfigParser
20 |
21 | if language == ProgrammingLanguage.TYPESCRIPT:
22 | return TSConfigParser(codebase_context)
23 |
24 | return None
25 |
--------------------------------------------------------------------------------
/src/codegen/sdk/codebase/flagging/group.py:
--------------------------------------------------------------------------------
1 | from dataclasses import dataclass
2 |
3 | from dataclasses_json import dataclass_json
4 |
5 | from codegen.sdk.codebase.flagging.code_flag import CodeFlag
6 | from codegen.sdk.codebase.flagging.groupers.enums import GroupBy
7 |
8 | DEFAULT_GROUP_ID = 0
9 |
10 |
11 | @dataclass_json
12 | @dataclass
13 | class Group:
14 | group_by: GroupBy
15 | segment: str
16 | flags: list[CodeFlag] | None = None
17 | id: int = DEFAULT_GROUP_ID
18 |
--------------------------------------------------------------------------------
/src/codegen/sdk/codebase/flagging/groupers/constants.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.flagging.groupers.all_grouper import AllGrouper
2 | from codegen.sdk.codebase.flagging.groupers.app_grouper import AppGrouper
3 | from codegen.sdk.codebase.flagging.groupers.codeowner_grouper import CodeownerGrouper
4 | from codegen.sdk.codebase.flagging.groupers.file_chunk_grouper import FileChunkGrouper
5 | from codegen.sdk.codebase.flagging.groupers.file_grouper import FileGrouper
6 | from codegen.sdk.codebase.flagging.groupers.instance_grouper import InstanceGrouper
7 |
8 | ALL_GROUPERS = [
9 | AllGrouper,
10 | AppGrouper,
11 | CodeownerGrouper,
12 | FileChunkGrouper,
13 | FileGrouper,
14 | InstanceGrouper,
15 | ]
16 |
--------------------------------------------------------------------------------
/src/codegen/sdk/codebase/flagging/groupers/enums.py:
--------------------------------------------------------------------------------
1 | from enum import StrEnum
2 |
3 |
4 | class GroupBy(StrEnum):
5 | ALL = "all"
6 | APP = "app"
7 | CODEOWNER = "codeowner"
8 | FILE = "file"
9 | FILE_CHUNK = "file_chunk"
10 | HOT_COLD = "hot_cold"
11 | INSTANCE = "instance"
12 |
--------------------------------------------------------------------------------
/src/codegen/sdk/codebase/flagging/groupers/utils.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.flagging.groupers.all_grouper import AllGrouper
2 | from codegen.sdk.codebase.flagging.groupers.base_grouper import BaseGrouper
3 | from codegen.sdk.codebase.flagging.groupers.constants import ALL_GROUPERS
4 | from codegen.sdk.codebase.flagging.groupers.enums import GroupBy
5 |
6 |
7 | def get_grouper_by_group_by(group_by: GroupBy | None) -> type[BaseGrouper]:
8 | if group_by is None:
9 | return AllGrouper
10 | matched_groupers = [x for x in ALL_GROUPERS if x.type == group_by]
11 | if len(matched_groupers) > 0:
12 | return matched_groupers[0]
13 | msg = f"No grouper found for group_by={group_by}. Did you add to ALL_GROUPERS?"
14 | raise ValueError(msg)
15 |
--------------------------------------------------------------------------------
/src/codegen/sdk/codebase/multigraph.py:
--------------------------------------------------------------------------------
1 | from collections import defaultdict
2 | from dataclasses import dataclass, field
3 | from typing import Generic, TypeVar
4 |
5 | from codegen.sdk import TYPE_CHECKING
6 | from codegen.sdk.core.detached_symbols.function_call import FunctionCall
7 |
8 | if TYPE_CHECKING:
9 | from codegen.sdk.core.function import Function
10 |
11 | TFunction = TypeVar("TFunction", bound=Function)
12 |
13 |
14 | @dataclass
15 | class MultiGraph(Generic[TFunction]):
16 | """Mapping of API endpoints to their definitions and usages across languages."""
17 |
18 | api_definitions: dict[str, TFunction] = field(default_factory=dict)
19 | usages: defaultdict[str, list[FunctionCall]] = field(default_factory=lambda: defaultdict(list))
20 |
--------------------------------------------------------------------------------
/src/codegen/sdk/codebase/node_classes/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/codebase/node_classes/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/codebase/progress/progress.py:
--------------------------------------------------------------------------------
1 | from abc import ABC, abstractmethod
2 | from typing import TYPE_CHECKING, Generic, TypeVar
3 |
4 | if TYPE_CHECKING:
5 | from codegen.sdk.codebase.progress.task import Task
6 |
7 | T = TypeVar("T", bound="Task")
8 |
9 |
10 | class Progress(ABC, Generic[T]):
11 | @abstractmethod
12 | def begin(self, message: str, count: int | None = None) -> T:
13 | pass
14 |
--------------------------------------------------------------------------------
/src/codegen/sdk/codebase/progress/stub_progress.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.progress.progress import Progress
2 | from codegen.sdk.codebase.progress.stub_task import StubTask
3 |
4 |
5 | class StubProgress(Progress[StubTask]):
6 | def begin(self, message: str, count: int | None = None) -> StubTask:
7 | return StubTask()
8 |
--------------------------------------------------------------------------------
/src/codegen/sdk/codebase/progress/stub_task.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.progress.task import Task
2 |
3 |
4 | class StubTask(Task):
5 | def update(self, message: str, count: int | None = None) -> None:
6 | pass
7 |
8 | def end(self) -> None:
9 | pass
10 |
--------------------------------------------------------------------------------
/src/codegen/sdk/codebase/progress/task.py:
--------------------------------------------------------------------------------
1 | from abc import ABC, abstractmethod
2 |
3 |
4 | class Task(ABC):
5 | @abstractmethod
6 | def update(self, message: str, count: int | None = None) -> None:
7 | pass
8 |
9 | @abstractmethod
10 | def end(self) -> None:
11 | pass
12 |
--------------------------------------------------------------------------------
/src/codegen/sdk/codebase/resolution_stack.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.extensions.resolution import ResolutionStack
2 |
3 | __all__ = ["ResolutionStack"]
4 |
--------------------------------------------------------------------------------
/src/codegen/sdk/core/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/core/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/core/autocommit/ruff.toml:
--------------------------------------------------------------------------------
1 | extend = "../../../../../pyproject.toml"
2 | lint.extend-select = ["G"]
3 |
--------------------------------------------------------------------------------
/src/codegen/sdk/core/detached_symbols/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/core/detached_symbols/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/core/expressions/__init__.py:
--------------------------------------------------------------------------------
1 | from typing import TYPE_CHECKING
2 |
3 | from codegen.sdk.core.expressions.expression import Expression
4 | from codegen.sdk.core.expressions.name import Name
5 | from codegen.sdk.core.expressions.string import String
6 | from codegen.sdk.core.expressions.type import Type
7 | from codegen.sdk.core.expressions.value import Value
8 | from codegen.sdk.core.symbol_groups.dict import Dict
9 | from codegen.sdk.core.symbol_groups.list import List
10 |
11 | if TYPE_CHECKING:
12 | from codegen.sdk.core.detached_symbols.function_call import FunctionCall # noqa: TC004
13 |
14 | __all__ = ["Dict", "Expression", "FunctionCall", "List", "Name", "String", "Type", "Value"]
15 |
--------------------------------------------------------------------------------
/src/codegen/sdk/core/interfaces/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/core/interfaces/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/core/interfaces/has_attribute.py:
--------------------------------------------------------------------------------
1 | from abc import abstractmethod
2 | from typing import TYPE_CHECKING, Generic, TypeVar
3 |
4 | if TYPE_CHECKING:
5 | from codegen.sdk.core.interfaces.editable import Editable
6 |
7 |
8 | Attribute = TypeVar("Attribute", bound="Editable")
9 |
10 |
11 | class HasAttribute(Generic[Attribute]):
12 | @abstractmethod
13 | def resolve_attribute(self, name: str) -> Attribute | None:
14 | """Resolve an attribute belonging to this object."""
15 | pass
16 |
--------------------------------------------------------------------------------
/src/codegen/sdk/core/interfaces/parseable.py:
--------------------------------------------------------------------------------
1 | from abc import ABC, abstractmethod
2 | from typing import TYPE_CHECKING
3 |
4 | if TYPE_CHECKING:
5 | from codegen.sdk.codebase.codebase_context import CodebaseContext
6 |
7 |
8 | class Parseable(ABC):
9 | @abstractmethod
10 | def parse(self, ctx: "CodebaseContext") -> None:
11 | """Adds itself and its children to the codebase graph."""
12 |
--------------------------------------------------------------------------------
/src/codegen/sdk/core/interfaces/resolvable.py:
--------------------------------------------------------------------------------
1 | from abc import abstractmethod
2 | from typing import Generic
3 |
4 | from typing_extensions import TypeVar
5 |
6 | from codegen.sdk.core.autocommit import writer
7 | from codegen.sdk.core.interfaces.chainable import Chainable
8 | from codegen.sdk.core.interfaces.editable import Editable
9 | from codegen.shared.decorators.docs import noapidoc
10 |
11 | Parent = TypeVar("Parent", bound=Editable)
12 |
13 |
14 | class Resolvable(Chainable[Parent], Generic[Parent]):
15 | """Represents a class resolved to another symbol during the compute dependencies step."""
16 |
17 | @abstractmethod
18 | @noapidoc
19 | @writer
20 | def rename_if_matching(self, old: str, new: str) -> None: ...
21 |
--------------------------------------------------------------------------------
/src/codegen/sdk/core/node_id_factory.py:
--------------------------------------------------------------------------------
1 | NodeId = int
2 |
--------------------------------------------------------------------------------
/src/codegen/sdk/core/placeholder/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/core/placeholder/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/core/plugins/__init__.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.core.plugins.axios import AxiosApiFinder
2 | from codegen.sdk.core.plugins.flask import FlaskApiFinder
3 | from codegen.sdk.core.plugins.modal import ModalApiFinder
4 |
5 | PLUGINS = [
6 | FlaskApiFinder(),
7 | AxiosApiFinder(),
8 | ModalApiFinder(),
9 | ]
10 |
--------------------------------------------------------------------------------
/src/codegen/sdk/core/plugins/plugin.py:
--------------------------------------------------------------------------------
1 | from abc import ABC, abstractmethod
2 | from typing import TYPE_CHECKING
3 |
4 | from codegen.sdk.core.interfaces.editable import Editable
5 | from codegen.shared.enums.programming_language import ProgrammingLanguage
6 |
7 | if TYPE_CHECKING:
8 | from codegen.sdk.core.codebase import Codebase
9 |
10 |
11 | class Plugin(ABC):
12 | language: ProgrammingLanguage
13 |
14 | @abstractmethod
15 | def execute(self, codebase: "Codebase"): ...
16 | def register_api(self, method: str, label: str, node: Editable):
17 | pass
18 |
--------------------------------------------------------------------------------
/src/codegen/sdk/core/statements/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/core/statements/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/core/symbol_groups/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/core/symbol_groups/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/extensions/py.typed:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/extensions/py.typed
--------------------------------------------------------------------------------
/src/codegen/sdk/output/ast.py:
--------------------------------------------------------------------------------
1 | from typing import Self
2 |
3 | from openai import BaseModel
4 | from pydantic.config import ConfigDict
5 |
6 | from codegen.sdk.codebase.span import Span
7 |
8 |
9 | class AST(BaseModel):
10 | model_config = ConfigDict(frozen=True)
11 | codegen_sdk_type: str
12 | span: Span
13 | tree_sitter_type: str
14 | children: list[tuple[str | None, Self]]
15 |
--------------------------------------------------------------------------------
/src/codegen/sdk/output/constants.py:
--------------------------------------------------------------------------------
1 | ANGULAR_STYLE = False
2 | MAX_EDITABLE_LINES = 10
3 | MAX_STRING_LENGTH = 10000
4 |
--------------------------------------------------------------------------------
/src/codegen/sdk/output/placeholder.py:
--------------------------------------------------------------------------------
1 | from pydantic import BaseModel
2 | from pydantic.config import ConfigDict
3 |
4 | from codegen.sdk.codebase.span import Span
5 |
6 |
7 | class Placeholder(BaseModel):
8 | model_config = ConfigDict(frozen=True)
9 | preview: str
10 | span: Span
11 | kind_id: int
12 | name: str
13 |
--------------------------------------------------------------------------------
/src/codegen/sdk/py.typed:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/py.typed
--------------------------------------------------------------------------------
/src/codegen/sdk/python/__init__.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.python.assignment import PyAssignment
2 | from codegen.sdk.python.class_definition import PyClass
3 | from codegen.sdk.python.file import PyFile
4 | from codegen.sdk.python.function import PyFunction
5 | from codegen.sdk.python.import_resolution import PyImport
6 | from codegen.sdk.python.symbol import PySymbol
7 |
8 | __all__ = [
9 | "PyAssignment",
10 | "PyClass",
11 | "PyFile",
12 | "PyFunction",
13 | "PyImport",
14 | "PySymbol",
15 | ]
16 |
--------------------------------------------------------------------------------
/src/codegen/sdk/python/expressions/conditional_expression.py:
--------------------------------------------------------------------------------
1 | from typing import TYPE_CHECKING, TypeVar
2 |
3 | from codegen.sdk.core.expressions.ternary_expression import TernaryExpression
4 | from codegen.shared.decorators.docs import py_apidoc
5 |
6 | if TYPE_CHECKING:
7 | from codegen.sdk.core.interfaces.editable import Editable
8 |
9 | Parent = TypeVar("Parent", bound="Editable")
10 |
11 |
12 | @py_apidoc
13 | class PyConditionalExpression(TernaryExpression[Parent]):
14 | """Conditional Expressions (A if condition else B)"""
15 |
16 | def __init__(self, ts_node, file_node_id, ctx, parent: Parent) -> None:
17 | super().__init__(ts_node, file_node_id, ctx, parent=parent)
18 | self.consequence = self.children[0]
19 | self.condition = self.children[1]
20 | self.alternative = self.children[2]
21 |
--------------------------------------------------------------------------------
/src/codegen/sdk/python/expressions/named_type.py:
--------------------------------------------------------------------------------
1 | from typing import Generic, TypeVar
2 |
3 | from tree_sitter import Node as TSNode
4 |
5 | from codegen.sdk.core.expressions.named_type import NamedType
6 | from codegen.shared.decorators.docs import py_apidoc
7 |
8 | Parent = TypeVar("Parent")
9 |
10 |
11 | @py_apidoc
12 | class PyNamedType(NamedType[Parent], Generic[Parent]):
13 | """Named python type
14 |
15 | Examples:
16 | int,str (builtin types)
17 | Path (classes)
18 | """
19 |
20 | def _get_name_node(self) -> TSNode | None:
21 | return self.ts_node
22 |
--------------------------------------------------------------------------------
/src/codegen/sdk/python/expressions/type.py:
--------------------------------------------------------------------------------
1 | PyType = "PyUnionType[Parent] | PyNamedType[Parent] | PyGenericType[Parent] | NoneType"
2 | __all__ = ["PyType"]
3 |
--------------------------------------------------------------------------------
/src/codegen/sdk/python/expressions/union_type.py:
--------------------------------------------------------------------------------
1 | from typing import TYPE_CHECKING, Generic, TypeVar
2 |
3 | from codegen.sdk.core.expressions.union_type import UnionType
4 | from codegen.shared.decorators.docs import py_apidoc
5 |
6 | if TYPE_CHECKING:
7 | from codegen.sdk.python.expressions.type import PyType
8 |
9 | Parent = TypeVar("Parent")
10 |
11 |
12 | @py_apidoc
13 | class PyUnionType(UnionType["PyType", Parent], Generic[Parent]):
14 | """Union type
15 |
16 | Examples:
17 | str | int
18 | """
19 |
20 | pass
21 |
--------------------------------------------------------------------------------
/src/codegen/sdk/python/statements/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/python/statements/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/types.py:
--------------------------------------------------------------------------------
1 | from typing import TypeAlias
2 |
3 | JSON: TypeAlias = dict[str, "JSON"] | list["JSON"] | str | int | float | bool | None
4 |
--------------------------------------------------------------------------------
/src/codegen/sdk/typescript/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/typescript/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/typescript/expressions/array_type.py:
--------------------------------------------------------------------------------
1 | from typing import TypeVar
2 |
3 | from tree_sitter import Node as TSNode
4 |
5 | from codegen.sdk.typescript.expressions.named_type import TSNamedType
6 | from codegen.shared.decorators.docs import ts_apidoc
7 |
8 | Parent = TypeVar("Parent")
9 |
10 |
11 | @ts_apidoc
12 | class TSArrayType(TSNamedType[Parent]):
13 | """Array type
14 | Examples:
15 | string[]
16 | """
17 |
18 | def _get_name_node(self) -> TSNode | None:
19 | return self.ts_node.named_children[0]
20 |
--------------------------------------------------------------------------------
/src/codegen/sdk/typescript/expressions/named_type.py:
--------------------------------------------------------------------------------
1 | from typing import TypeVar
2 |
3 | from tree_sitter import Node as TSNode
4 |
5 | from codegen.sdk.core.expressions.named_type import NamedType
6 | from codegen.shared.decorators.docs import ts_apidoc
7 |
8 | Parent = TypeVar("Parent")
9 |
10 |
11 | @ts_apidoc
12 | class TSNamedType(NamedType[Parent]):
13 | """Named type
14 | Examples:
15 | string
16 | """
17 |
18 | def _get_name_node(self) -> TSNode | None:
19 | return self.ts_node
20 |
--------------------------------------------------------------------------------
/src/codegen/sdk/typescript/expressions/type.py:
--------------------------------------------------------------------------------
1 | TSType = "TSUnionType[Parent] | TSObjectType[Parent] | TSNamedType[Parent] | TSGenericType[Parent] | TSQueryType[Parent] | TSReadonlyType[Parent] | NoneType[Parent] | TSUndefinedType[Parent]"
2 | __all__ = ["TSType"]
3 |
--------------------------------------------------------------------------------
/src/codegen/sdk/typescript/expressions/union_type.py:
--------------------------------------------------------------------------------
1 | from typing import TYPE_CHECKING, Generic, TypeVar
2 |
3 | from codegen.sdk.core.expressions.union_type import UnionType
4 | from codegen.shared.decorators.docs import ts_apidoc
5 |
6 | if TYPE_CHECKING:
7 | from codegen.sdk.typescript.expressions.type import TSType
8 |
9 | Parent = TypeVar("Parent")
10 |
11 |
12 | @ts_apidoc
13 | class TSUnionType(UnionType["TSType", Parent], Generic[Parent]):
14 | """Union type
15 |
16 | Examples:
17 | string | number
18 | """
19 |
20 | pass
21 |
--------------------------------------------------------------------------------
/src/codegen/sdk/typescript/external/typescript_analyzer/.gitignore:
--------------------------------------------------------------------------------
1 | # Typescript Analyzer Specific GitIgnores
2 | node_modules
3 | dist
4 | package-lock.json
5 |
--------------------------------------------------------------------------------
/src/codegen/sdk/typescript/external/typescript_analyzer/src/fsi.ts:
--------------------------------------------------------------------------------
1 | export interface FileSystemInterface {
2 | readFile: (path: string) => string | undefined;
3 | writeFile?: (path: string, data: string) => void;
4 | readDirectory?: (path: string) => string[];
5 | getDirectories?: (path: string) => string[];
6 | fileExists: (path: string) => boolean;
7 | }
8 |
--------------------------------------------------------------------------------
/src/codegen/sdk/typescript/external/typescript_analyzer/src/index.ts:
--------------------------------------------------------------------------------
1 | export { TypeScriptAnalyzer, FunctionInfo } from "./analyzer";
2 | export { ProxyFileSystem } from "./fs_proxy";
3 | export { FileSystemInterface } from "./fsi";
4 |
--------------------------------------------------------------------------------
/src/codegen/sdk/typescript/external/typescript_analyzer/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "module": "ES2020",
5 | "moduleResolution": "node",
6 | "esModuleInterop": true,
7 | "strict": true,
8 | "skipLibCheck": true,
9 | "forceConsistentCasingInFileNames": true,
10 | "outDir": "./dist",
11 | "declaration": true,
12 | "declarationDir": "./dist",
13 | "rootDir": "./src"
14 | },
15 | "include": ["src/**/*"],
16 | "exclude": ["node_modules", "dist"],
17 | "ts-node": {
18 | "esm": true,
19 | "experimentalSpecifierResolution": "node"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/codegen/sdk/typescript/statements/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/sdk/typescript/statements/__init__.py
--------------------------------------------------------------------------------
/src/codegen/sdk/typescript/statements/block_statement.py:
--------------------------------------------------------------------------------
1 | from __future__ import annotations
2 |
3 | from typing import TYPE_CHECKING, Generic, TypeVar
4 |
5 | from codegen.sdk.core.statements.block_statement import BlockStatement
6 | from codegen.sdk.typescript.interfaces.has_block import TSHasBlock
7 | from codegen.shared.decorators.docs import apidoc
8 |
9 | if TYPE_CHECKING:
10 | from codegen.sdk.typescript.detached_symbols.code_block import TSCodeBlock
11 |
12 | Parent = TypeVar("Parent", bound="TSCodeBlock")
13 |
14 |
15 | @apidoc
16 | class TSBlockStatement(BlockStatement[Parent], TSHasBlock, Generic[Parent]):
17 | """Statement which contains a block."""
18 |
--------------------------------------------------------------------------------
/src/codegen/sdk/writer_decorators.py:
--------------------------------------------------------------------------------
1 | from codegen.shared.enums.programming_language import ProgrammingLanguage
2 |
3 |
4 | def canonical(codemod):
5 | """Decorator for canonical Codemods that will be used for AI-agent prompts."""
6 | codemod._canonical = True
7 | if not hasattr(codemod, "language") or codemod.language not in (ProgrammingLanguage.PYTHON, ProgrammingLanguage.TYPESCRIPT):
8 | msg = "Canonical codemods must have a `language` attribute (PYTHON or TYPESCRIPT)."
9 | raise AttributeError(msg)
10 | return codemod
11 |
--------------------------------------------------------------------------------
/src/codegen/shared/README.md:
--------------------------------------------------------------------------------
1 | # Codegen Shared
2 |
3 | A codegen module to contain a miscellaneous set of shared utilities.
4 |
5 | ### Dependencies
6 |
7 | This module should NOT contain any high level dependencies on other codegen modules.
8 | It should only depend on standard libraries and other shared utilities.
9 |
--------------------------------------------------------------------------------
/src/codegen/shared/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/shared/__init__.py
--------------------------------------------------------------------------------
/src/codegen/shared/compilation/README.md:
--------------------------------------------------------------------------------
1 | Utils around compiling a user's codeblock into a function.
2 |
3 | This includes:
4 |
5 | - Raising on any dangerous operations in the codeblock
6 | - Catching and logging any compilation errors
7 | - Monkey patching built-ins like print
8 | - etc
9 |
--------------------------------------------------------------------------------
/src/codegen/shared/compilation/codeblock_validation.py:
--------------------------------------------------------------------------------
1 | import re
2 |
3 | from codegen.shared.exceptions.compilation import DangerousUserCodeException
4 |
5 |
6 | def check_for_dangerous_operations(user_code: str) -> None:
7 | """If codeblock has dangerous operations (ex: exec, os.environ, etc) then raise an error and prevent the user from executing it."""
8 | dangerous_operation_patterns = [
9 | r"\b(os\.environ|locals|globals)\b", # Environment variables and scope access
10 | ]
11 | pattern = "|".join(dangerous_operation_patterns)
12 | if re.search(pattern, user_code, re.IGNORECASE):
13 | msg = "The codeblock contains potentially dangerous operations that are not allowed."
14 | raise DangerousUserCodeException(msg)
15 |
--------------------------------------------------------------------------------
/src/codegen/shared/enums/programming_language.py:
--------------------------------------------------------------------------------
1 | from enum import StrEnum
2 |
3 |
4 | class ProgrammingLanguage(StrEnum):
5 | TYPESCRIPT = "TYPESCRIPT"
6 | PYTHON = "PYTHON"
7 | OTHER = "OTHER"
8 | UNSUPPORTED = "UNSUPPORTED"
9 |
--------------------------------------------------------------------------------
/src/codegen/shared/exceptions/api.py:
--------------------------------------------------------------------------------
1 | class APINotApplicableForLanguageError(Exception):
2 | pass
3 |
--------------------------------------------------------------------------------
/src/codegen/shared/exceptions/compilation.py:
--------------------------------------------------------------------------------
1 | class UserCodeException(Exception):
2 | """Custom exception for any issues in user code."""
3 |
4 |
5 | class DangerousUserCodeException(UserCodeException):
6 | """Custom exception user code that has dangerous / not permitted operations."""
7 |
8 |
9 | class InvalidUserCodeException(UserCodeException):
10 | """Custom exception for user code that can be compiled/executed. Ex: syntax errors, indentation errors, name errors etc."""
11 |
--------------------------------------------------------------------------------
/src/codegen/shared/network/port.py:
--------------------------------------------------------------------------------
1 | import socket
2 | from contextlib import closing
3 |
4 |
5 | def get_free_port() -> int:
6 | """Find and return a free port on localhost"""
7 | with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
8 | s.bind(("", 0))
9 | s.listen(1)
10 | port = s.getsockname()[1]
11 | return int(port)
12 |
13 |
14 | def is_port_free(port: int, host: str = "localhost") -> bool:
15 | """Check if a port is free on localhost"""
16 | with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
17 | return s.connect_ex((host, port)) != 0
18 |
--------------------------------------------------------------------------------
/src/codegen/shared/path.py:
--------------------------------------------------------------------------------
1 | import os
2 | import subprocess
3 | from pathlib import Path
4 |
5 |
6 | def get_git_root_path(path: Path | None = None) -> Path | None:
7 | """Get the closest root of the git repository containing the given path"""
8 | try:
9 | path = path or Path.cwd()
10 | path = path.resolve()
11 | os.chdir(path)
12 | output = subprocess.run(["git", "rev-parse", "--show-toplevel"], capture_output=True, check=True, text=True)
13 | return Path(output.stdout.strip())
14 | except (subprocess.CalledProcessError, FileNotFoundError):
15 | return None
16 |
--------------------------------------------------------------------------------
/src/codegen/shared/performance/memory_utils.py:
--------------------------------------------------------------------------------
1 | import os
2 | from dataclasses import dataclass
3 |
4 | import psutil
5 |
6 |
7 | @dataclass
8 | class MemoryStats:
9 | memory_rss_gb: float
10 | memory_vms_gb: float
11 |
12 |
13 | def get_memory_stats() -> MemoryStats:
14 | process = psutil.Process(os.getpid())
15 | memory_info = process.memory_info()
16 |
17 | return MemoryStats(
18 | memory_rss_gb=memory_info.rss / 1024 / 1024 / 1024,
19 | memory_vms_gb=memory_info.vms / 1024 / 1024 / 1024,
20 | )
21 |
--------------------------------------------------------------------------------
/src/codegen/shared/performance/time_utils.py:
--------------------------------------------------------------------------------
1 | import datetime as dt
2 |
3 | import humanize
4 |
5 |
6 | def humanize_duration(seconds: float) -> str:
7 | """Converts a duration in seconds to a human-readable string.
8 | Example: humanize_duration(60) -> "1 minute"
9 | """
10 | delta = dt.timedelta(seconds=seconds)
11 | return humanize.precisedelta(delta, minimum_unit="milliseconds")
12 |
--------------------------------------------------------------------------------
/src/codegen/visualizations/enums.py:
--------------------------------------------------------------------------------
1 | from dataclasses import dataclass
2 | from enum import StrEnum
3 |
4 |
5 | @dataclass(frozen=True)
6 | class VizNode:
7 | name: str | None = None
8 | text: str | None = None
9 | code: str | None = None
10 | color: str | None = None
11 | shape: str | None = None
12 | start_point: tuple | None = None
13 | emoji: str | None = None
14 | end_point: tuple | None = None
15 | file_path: str | None = None
16 | symbol_name: str | None = None
17 |
18 |
19 | @dataclass(frozen=True)
20 | class GraphJson:
21 | type: str
22 | data: dict
23 |
24 |
25 | class GraphType(StrEnum):
26 | TREE = "tree"
27 | GRAPH = "graph"
28 |
--------------------------------------------------------------------------------
/src/codegen/visualizations/py.typed:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codegen/visualizations/py.typed
--------------------------------------------------------------------------------
/src/codemods/canonical/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/add_function_parameter_type_annotations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/add_function_parameter_type_annotations/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/add_internal_to_non_exported_components/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/add_internal_to_non_exported_components/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/bang_bang_to_boolean/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/bang_bang_to_boolean/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/change_component_tag_names/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/change_component_tag_names/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/convert_array_type_to_square_bracket/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/convert_array_type_to_square_bracket/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/convert_attribute_to_decorator/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/convert_attribute_to_decorator/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/convert_comments_to_JSDoc_style/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/convert_comments_to_JSDoc_style/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/convert_docstring_to_google_style/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/convert_docstring_to_google_style/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/insert_arguments_to_decorator/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/insert_arguments_to_decorator/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/invite_factory_create_params/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/invite_factory_create_params/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/mark_is_boolean/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/mark_is_boolean/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/pascal_case_symbols/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/pascal_case_symbols/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/pivot_return_types/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/pivot_return_types/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/split_decorators/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/split_decorators/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/swap_call_site_imports/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/swap_call_site_imports/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/update_optional_type_annotations/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/update_optional_type_annotations/__init__.py
--------------------------------------------------------------------------------
/src/codemods/canonical/update_union_types/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/src/codemods/canonical/update_union_types/__init__.py
--------------------------------------------------------------------------------
/src/codemods/codemod.py:
--------------------------------------------------------------------------------
1 | from collections.abc import Callable
2 |
3 |
4 | class Codemod:
5 | execute: Callable | None = None
6 |
7 | def __init__(self, name: str | None = None, execute: Callable | None = None, *args, **kwargs):
8 | self.name = name
9 | if execute:
10 | self.execute = execute
11 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_1/expected/file.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) Codegen.
2 | # All rights reserved.
3 |
4 |
5 | def foo(bar: int) -> int:
6 | return bar + 1
7 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_1/original/file.py:
--------------------------------------------------------------------------------
1 | def foo(bar: int) -> int:
2 | return bar + 1
3 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_2/expected/file.py:
--------------------------------------------------------------------------------
1 | from foo import foo_bar, foo_char
2 |
3 |
4 | def bar():
5 | return foo_bar() + foo_char()
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_2/expected/foo.py:
--------------------------------------------------------------------------------
1 | def foo_bar():
2 | return 1
3 |
4 |
5 | def foo_char():
6 | return 2
7 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_2/original/file.py:
--------------------------------------------------------------------------------
1 | def foo_bar():
2 | return 1
3 |
4 |
5 | def foo_char():
6 | return 2
7 |
8 |
9 | def bar():
10 | return foo_bar() + foo_char()
11 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_3/expected/decorators.py:
--------------------------------------------------------------------------------
1 | def decorator_function(func):
2 | return func
3 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_3/expected/file.py:
--------------------------------------------------------------------------------
1 | from decorators import decorator_function
2 |
3 |
4 | @decorator_function
5 | def foo_bar():
6 | return 1
7 |
8 |
9 | @decorator_function
10 | def foo_char():
11 | return 2
12 |
13 |
14 | def bar():
15 | return 3
16 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_3/original/decorators.py:
--------------------------------------------------------------------------------
1 | def decorator_function(func):
2 | return func
3 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_3/original/file.py:
--------------------------------------------------------------------------------
1 | def foo_bar():
2 | return 1
3 |
4 |
5 | def foo_char():
6 | return 2
7 |
8 |
9 | def bar():
10 | return 3
11 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_4/expected/file.py:
--------------------------------------------------------------------------------
1 | def bar_bar():
2 | return 1
3 |
4 |
5 | def bar_char():
6 | return 2
7 |
8 |
9 | def bar():
10 | return bar_bar() + bar_char()
11 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_4/expected/main.py:
--------------------------------------------------------------------------------
1 | from file import bar_bar, bar_char
2 |
3 |
4 | def main():
5 | return bar_bar() + bar_char()
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_4/original/file.py:
--------------------------------------------------------------------------------
1 | def foo_bar():
2 | return 1
3 |
4 |
5 | def foo_char():
6 | return 2
7 |
8 |
9 | def bar():
10 | return foo_bar() + foo_char()
11 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_4/original/main.py:
--------------------------------------------------------------------------------
1 | from file import foo_bar, foo_char
2 |
3 |
4 | def main():
5 | return foo_bar() + foo_char()
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_5/expected/file.py:
--------------------------------------------------------------------------------
1 | def foo_bar() -> int:
2 | return 1
3 |
4 |
5 | def foo_char() -> int:
6 | return 2
7 |
8 |
9 | def bar():
10 | return foo_bar() + foo_char()
11 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_5/original/file.py:
--------------------------------------------------------------------------------
1 | def foo_bar():
2 | return 1
3 |
4 |
5 | def foo_char():
6 | return 2
7 |
8 |
9 | def bar():
10 | return foo_bar() + foo_char()
11 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_6/expected/file.py:
--------------------------------------------------------------------------------
1 | def foo_bar():
2 | return 1
3 |
4 |
5 | def foo_char():
6 | return 2
7 |
8 |
9 | def bar():
10 | return foo_bar() + foo_char()
11 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_6/original/file.py:
--------------------------------------------------------------------------------
1 | def foo_bar():
2 | return 1
3 |
4 |
5 | def foo_char():
6 | return 2
7 |
8 |
9 | def unused_func():
10 | return 3
11 |
12 |
13 | def bar():
14 | return foo_bar() + foo_char()
15 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_6/original/unused_symbols.py:
--------------------------------------------------------------------------------
1 | def an_unused_func():
2 | return 4
3 |
4 |
5 | UNUSED_CONST = 5
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_7/expected/bar/enums.py:
--------------------------------------------------------------------------------
1 | from enum import Enum
2 |
3 |
4 | class Char(Enum):
5 | BAR = 1
6 | CHAR = 2
7 |
8 |
9 | class Bar(Enum):
10 | BAR = 1
11 | CHAR = 2
12 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_7/expected/bar/file.py:
--------------------------------------------------------------------------------
1 | from bar.enums import Bar, Char
2 |
3 |
4 | def bar():
5 | return Bar.BAR + Char.BAR
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_7/expected/foo/enums.py:
--------------------------------------------------------------------------------
1 | from enum import Enum
2 |
3 |
4 | class Foo(Enum):
5 | BAR = 1
6 | CHAR = 2
7 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_7/expected/foo/file.py:
--------------------------------------------------------------------------------
1 | from foo.enums import Foo
2 |
3 |
4 | def foo_bar():
5 | return 1
6 |
7 |
8 | def foo_char():
9 | return 2
10 |
11 |
12 | def bar():
13 | return foo_bar() + foo_char()
14 |
15 |
16 | def foo_enum():
17 | return Foo.BAR
18 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_7/original/bar/enums.py:
--------------------------------------------------------------------------------
1 | from enum import Enum
2 |
3 |
4 | class Char(Enum):
5 | BAR = 1
6 | CHAR = 2
7 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_7/original/bar/file.py:
--------------------------------------------------------------------------------
1 | from enum import Enum
2 |
3 | from bar.enums import Char
4 |
5 |
6 | class Bar(Enum):
7 | BAR = 1
8 | CHAR = 2
9 |
10 |
11 | def bar():
12 | return Bar.BAR + Char.BAR
13 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_py_7/original/foo/file.py:
--------------------------------------------------------------------------------
1 | from enum import Enum
2 |
3 |
4 | class Foo(Enum):
5 | BAR = 1
6 | CHAR = 2
7 |
8 |
9 | def foo_bar():
10 | return 1
11 |
12 |
13 | def foo_char():
14 | return 2
15 |
16 |
17 | def bar():
18 | return foo_bar() + foo_char()
19 |
20 |
21 | def foo_enum():
22 | return Foo.BAR
23 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_1/expected/file.ts:
--------------------------------------------------------------------------------
1 | // Copyright (c) Codegen.
2 | // All rights reserved.
3 |
4 | function foo(bar: number): number {
5 | return bar + 1;
6 | }
7 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_1/original/file.ts:
--------------------------------------------------------------------------------
1 |
2 | function foo(bar: number): number {
3 | return bar + 1;
4 | }
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_10/expected/types.ts:
--------------------------------------------------------------------------------
1 | export enum UserRole {
2 | ADMIN = "admin",
3 | USER = "user",
4 | GUEST = "guest",
5 | }
6 |
7 | export interface User {
8 | id: string;
9 | name: string;
10 | role: UserRole;
11 | }
12 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_10/original/types.ts:
--------------------------------------------------------------------------------
1 | export enum UserRole {
2 | ADMIN = "admin",
3 | USER = "user",
4 | GUEST = "guest",
5 | }
6 |
7 | export interface User {
8 | id: string;
9 | name: string;
10 | role: UserRole;
11 | }
12 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_2/expected/App.tsx:
--------------------------------------------------------------------------------
1 | import { Sidebar } from 'Sidebar';
2 | import { MainContent } from 'MainContent';
3 | import React from 'react';
4 | import { Header } from 'Header';
5 | import { Footer } from 'Footer';
6 |
7 |
8 | export const App: React.FC = () => {
9 | const userName = "John";
10 | return (
11 |
12 |
13 |
14 |
15 |
16 |
Welcome, ' + userName + '!
17 |
18 | );
19 | };
20 |
21 | export default App;
22 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_2/expected/Footer.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export const Footer: React.FC = () => {
4 | return ;
5 | };
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_2/expected/Header.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export const Header: React.FC = () => {
4 | return ;
5 | };
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_2/expected/MainContent.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export const MainContent: React.FC = () => {
4 | return Main Content
;
5 | };
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_2/expected/Sidebar.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export const Sidebar: React.FC = () => {
4 | return Sidebar Content
;
5 | };
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_2/expected/helpers.ts:
--------------------------------------------------------------------------------
1 | const unusedFunction = () => {
2 | console.log("This function is never used");
3 | };
4 |
5 | const formatName = (firstName: string, lastName: string) => {
6 | return firstName + " " + lastName;
7 | };
8 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_2/original/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Header } from 'Header';
3 | import { Footer } from 'Footer';
4 |
5 | const Sidebar: React.FC = () => {
6 | return Sidebar Content
;
7 | };
8 |
9 | const MainContent: React.FC = () => {
10 | return Main Content
;
11 | };
12 |
13 | export const App: React.FC = () => {
14 | const userName = "John";
15 | return (
16 |
17 |
18 |
19 |
20 |
21 |
Welcome, ' + userName + '!
22 |
23 | );
24 | };
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_2/original/Footer.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export const Footer: React.FC = () => {
4 | return ;
5 | };
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_2/original/Header.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export const Header: React.FC = () => {
4 | return ;
5 | };
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_2/original/helpers.ts:
--------------------------------------------------------------------------------
1 | const unusedFunction = () => {
2 | console.log("This function is never used");
3 | };
4 |
5 | const formatName = (firstName: string, lastName: string) => {
6 | return firstName + " " + lastName;
7 | };
8 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_3/expected/App.tsx:
--------------------------------------------------------------------------------
1 | import { Header } from "./Header";
2 | import { Footer } from "./Footer";
3 |
4 | const Sidebar = () => {
5 | return Sidebar Content
;
6 | };
7 |
8 | const MainContent = () => {
9 | return Main Content
;
10 | };
11 |
12 | const BarUnusedComponent = () => {
13 | return Unused Component
;
14 | }
15 |
16 | export const App = () => {
17 | const userName = "John";
18 | return (
19 |
20 |
21 |
22 |
23 |
24 |
Welcome, ' + userName + '!
25 |
26 | );
27 | };
28 |
29 | export default App;
30 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_3/expected/Footer.tsx:
--------------------------------------------------------------------------------
1 | export const Footer = () => {
2 | return ;
3 | };
4 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_3/expected/Header.tsx:
--------------------------------------------------------------------------------
1 | export const Header = () => {
2 | return ;
3 | };
4 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_3/original/App.tsx:
--------------------------------------------------------------------------------
1 | import { Header } from "./Header";
2 | import { Footer } from "./Footer";
3 |
4 | const Sidebar = () => {
5 | return Sidebar Content
;
6 | };
7 |
8 | const MainContent = () => {
9 | return Main Content
;
10 | };
11 |
12 | const UnusedComponent = () => {
13 | return Unused Component
;
14 | }
15 |
16 | const BarUnusedComponent = () => {
17 | return Unused Component
;
18 | }
19 | export const App = () => {
20 | const userName = "John";
21 | return (
22 |
23 |
24 |
25 |
26 |
27 |
Welcome, ' + userName + '!
28 |
29 | );
30 | };
31 |
32 | export default App;
33 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_3/original/Footer.tsx:
--------------------------------------------------------------------------------
1 | export const Footer = () => {
2 | return ;
3 | };
4 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_3/original/Header.tsx:
--------------------------------------------------------------------------------
1 | export const Header = () => {
2 | return ;
3 | };
4 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_3/original/helpers.ts:
--------------------------------------------------------------------------------
1 | const unusedFunction = () => {
2 | console.log("This function is never used");
3 | };
4 |
5 | const formatName = (firstName: string, lastName: string) => {
6 | return firstName + " " + lastName;
7 | };
8 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_4/expected/App.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Header } from "./Header";
3 | import { Footer } from "./Footer";
4 |
5 | const Sidebar = () => {
6 | return Sidebar Content
;
7 | };
8 |
9 | const MainContent = () => {
10 | return Main Content
;
11 | };
12 |
13 | export const App: React.FC = () => {
14 | const userName = "John";
15 | return (
16 |
17 |
18 |
19 |
20 |
21 |
{`Welcome, ${userName}!`}
22 |
23 | );
24 | };
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_4/expected/Footer.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export const Footer: React.FC = () => {
4 | return ;
5 | };
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_4/expected/Header.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export const Header: React.FC = () => {
4 | return ;
5 | };
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_4/expected/helpers.ts:
--------------------------------------------------------------------------------
1 | const unusedFunction = () => {
2 | console.log("This function is never used");
3 | };
4 |
5 | const formatName = (firstName: string, lastName: string) => {
6 | return `${firstName} ${lastName}`;
7 | };
8 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_4/original/App.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Header } from "./Header";
3 | import { Footer } from "./Footer";
4 |
5 | const Sidebar = () => {
6 | return Sidebar Content
;
7 | };
8 |
9 | const MainContent = () => {
10 | return Main Content
;
11 | };
12 |
13 | export const App: React.FC = () => {
14 | const userName = "John";
15 | return (
16 |
17 |
18 |
19 |
20 |
21 |
Welcome, ' + userName + '!
22 |
23 | );
24 | };
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_4/original/Footer.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export const Footer: React.FC = () => {
4 | return ;
5 | };
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_4/original/Header.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export const Header: React.FC = () => {
4 | return ;
5 | };
6 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_4/original/helpers.ts:
--------------------------------------------------------------------------------
1 | const unusedFunction = () => {
2 | console.log("This function is never used");
3 | };
4 |
5 | const formatName = (firstName: string, lastName: string) => {
6 | return firstName + " " + lastName;
7 | };
8 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_5/expected/App.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { getUser } from "./userHelpers";
3 |
4 | const Greeting: React.FC<{ name: string }> = ({ name }): JSX.Element => {
5 | return Hello, {name}!
;
6 | };
7 |
8 | export const App: React.FC = (): JSX.Element => {
9 | const user = getUser();
10 | return (
11 |
12 |
13 |
14 | );
15 | };
16 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_5/expected/user.router.js:
--------------------------------------------------------------------------------
1 | const express = require("express");
2 | const router = express.Router();
3 |
4 | router.get("/user/:id", (req, res) => {
5 | res.json({ id: req.params.id, name: "John Doe" });
6 | });
7 |
8 | module.exports = router;
9 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_5/expected/userHelpers.ts:
--------------------------------------------------------------------------------
1 | export function getUser(): { name: string; age: number } {
2 | return { name: "John Doe", age: 30 };
3 | }
4 |
5 | function formatUserName(firstName: string, lastName: string): string {
6 | return `${firstName} ${lastName}`;
7 | }
8 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_5/original/App.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { getUser } from "./userHelpers";
3 |
4 | const Greeting = ({ name }) => {
5 | return Hello, {name}!
;
6 | };
7 |
8 | export const App = () => {
9 | const user = getUser();
10 | return (
11 |
12 |
13 |
14 | );
15 | };
16 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_5/original/user.router.js:
--------------------------------------------------------------------------------
1 | const express = require("express");
2 | const router = express.Router();
3 |
4 | router.get("/user/:id", (req, res) => {
5 | res.json({ id: req.params.id, name: "John Doe" });
6 | });
7 |
8 | module.exports = router;
9 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_5/original/userHelpers.ts:
--------------------------------------------------------------------------------
1 | export function getUser() {
2 | return { name: "John Doe", age: 30 };
3 | }
4 |
5 | function formatUserName(firstName, lastName) {
6 | return `${firstName} ${lastName}`;
7 | }
8 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_6/expected/App.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { getUser } from "./userHelpers";
3 |
4 | const Greeting = ({ name }) => {
5 | return Hello, {name}!
;
6 | };
7 |
8 | export const App = () => {
9 | const user = getUser();
10 | return (
11 |
12 |
13 |
14 | );
15 | };
16 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_6/expected/user.router.ts:
--------------------------------------------------------------------------------
1 | import express from "express";
2 | const router = express.Router();
3 |
4 | router.get("/user/:id", (req, res) => {
5 | res.json({ id: req.params.id, name: "John Doe" });
6 | });
7 |
8 | export default router;
9 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_6/expected/userHelpers.ts:
--------------------------------------------------------------------------------
1 | export function getUser() {
2 | return { name: "John Doe", age: 30 };
3 | }
4 |
5 | function formatUserName(firstName, lastName) {
6 | return `${firstName} ${lastName}`;
7 | }
8 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_6/original/App.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { getUser } from "./userHelpers";
3 |
4 | const Greeting = ({ name }) => {
5 | return Hello, {name}!
;
6 | };
7 |
8 | export const App = () => {
9 | const user = getUser();
10 | return (
11 |
12 |
13 |
14 | );
15 | };
16 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_6/original/user.router.js:
--------------------------------------------------------------------------------
1 | const express = require("express");
2 | const router = express.Router();
3 |
4 | router.get("/user/:id", (req, res) => {
5 | res.json({ id: req.params.id, name: "John Doe" });
6 | });
7 |
8 | module.exports = router;
9 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_6/original/userHelpers.ts:
--------------------------------------------------------------------------------
1 | export function getUser() {
2 | return { name: "John Doe", age: 30 };
3 | }
4 |
5 | function formatUserName(firstName, lastName) {
6 | return `${firstName} ${lastName}`;
7 | }
8 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_7/expected/app/App.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { getUser } from "./userHelpers";
3 |
4 | /**
5 | * This function is intended for internal use within the module.
6 | * @param {string} input - The input string to process.
7 | * @returns {string} The processed output string.
8 | *
9 | * @internal
10 | */
11 | const Greeting = ({ name }) => {
12 | return Hello, {name}!
;
13 | };
14 |
15 | export const App = () => {
16 | const user = getUser();
17 | return (
18 |
19 |
20 |
21 | );
22 | };
23 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_7/expected/app/userHelpers.ts:
--------------------------------------------------------------------------------
1 | export function getUser() {
2 | return { name: "John Doe", age: 30 };
3 | }
4 |
5 | /* @internal */
6 | function formatUserName(firstName, lastName) {
7 | return `${firstName} ${lastName}`;
8 | }
9 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_7/expected/misc/Misc.tsx:
--------------------------------------------------------------------------------
1 | import { App } from "../app/App";
2 | import { getUser } from "../app/userHelpers";
3 |
4 | export const Misc = () => {
5 | const user = getUser();
6 | return (
7 |
10 | );
11 | };
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_7/original/app/App.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { getUser } from "./userHelpers";
3 |
4 | /**
5 | * This function is intended for internal use within the module.
6 | * @param {string} input - The input string to process.
7 | * @returns {string} The processed output string.
8 | */
9 | const Greeting = ({ name }) => {
10 | return Hello, {name}!
;
11 | };
12 |
13 | export const App = () => {
14 | const user = getUser();
15 | return (
16 |
17 |
18 |
19 | );
20 | };
21 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_7/original/app/userHelpers.ts:
--------------------------------------------------------------------------------
1 | export function getUser() {
2 | return { name: "John Doe", age: 30 };
3 | }
4 |
5 | function formatUserName(firstName, lastName) {
6 | return `${firstName} ${lastName}`;
7 | }
8 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_7/original/misc/Misc.tsx:
--------------------------------------------------------------------------------
1 | import { App } from "../app/App";
2 | import { getUser } from "../app/userHelpers";
3 |
4 | export const Misc = () => {
5 | const user = getUser();
6 | return (
7 |
10 | );
11 | };
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_8/expected/enums.ts:
--------------------------------------------------------------------------------
1 | export enum UserStatus {
2 | ACTIVE = "active",
3 | INACTIVE = "inactive",
4 | }
5 |
6 | export enum UserRole {
7 | ADMIN = "admin",
8 | USER = "user",
9 | GUEST = "guest",
10 | }
11 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_8/expected/types.ts:
--------------------------------------------------------------------------------
1 | import { UserRole } from "./enums";
2 | export interface User {
3 | id: string;
4 | name: string;
5 | role: UserRole;
6 | }
7 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_8/original/types.ts:
--------------------------------------------------------------------------------
1 | export enum UserRole {
2 | ADMIN = "admin",
3 | USER = "user",
4 | GUEST = "guest",
5 | }
6 |
7 | export interface User {
8 | id: string;
9 | name: string;
10 | role: UserRole;
11 | }
12 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_9/expected/types.ts:
--------------------------------------------------------------------------------
1 | export enum UserRole {
2 | ADMIN = "admin",
3 | USER = "user",
4 | GUEST = "guest",
5 | }
6 |
7 | export interface User {
8 | readonly id: string;
9 | readonly name: string;
10 | readonly role: UserRole;
11 | }
12 |
--------------------------------------------------------------------------------
/src/codemods/eval/test_files/sample_ts_9/original/types.ts:
--------------------------------------------------------------------------------
1 | export enum UserRole {
2 | ADMIN = "admin",
3 | USER = "user",
4 | GUEST = "guest",
5 | }
6 |
7 | export interface User {
8 | id: string;
9 | name: string;
10 | role: UserRole;
11 | }
12 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/__init__.py
--------------------------------------------------------------------------------
/tests/integration/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/integration/__init__.py
--------------------------------------------------------------------------------
/tests/integration/codegen/git/codebase/conftest.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | import pytest
4 |
5 | from codegen.sdk.core.codebase import Codebase
6 |
7 |
8 | @pytest.fixture
9 | def codebase(tmpdir):
10 | os.chdir(tmpdir)
11 | codebase = Codebase.from_repo(repo_full_name="codegen-sh/Kevin-s-Adventure-Game", tmp_dir=tmpdir, language="python")
12 | yield codebase
13 |
--------------------------------------------------------------------------------
/tests/integration/codegen/git/conftest.py:
--------------------------------------------------------------------------------
1 | from unittest.mock import MagicMock
2 |
3 | import pytest
4 |
5 | from codegen.git.schemas.repo_config import RepoConfig
6 |
7 |
8 | @pytest.fixture()
9 | def mock_config():
10 | """Mock Config instance to prevent actual environment variable access during tests."""
11 | mock_config = MagicMock()
12 | mock_config.GITHUB_TOKEN = "test-highside-token"
13 |
14 | yield mock_config
15 |
16 |
17 | @pytest.fixture()
18 | def repo_config(tmpdir):
19 | repo_config = RepoConfig(
20 | name="Kevin-s-Adventure-Game",
21 | full_name="codegen-sh/Kevin-s-Adventure-Game",
22 | base_dir=str(tmpdir),
23 | )
24 | yield repo_config
25 |
--------------------------------------------------------------------------------
/tests/integration/codegen/sdk/core/conftest.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | from codegen.sdk.code_generation.codegen_sdk_codebase import get_codegen_sdk_codebase
4 |
5 |
6 | @pytest.fixture(scope="module")
7 | def codebase():
8 | return get_codegen_sdk_codebase()
9 |
--------------------------------------------------------------------------------
/tests/integration/codegen/test_imports.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | import codegen
4 | from codegen.sdk.code_generation.current_code_codebase import get_graphsitter_repo_path
5 | from codegen.sdk.core.codebase import Codebase
6 |
7 |
8 | def test_codegen_imports():
9 | # Test decorated function
10 | @codegen.function(name="sample_codemod")
11 | def run(codebase):
12 | pass
13 |
14 | # Test class
15 | cls = codegen.Function
16 | assert cls is not None
17 | os.chdir(get_graphsitter_repo_path()) # TODO: CG-10643
18 | codebase = Codebase("./")
19 | assert codebase is not None
20 |
--------------------------------------------------------------------------------
/tests/integration/codemod/.gitignore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/integration/codemod/.gitignore
--------------------------------------------------------------------------------
/tests/integration/codemod/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/integration/codemod/__init__.py
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/airflow.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "airflow",
3 | "commit": "9fbaca0ab0150d899caea172ea3d1085982edd4f",
4 | "url": "https://github.com/apache/airflow",
5 | "language": "PYTHON",
6 | "size": "large"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/cypress.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cypress",
3 | "commit": "babee8b15b0b41ba52bcff5d0e6cf47411324011",
4 | "url": "https://github.com/cypress-io/cypress-realworld-app",
5 | "language": "TYPESCRIPT",
6 | "size": "small",
7 | "extra_repo": false
8 | }
9 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/deno_rest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "deno_rest",
3 | "commit": "a1e8e9028064f1b46975f68c3152761aa1576e69",
4 | "url": "https://github.com/Prolifode/deno_rest",
5 | "language": "TYPESCRIPT",
6 | "size": "small",
7 | "extra_repo": false
8 | }
9 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/django.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "django",
3 | "commit": "aa9079505082d92d4ee5dc6a4adca056422422ed",
4 | "url": "https://github.com/django/django",
5 | "language": "PYTHON",
6 | "size": "large"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/fastapi.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "fastapi",
3 | "commit": "b2e233867cdd255ac7cb86878d643d953c78f418",
4 | "url": "https://github.com/fastapi/fastapi",
5 | "language": "PYTHON",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/flask-bones.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "flask-bones",
3 | "commit": "bc61f5c12b50e366df605462ba227f5efc03bc1b",
4 | "url": "https://github.com/cburmeister/flask-bones",
5 | "language": "PYTHON",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/flask.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "flask",
3 | "commit": "a8956feba1e40105e7bc78fa62ce36c58d1c91e1",
4 | "url": "https://github.com/pallets/flask",
5 | "language": "PYTHON",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/gradio.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "gradio",
3 | "commit": "f40747c9fd12d160ac9f7b3c5273be6be815efac",
4 | "url": "https://github.com/gradio-app/gradio",
5 | "language": "PYTHON",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/graphrag.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "graphrag",
3 | "commit": "487cb963766ed650228900ff698a7e2f31e2c843",
4 | "url": "https://github.com/microsoft/graphrag",
5 | "language": "PYTHON",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/hass.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hass",
3 | "commit": "fef9c92eb76967332a780d24ce6a5d08e210bbe5",
4 | "url": "https://github.com/home-assistant/core",
5 | "language": "PYTHON",
6 | "size": "large",
7 | "priority": 2
8 | }
9 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/indico.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "indico",
3 | "commit": "5167d8c065e04ca468764babeffd9f5287a3af60",
4 | "url": "https://github.com/indico/indico",
5 | "language": "PYTHON",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/indra.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "indra",
3 | "commit": "ab601b71e7a0c4d08e495debb0e68e49d24d5443",
4 | "url": "https://github.com/sorgerlab/indra",
5 | "language": "PYTHON",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/jchat.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "jchat",
3 | "commit": "6ec256524f167abb7df559414e809bdbe6074e50",
4 | "url": "https://github.com/jpush/jchat-web",
5 | "language": "TYPESCRIPT",
6 | "size": "small",
7 | "extra_repo": false
8 | }
9 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/mypy.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mypy",
3 | "commit": "9d56820a63d5b47b53ff0ab6e96ce0951c774ae5",
4 | "url": "https://github.com/python/mypy",
5 | "language": "PYTHON",
6 | "size": "large",
7 | "priority": 2
8 | }
9 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/nest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nest",
3 | "commit": "233a89ab3d84d814bb795f738be15216f5b30ed9",
4 | "url": "https://github.com/nestjs/nest",
5 | "language": "TYPESCRIPT",
6 | "size": "small",
7 | "priority": 2
8 | }
9 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/papermark.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "papermark",
3 | "commit": "83b0dcf63e5470c295213c48cc6daafa9b55cbdc",
4 | "url": "https://github.com/mfts/papermark.git",
5 | "language": "TYPESCRIPT",
6 | "size": "small",
7 | "extra_repo": false
8 | }
9 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/posthog.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "posthog",
3 | "url": "https://github.com/PostHog/posthog.git",
4 | "commit": "9f0b1efae0c7b060e9700bd03d60b9d4b4153d40",
5 | "language": "PYTHON",
6 | "size": "large"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/pylsp.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "pylsp",
3 | "commit": "cabac8e6f941520d7d61e47feb6dda4cfa20811f",
4 | "url": "https://github.com/python-lsp/python-lsp-server",
5 | "language": "PYTHON",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/redash.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "redash",
3 | "commit": "86b75db82ef12f7c2999f75245189853a6a4467e",
4 | "url": "https://github.com/getredash/redash",
5 | "language": "PYTHON",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/remix_run_examples.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "remix_run_examples",
3 | "commit": "421c448077620b64011c7d7c087d382a84ec772d",
4 | "url": "https://github.com/remix-run/examples",
5 | "language": "TYPESCRIPT",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/requests-oauthlib.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "requests-oauthlib",
3 | "commit": "c003c22eceb9e54a7cfe242b7976412a2c98a972",
4 | "url": "https://github.com/requests/requests-oauthlib",
5 | "language": "PYTHON",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/sqlglot.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sqlglot",
3 | "commit": "8a948c805f7534e266557e1aa08bee0982340685",
4 | "language": "PYTHON",
5 | "url": "https://github.com/tobymao/sqlglot",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/suite.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "suite",
3 | "commit": "14ed49b21cf8296d2e0696a7f50f91f8e4b65072",
4 | "url": "https://github.com/Staffjoy/suite",
5 | "language": "PYTHON",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/transformers.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "transformers",
3 | "commit": "c1aa0edb48217f416f4bbe6e3a9db1500284513b",
4 | "url": "https://github.com/huggingface/transformers",
5 | "language": "PYTHON",
6 | "size": "large"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/virtual_coffee.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "virtual_coffee",
3 | "commit": "e1c12c93663d6e8e046adb77081f73b12133f6c6",
4 | "url": "https://github.com/Virtual-Coffee/virtualcoffee.io",
5 | "language": "TYPESCRIPT",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/vite.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vite",
3 | "commit": "0f56e1724162df76fffd5508148db118767ebe32",
4 | "url": "https://github.com/vitejs/vite",
5 | "language": "TYPESCRIPT",
6 | "size": "small"
7 | }
8 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/open_source/vscode.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vscode",
3 | "commit": "32a41e158d04c9777522dc567574f2a74b8f2bf9",
4 | "url": "https://github.com/microsoft/vscode",
5 | "language": "TYPESCRIPT",
6 | "size": "large",
7 | "priority": 2
8 | }
9 |
--------------------------------------------------------------------------------
/tests/integration/codemod/repos/repos.json:
--------------------------------------------------------------------------------
1 | { "testing": "testing" }
2 |
--------------------------------------------------------------------------------
/tests/shared/README.md:
--------------------------------------------------------------------------------
1 | # Tests/shared
2 |
3 | ### What kind of things should go in here?
4 |
5 | Testing utilities like mocks, fixtures, test data that are used across multiple tests.
6 |
--------------------------------------------------------------------------------
/tests/shared/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/shared/__init__.py
--------------------------------------------------------------------------------
/tests/shared/codemod/constants.py:
--------------------------------------------------------------------------------
1 | DIFF_FILEPATH = "expected_diff.patch"
2 |
3 | GET_CODEMODS_URL_SUFFIX = "get-codemods.modal.run"
4 | UPDATE_CODEMOD_DIFF_URL_SUFFIX = "update-diff.modal.run"
5 |
--------------------------------------------------------------------------------
/tests/shared/mocks/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/shared/mocks/__init__.py
--------------------------------------------------------------------------------
/tests/shared/utils/recursion.py:
--------------------------------------------------------------------------------
1 | import logging
2 | import resource
3 | import sys
4 |
5 | logger = logging.getLogger(__name__)
6 |
7 |
8 | def set_recursion_limit():
9 | sys.setrecursionlimit(10**9)
10 | if sys.platform == "linux":
11 | logger.info(f"Setting stack limit to {resource.RLIM_INFINITY}")
12 | resource.setrlimit(resource.RLIMIT_STACK, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
13 |
--------------------------------------------------------------------------------
/tests/unit/codegen/agents/__init__.py:
--------------------------------------------------------------------------------
1 | # Unit tests for codegen.agents package
2 |
--------------------------------------------------------------------------------
/tests/unit/codegen/extensions/lsp/utils.py:
--------------------------------------------------------------------------------
1 | from lsprotocol.types import CreateFile, TextDocumentEdit, WorkspaceEdit
2 |
3 | from codegen.extensions.lsp.utils import get_path
4 | from codegen.sdk.core.codebase import Codebase
5 |
6 |
7 | def apply_edit(codebase: Codebase, edit: WorkspaceEdit):
8 | for change in edit.document_changes:
9 | if isinstance(change, TextDocumentEdit):
10 | path = get_path(change.text_document.uri)
11 | file = codebase.get_file(str(path.relative_to(codebase.repo_path)))
12 | for edit in change.edits:
13 | file.edit(edit.new_text)
14 | if isinstance(change, CreateFile):
15 | path = get_path(change.uri)
16 | codebase.create_file(str(path.relative_to(codebase.repo_path)))
17 | codebase.commit()
18 |
--------------------------------------------------------------------------------
/tests/unit/codegen/gscli/test_cli.py:
--------------------------------------------------------------------------------
1 | def test_cli():
2 | import codegen.gscli # noqa: F401
3 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/code_generation/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/code_generation/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/codebase/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/codebase/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/codebase/flagging/test_code_flag.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 | from codegen.sdk.codebase.flagging.enums import MessageType
3 |
4 |
5 | def test_code_flag_properties(tmpdir):
6 | # language=python
7 | content = """
8 | class Foo:
9 | def foo(fun):
10 | return fun
11 |
12 | class Bar:
13 | bar: int = 0
14 | """
15 | with get_codebase_session(tmpdir=tmpdir, files={"test.py": content}) as codebase:
16 | file = codebase.get_file("test.py")
17 | foo_class = file.get_class("Foo")
18 |
19 | flag = foo_class.flag(message="test message", message_type=MessageType.GITHUB, message_recipient="12345")
20 |
21 | assert flag.hash
22 | assert flag.filepath == "test.py"
23 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/codebase/session/target_python_file.py:
--------------------------------------------------------------------------------
1 | print("Hello World!")
2 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/codebase/session/test_verify_output.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 | from codegen.shared.enums.programming_language import ProgrammingLanguage
3 |
4 |
5 | def test_verify_output_python(tmpdir) -> None:
6 | try:
7 | with get_codebase_session(
8 | tmpdir=tmpdir,
9 | files={"invalid.py": "print('Hello, world!'", "valid.py": "print('Hello, world!')"},
10 | programming_language=ProgrammingLanguage.PYTHON,
11 | verify_output=True,
12 | ) as codebase:
13 | pass
14 |
15 | # If we reach here, the verify_output failed
16 | msg = "Verify output failed"
17 | raise Exception(msg)
18 | except SyntaxError:
19 | pass
20 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/core/utils/test_cache_utils.py:
--------------------------------------------------------------------------------
1 | from threading import Event
2 |
3 | from codegen.sdk.core.utils.cache_utils import cached_generator
4 |
5 |
6 | def test_cached_generator():
7 | event = Event()
8 |
9 | @cached_generator()
10 | def cached_function():
11 | assert not event.is_set()
12 | event.set()
13 | yield from range(10)
14 |
15 | # First call
16 | result = cached_function()
17 | assert list(result) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
18 |
19 | # Second call
20 | result = cached_function()
21 | assert list(result) == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
22 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/parser/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/parser/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/class_definition/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/class_definition/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/class_definition/test_class_add_comment.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 |
3 |
4 | def test_set_comment_to_method(tmpdir) -> None:
5 | # language=python
6 | content = """
7 | class Bar:
8 | @old
9 | def bar(fun):
10 | return fun
11 | """
12 | with get_codebase_session(tmpdir=tmpdir, files={"test.py": content}) as codebase:
13 | file = codebase.get_file("test.py")
14 |
15 | class_symbol = file.get_class("Bar")
16 | bar = class_symbol.get_method("bar")
17 | bar.set_comment("This is a comment")
18 | # language=python
19 | assert (
20 | file.content
21 | == """
22 | class Bar:
23 | # This is a comment
24 | @old
25 | def bar(fun):
26 | return fun
27 | """
28 | )
29 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/codebase/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/codebase/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/codebase/test_codebase.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 |
3 |
4 | def test_codebase_symbols(tmpdir) -> None:
5 | # language=python
6 | content = """
7 | def top_level_func():
8 | return 1 + 2
9 |
10 | class MyClass1:
11 | def foo(self):
12 | print("hello world!")
13 | """
14 | with get_codebase_session(tmpdir=tmpdir, files={"file1.py": content}) as codebase:
15 | assert len(list(codebase.functions)) == 1
16 | assert [f.name for f in codebase.functions] == ["top_level_func"]
17 | assert len(list(codebase.symbols)) == 2
18 | assert set([s.name for s in codebase.symbols]) == {"top_level_func", "MyClass1"}
19 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/codebase/test_codebase_raise_error.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
4 | from codegen.shared.enums.programming_language import ProgrammingLanguage
5 |
6 |
7 | def test_python_exports_not_supported(tmpdir):
8 | """Test that exports are not supported in Python codebases."""
9 | # language=python
10 | content = """
11 | def hello():
12 | pass
13 | """
14 | # Create a Python codebase with a simple Python file
15 | with get_codebase_session(tmpdir=tmpdir, files={"test.py": content}, programming_language=ProgrammingLanguage.PYTHON) as codebase:
16 | # Verify that accessing exports raises NotImplementedError
17 | with pytest.raises(NotImplementedError):
18 | _ = codebase.exports
19 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/comment_docstring/test_inline_comment.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 |
3 |
4 | def test_comment_inline(tmpdir) -> None:
5 | # language=python
6 | content = """
7 | symbol = 1 # this is an inline comment
8 | """
9 | with get_codebase_session(tmpdir=tmpdir, files={"test.py": content}) as codebase:
10 | file = codebase.get_file("test.py")
11 |
12 | symbol = file.get_symbol("symbol")
13 | assert symbol.comment is None
14 | assert symbol.inline_comment.source == "# this is an inline comment"
15 | assert symbol.inline_comment.text == "this is an inline comment"
16 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/detached_symbols/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/detached_symbols/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/detached_symbols/argument/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/detached_symbols/argument/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/detached_symbols/code_block/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/detached_symbols/code_block/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/detached_symbols/decorator/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/detached_symbols/decorator/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/detached_symbols/function_call/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/detached_symbols/function_call/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/detached_symbols/parameter/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/detached_symbols/parameter/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/file/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/file/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/file/test_ast_grep.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
4 |
5 |
6 | @pytest.mark.skip(reason="Not implementing AST Grep for now. Much better ways of doing this.")
7 | def test_ast_grep(tmpdir) -> None:
8 | # language=python
9 | content = """
10 | print("hello, world!")
11 | """
12 | with get_codebase_session(tmpdir=tmpdir, files={"file.py": content}) as codebase:
13 | file = codebase.get_file("file.py")
14 | file.ast_grep_replace(
15 | pattern="print($A)",
16 | replace="print('REPLACED')",
17 | )
18 | codebase.commit()
19 | assert "REPLACED" in file.source
20 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/file/test_file_add_symbol_from_source.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 | from codegen.sdk.python import PyAssignment
3 |
4 |
5 | def test_file_add_symbol_from_source_updates_graph(tmpdir) -> None:
6 | # language=python
7 | content = """
8 | def foo(bar):
9 | return bar
10 | """
11 |
12 | with get_codebase_session(tmpdir=tmpdir, files={"file.py": content}) as codebase:
13 | file = codebase.get_file("file.py")
14 |
15 | file.add_symbol_from_source(source="c = 1")
16 |
17 | symbol = file.get_symbol("c")
18 |
19 | assert symbol.name == "c"
20 | assert isinstance(symbol, PyAssignment)
21 | assert "c = 1" in file.content
22 |
23 | assert any([node.name == "c" for node in file.get_nodes()])
24 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/file/test_file_get_import_string.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_graph_session
2 | from codegen.shared.enums.programming_language import ProgrammingLanguage
3 |
4 |
5 | def test_file_get_import_string_no_params(tmpdir) -> None:
6 | content = """
7 | age: int = 25;
8 | """
9 | with get_codebase_graph_session(tmpdir=tmpdir, programming_language=ProgrammingLanguage.PYTHON, files={"test.py": content}) as ctx:
10 | file = ctx.get_file("test.py")
11 |
12 | file_import_string = file.get_import_string()
13 | assert file_import_string == "from . import test"
14 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/file/test_file_global_calls.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 |
3 |
4 | def test_global_function_calls(tmpdir) -> None:
5 | # language=python
6 | content = """
7 | def foo():
8 | pass
9 |
10 | def bar():
11 | foo()
12 |
13 | foo()
14 |
15 | if True:
16 | foo()
17 | else:
18 | foo()
19 |
20 | [foo() for _ in range(10)]
21 | """
22 | with get_codebase_session(tmpdir=tmpdir, files={"file.py": content}) as codebase:
23 | file = codebase.get_file("file.py")
24 | foo = file.get_symbol("foo")
25 | assert len(foo.call_sites) == 5
26 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/file/test_file_statements.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
4 |
5 |
6 | @pytest.mark.skip("TODO: @caroljung fix this once code block for file and symbols are unified")
7 | def test_file_statements(tmpdir) -> None:
8 | # language=python
9 | content = """
10 | import a
11 | b()
12 | c = 1
13 |
14 | def d():
15 | return 1
16 | """
17 | with get_codebase_session(tmpdir=tmpdir, files={"file.py": content}) as codebase:
18 | file = codebase.get_file("file.py")
19 | assert len(file.code_block.statements) == 4
20 | assert len(file.code_block.get_statements()) == 5
21 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/function/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/function/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/function/test_function_eq.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 |
3 |
4 | def test_function_statements_contains(tmpdir) -> None:
5 | # language=python
6 | content = """
7 | def g(tmpdir):
8 | a = 1
9 | b = 2
10 | c = 3
11 | """
12 | with get_codebase_session(tmpdir=tmpdir, files={"test.py": content}) as codebase:
13 | file = codebase.get_file("test.py")
14 |
15 | g = file.get_symbol("g")
16 | assert "a = 1" in g.code_block.statements
17 | assert "b = 2" in g.code_block.statements
18 | assert "c = 3" in g.code_block.statements
19 | assert "d = 1" not in g.code_block.statements
20 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/function/test_function_flag.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 | from codegen.shared.enums.programming_language import ProgrammingLanguage
3 |
4 |
5 | def test_function_flag_with_message(tmpdir):
6 | # language=python
7 | content = """
8 | def foo():
9 | pass
10 | """
11 | with get_codebase_session(tmpdir=tmpdir, files={"test.py": content}, programming_language=ProgrammingLanguage.PYTHON) as codebase:
12 | file = codebase.get_file("test.py")
13 | foo = file.get_function("foo")
14 |
15 | foo.flag(message="This is a test")
16 | codebase.commit()
17 |
18 | expected = """
19 | def foo():
20 | pass # 🚩 This is a test
21 | """
22 | assert file.content == expected
23 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/function/test_function_get_parameter_by_index.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 |
3 |
4 | def test_function_get_parameter_by_index(tmpdir) -> None:
5 | # language=python
6 | file = """
7 | def foo(a: int, b: str):
8 | print(a)
9 | print(b)
10 | """
11 | with get_codebase_session(tmpdir=tmpdir, files={"file.py": file}) as codebase:
12 | file = codebase.get_file("file.py")
13 | symbol = file.get_function("foo")
14 | parameter = symbol.get_parameter_by_index(0)
15 |
16 | assert parameter.name == "a"
17 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/global_var/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/global_var/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/global_var/test_global_var_importable.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 |
3 |
4 | def test_global_var_dependencies_none(tmpdir) -> None:
5 | # language=python
6 | content = """
7 | GLOBAL_VAR_1 = 234
8 | GLOBAL_VAR_2 = 432
9 |
10 | def foo(tmpdir):
11 | local_var = 123
12 | return local_var + GLOBAL_VAR_2
13 | """
14 | with get_codebase_session(tmpdir=tmpdir, files={"test.py": content}) as codebase:
15 | file = codebase.get_file("test.py")
16 |
17 | assert set(dep.name for dep in file.get_symbol("GLOBAL_VAR_1").dependencies) == set()
18 | assert set(dep.name for dep in file.get_symbol("GLOBAL_VAR_2").dependencies) == set()
19 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/global_var/test_global_var_special.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 |
3 |
4 | def test_global_var_attribute(tmpdir) -> None:
5 | # language=python
6 | content = """
7 | A = Thing()
8 |
9 | def foo():
10 | pass
11 |
12 | A.bar = foo
13 | """
14 | with get_codebase_session(tmpdir=tmpdir, files={"test.py": content}) as codebase:
15 | assert len(codebase.global_vars) == 2
16 | foo = codebase.get_symbol("foo")
17 | assert len(foo.symbol_usages) == 1
18 | A = codebase.get_symbol("A")
19 | assert len(A.symbol_usages) == 1
20 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/import_resolution/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/import_resolution/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/import_resolution/test_has_import.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 |
3 |
4 | def test_import_rename_usage_with_alias(tmpdir) -> None:
5 | # language=python
6 | content1 = """
7 | from file1 import foo1, foo2
8 | from file2 import foo3 as f2
9 | from file3 import bar
10 | """
11 | with get_codebase_session(tmpdir=tmpdir, files={"file1.py": content1}) as codebase:
12 | file = codebase.get_file("file1.py")
13 | assert file.has_import("foo2")
14 | assert file.has_import("f2")
15 | assert file.has_import("bar")
16 | assert not file.has_import("foo3")
17 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/statements/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/statements/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/statements/test_assignment_statement_remove.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 |
3 |
4 | def test_assignment_statement_remove(tmpdir) -> None:
5 | # language=python
6 | content = """
7 | def foo():
8 | a = 1
9 | b = 2
10 | c = 3
11 | return a + b + c
12 | """
13 | with get_codebase_session(tmpdir=tmpdir, files={"test.py": content}) as codebase:
14 | file = codebase.get_file("test.py")
15 | foo = file.get_function("foo")
16 | b = foo.code_block.get_local_var_assignment("b")
17 | b.remove()
18 | codebase.commit()
19 |
20 | assert file.content == "\ndef foo():\n a = 1\n c = 3\n return a + b + c\n"
21 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/statements/test_attribute_remove.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 |
3 |
4 | def test_attribute_remove(tmpdir) -> None:
5 | # language=python
6 | content = """
7 | class MyClass(ma.Schema):
8 | a: int
9 | b: int = 1
10 | c: OtherClass = OtherClass()
11 | """
12 | with get_codebase_session(tmpdir=tmpdir, files={"test.py": content}) as codebase:
13 | file = codebase.get_file("test.py")
14 | cls = file.get_class("MyClass")
15 | b = cls.get_attribute("b")
16 | b.remove()
17 | codebase.commit()
18 |
19 | assert file.content == "\nclass MyClass(ma.Schema):\n a: int\n c: OtherClass = OtherClass()\n"
20 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/python/utils/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/python/utils/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/comment_docstring/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/comment_docstring/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/expressions/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/expressions/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/expressions/ternary_expression/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/expressions/ternary_expression/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/file/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/file/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/file/test_file_get_import_string.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_graph_session
2 | from codegen.shared.enums.programming_language import ProgrammingLanguage
3 |
4 |
5 | def test_file_get_import_string_no_params(tmpdir) -> None:
6 | content = """
7 | let age: number = 25;
8 | let isStudent: boolean = true;
9 | let scores: number[] = [90, 85, 92];
10 | let person: { name: string, age: number } = { name: "Alice", age: 30 };
11 | """
12 | with get_codebase_graph_session(tmpdir=tmpdir, programming_language=ProgrammingLanguage.TYPESCRIPT, files={"test.ts": content}) as ctx:
13 | file = ctx.get_file("test.ts")
14 |
15 | file_import_string = file.get_import_string()
16 | assert file_import_string == "import * as test from 'test'"
17 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/file/test_file_graph.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 | from codegen.shared.enums.programming_language import ProgrammingLanguage
3 |
4 |
5 | def test_graph_has_node_for_existing_file(tmpdir) -> None:
6 | # language=typescript
7 | content = """
8 | function foo(bar: number): number {
9 | return bar;
10 | }
11 | """
12 | with get_codebase_session(tmpdir=tmpdir, files={"test.ts": content}, programming_language=ProgrammingLanguage.TYPESCRIPT) as codebase:
13 | file = codebase.get_file("test.ts")
14 |
15 | ctx = codebase.ctx
16 | assert ctx.has_node(file.node_id)
17 | assert ctx.get_node(file.node_id) == file
18 | assert ctx.has_node(file.node_id)
19 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/file/test_file_remove.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
4 | from codegen.shared.enums.programming_language import ProgrammingLanguage
5 |
6 |
7 | def tets_remove_existing_file(tmpdir) -> None:
8 | # language=typescript
9 | content = """
10 | function foo(bar: number): number {
11 | return bar;
12 | }
13 | """
14 | with get_codebase_session(tmpdir=tmpdir, files={"test.ts": content}, programming_language=ProgrammingLanguage.TYPESCRIPT) as codebase:
15 | file = codebase.get_file("test.ts")
16 | file.remove()
17 |
18 | assert not os.path.exists(file.filepath)
19 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/function/test_function_flag.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 | from codegen.shared.enums.programming_language import ProgrammingLanguage
3 |
4 |
5 | def test_function_flag_with_message(tmpdir):
6 | # language=typescript
7 | content = """
8 | function foo() {
9 | return;
10 | }
11 | """
12 | with get_codebase_session(tmpdir=tmpdir, files={"test.ts": content}, programming_language=ProgrammingLanguage.TYPESCRIPT) as codebase:
13 | file = codebase.get_file("test.ts")
14 | foo = file.get_function("foo")
15 |
16 | foo.flag(message="This is a test")
17 | codebase.commit()
18 |
19 | expected = """
20 | function foo() {
21 | return;
22 | } // 🚩 This is a test
23 | """
24 | assert file.content == expected
25 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/function/test_function_get_import_string.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 | from codegen.shared.enums.programming_language import ProgrammingLanguage
3 |
4 |
5 | def test_function_get_import_string_with_alias(tmpdir) -> None:
6 | # language=typescript
7 | src_file = """
8 | function foo() {
9 | return 1;
10 | }
11 | """
12 | with get_codebase_session(tmpdir=tmpdir, programming_language=ProgrammingLanguage.TYPESCRIPT, files={"src.ts": src_file}) as codebase:
13 | file = codebase.get_file("src.ts")
14 | foo_function = file.get_symbol("foo")
15 | import_string = foo_function.get_import_string(alias="bar")
16 | assert import_string == "import { foo as bar } from 'src';"
17 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/function/test_function_get_parameter_by_index.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 | from codegen.shared.enums.programming_language import ProgrammingLanguage
3 |
4 |
5 | def test_function_get_parameter_by_index(tmpdir) -> None:
6 | # language=typescript
7 | file = """
8 | function foo(a: number, b: string) {
9 | console.log(a);
10 | console.log(b);
11 | }
12 | """
13 | with get_codebase_session(tmpdir=tmpdir, files={"file.ts": file}, programming_language=ProgrammingLanguage.TYPESCRIPT) as codebase:
14 | file = codebase.get_file("file.ts")
15 | symbol = file.get_function("foo")
16 | parameter = symbol.get_parameter_by_index(0)
17 |
18 | assert parameter.name == "a"
19 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/global_var/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/global_var/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/global_var/test_global_var_get_import_string.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_session
2 | from codegen.sdk.enums import ImportType
3 | from codegen.shared.enums.programming_language import ProgrammingLanguage
4 |
5 |
6 | def test_global_var_get_import_string_import_type_star(tmpdir) -> None:
7 | # language=typescript
8 | src_file = """
9 | const foo = 1;
10 | """
11 | with get_codebase_session(tmpdir=tmpdir, programming_language=ProgrammingLanguage.TYPESCRIPT, files={"src.ts": src_file}) as codebase:
12 | file = codebase.get_file("src.ts")
13 | foo_global_var = file.get_symbol("foo")
14 | import_string = foo_global_var.get_import_string(import_type=ImportType.WILDCARD)
15 | assert import_string == "import * as src from 'src';"
16 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/global_var/test_global_var_special.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_graph_session
2 | from codegen.shared.enums.programming_language import ProgrammingLanguage
3 |
4 |
5 | def test_global_var_attribute(tmpdir) -> None:
6 | content = """
7 | const A = Thing()
8 |
9 | function foo() {}
10 |
11 | A.bar = foo()
12 | """
13 | with get_codebase_graph_session(tmpdir=tmpdir, programming_language=ProgrammingLanguage.TYPESCRIPT, files={"test.ts": content}) as ctx:
14 | file = ctx.get_file("test.ts")
15 | assert len(file.global_vars) == 2
16 | foo = file.get_function("foo")
17 | assert len(foo.symbol_usages) == 1
18 | A = file.get_symbol("A")
19 | assert len(A.symbol_usages) == 1
20 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/interface/test_interface_get_attribute.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.codebase.factory.get_session import get_codebase_graph_session
2 | from codegen.shared.enums.programming_language import ProgrammingLanguage
3 |
4 |
5 | def test_interface_get_attribute_finds_match(tmpdir) -> None:
6 | file = """
7 | interface Animal {
8 | name: string;
9 | age: number;
10 | }
11 | """
12 | with get_codebase_graph_session(tmpdir=tmpdir, programming_language=ProgrammingLanguage.TYPESCRIPT, files={"test.ts": file}) as ctx:
13 | file = ctx.get_file("test.ts")
14 | animal = file.get_symbol("Animal")
15 | name_attr = animal.get_attribute("name")
16 | assert name_attr
17 | assert name_attr.name == "name"
18 |
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/statements/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/statements/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/statements/assignment_statement/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/statements/assignment_statement/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/statements/attribute/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/statements/attribute/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/statements/for_loop_statement/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/statements/for_loop_statement/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/statements/if_block_statement/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/statements/if_block_statement/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/statements/statement/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/statements/statement/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/statements/try_catch_statement/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/statements/try_catch_statement/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/sdk/typescript/statements/while_statement/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/codegen/sdk/typescript/statements/while_statement/__init__.py
--------------------------------------------------------------------------------
/tests/unit/codegen/shared/compilation/test_codeblock_validation.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | from codegen.shared.compilation.codeblock_validation import check_for_dangerous_operations
4 | from codegen.shared.exceptions.compilation import DangerousUserCodeException
5 |
6 |
7 | def test_no_dangerous_operations():
8 | codeblock = """
9 | print("not dangerous")
10 | """
11 | try:
12 | check_for_dangerous_operations(codeblock)
13 | except DangerousUserCodeException:
14 | pytest.fail("Unexpected DangerousPythonCodeError raised")
15 |
16 |
17 | def test_dangerous_operations():
18 | codeblock = """
19 | print(os.environ["ENV"])
20 | """
21 | with pytest.raises(DangerousUserCodeException):
22 | check_for_dangerous_operations(codeblock)
23 |
--------------------------------------------------------------------------------
/tests/unit/codemods/test_codemod.py:
--------------------------------------------------------------------------------
1 | from codegen.sdk.core.codebase import Codebase
2 | from codemods.codemod import Codemod
3 |
4 |
5 | def test_codemod_execute():
6 | def sample_execute(codebase: Codebase):
7 | for file in codebase.files:
8 | file.content = "print('hello')"
9 |
10 | codemod = Codemod(name="sample_codemod", execute=sample_execute)
11 | assert id(codemod.execute) == id(sample_execute)
12 |
13 | codemod = Codemod(name="sample_codemod")
14 | assert codemod.execute is None
15 |
--------------------------------------------------------------------------------
/tests/unit/skills/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/codegen-sh/codegen/649b1b039a95b7a455f560a1c06a95b4d40d090b/tests/unit/skills/__init__.py
--------------------------------------------------------------------------------
/tests/unit/skills/snapshots/test_skills/test_all_example_skills/file_app_import_graph-PYTHON-case-0/file_app_import_graph_unnamed.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "graph",
3 | "data": {
4 | "directed": true,
5 | "multigraph": false,
6 | "graph": {},
7 | "nodes": [
8 | {
9 | "id": "path/to/file.py"
10 | },
11 | {
12 | "id": "from file1 import foo"
13 | },
14 | {
15 | "id": "from file2 import bar"
16 | }
17 | ],
18 | "links": [
19 | {
20 | "source": "path/to/file.py",
21 | "target": "from file1 import foo"
22 | },
23 | {
24 | "source": "path/to/file.py",
25 | "target": "from file2 import bar"
26 | }
27 | ]
28 | }
29 | }
--------------------------------------------------------------------------------