Thank you for your interest in contributing to ElixirScope! We're excited to have you join our community and help us build a revolutionary debugging and code intelligence platform for Elixir.
This document provides guidelines for contributing to the project, from setting up your development environment to submitting pull requests.
- Code of Conduct
- Getting Started
- How to Contribute
- Development Guidelines
- Understanding the Codebase
- Focus Areas for Contributions
- LLM Provider Setup (for AI-related contributions)
- Community and Communication
ElixirScope is dedicated to providing a welcoming and inclusive experience for everyone. All contributors are expected to adhere to our Code of Conduct (you'll need to create this file). Please read it before participating.
- Elixir ~> 1.15 (Check
mix.exsfor the exact version). - Erlang/OTP (compatible with your Elixir version).
- Git.
- (Optional, for AI/LLM contributions) API keys for Google Gemini or Vertex AI.
- Fork the
nshkrdotcom/ElixirScoperepository on GitHub. - Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/ElixirScope.git cd ElixirScope - Add an upstream remote to keep your fork in sync:
git remote add upstream https://github.com/nshkrdotcom/ElixirScope.git
-
Install Dependencies:
mix deps.get
-
Compile the Project:
mix compile
This will also run the ElixirScope compile-time instrumentation on its own code (if configured, though usually ElixirScope excludes itself).
-
Run Tests: Ensure everything is set up correctly by running the basic test suite:
mix testThis command excludes live API tests by default. See the Testing section for more details.
The cinema_demo application within test_apps/ is a great way to see ElixirScope in action and test your changes:
cd test_apps/cinema_demo
mix deps.get
mix compile
./run_showcase.shThis script starts ElixirScope, runs various scenarios, and demonstrates its core features.
- Check Existing Issues: Before submitting a new bug report, please search the GitHub Issues to see if the bug has already been reported.
- Provide Detailed Information: If you find a new bug, please open an issue and include:
- A clear and descriptive title.
- Steps to reproduce the bug.
- What you expected to happen.
- What actually happened (including error messages and stack traces if applicable).
- Your Elixir and Erlang versions.
- ElixirScope version (or commit SHA if using a development branch).
- Relevant code snippets if possible.
- We welcome suggestions for new features or improvements to existing ones!
- Please open an issue on GitHub, clearly describing your suggestion, why it would be beneficial, and any potential implementation ideas you might have.
- Check existing issues first to see if a similar enhancement has already been discussed.
If you're new to ElixirScope or open source, here are some good places to start:
- "Good First Issue" Label: Look for issues tagged with
good first issueorhelp wantedin the GitHub Issues. - Improve Documentation: Typos, unclear explanations, or missing examples in the README, guides, or code comments are always great contributions.
- Add More Tests: Increasing test coverage, especially for edge cases or new features, is highly valuable.
- Refactor Small Pieces of Code: If you see an area that could be clarified or made more efficient, propose a small refactor.
Before starting on a significant code contribution, it's a good idea to open an issue or comment on an existing one to discuss your approach with the maintainers.
- Ensure your fork is up-to-date with the
upstream/mainbranch:git checkout main git pull upstream main git push origin main # Update your fork's main - Create a new feature branch from your
mainbranch:git checkout -b my-feature-branch
- Make your changes.
- Follow the Code Style and Formatting guidelines.
- Add relevant tests for your changes.
- Ensure all tests pass (
mix test). - Update documentation if necessary.
- Commit your changes following the Commit Messages guidelines.
- Push your feature branch to your fork:
git push origin my-feature-branch
- Open a Pull Request (PR) on the
nshkrdotcom/ElixirScoperepository.- Provide a clear title and description for your PR.
- Reference any related issues (e.g., "Closes #123").
- Explain the "why" and "what" of your changes.
- If your PR is a work in progress, mark it as a "Draft Pull Request."
- Engage in the PR review process. Be responsive to feedback and make necessary adjustments.
- Once your PR is approved and CI checks pass, a maintainer will merge it.
- We generally follow a Gitflow-like model.
main: Represents the latest stable release. Do not commit directly tomain.- Development happens on feature branches (e.g.,
feature/new-ast-parser,fix/genserver-instrumentation-bug). - Feature branches should be based on
main(or a relevant development/release branch if active).
- We use
mix formatfor code formatting. Please run it before committing your changes:mix format
- Adhere to common Elixir conventions and best practices.
- Use
Credofor static code analysis and aim to address its suggestions:mix credo --strict
- Write Tests: All new features and bug fixes should be accompanied by tests.
- Unit Tests: For individual modules and functions.
- Integration Tests: For interactions between different components of ElixirScope.
- Test Coverage: Aim to maintain or increase test coverage. You can check coverage with:
mix test --cover # For HTML report (after running with --cover) mix coveralls.html open cover/excoveralls.html
- Running Test Suites:
mix test: Runs most tests (excludes:live_apiby default).mix test.all: Runs all tests, including those tagged:live_api(requires LLM API keys for some).mix test.fast: A quicker subset for rapid feedback.mix test.gemini,mix test.vertex,mix test.mock: For LLM provider-specific tests.mix test path/to/your_test.exs: To run a specific test file.
- Module and Function Docs: Use
@moduledocand@docextensively. Explain the purpose, arguments, return values, and provide examples. - README and Guides: Update relevant sections of
README.md, thisCONTRIBUTING.md, or other guides if your changes affect them. - Generate Docs: You can generate documentation locally using:
mix docs
- Follow conventional commit message format (e.g.,
feat: Add support for XYZ,fix: Correct race condition in ABC). - Use a clear and concise subject line (max 50 characters).
- Provide a more detailed body if necessary, explaining the "why" of the change.
- Reference issue numbers if applicable (e.g.,
Fixes #42).
ElixirScope is a complex system. Here's a brief overview of key areas:
lib/elixir_scope.ex: Main public API module.lib/elixir_scope/application.ex: Application supervision tree.lib/elixir_scope/config.ex: Configuration management.- Core Subdirectories:
lib/elixir_scope/compiler/: Contains theMix.Tasks.Compile.ElixirScopecustom compiler.lib/elixir_scope/ast/: Modules for AST transformation (Transformer,EnhancedTransformer,InjectorHelpers).lib/elixir_scope/capture/: Modules responsible for runtime event capture (InstrumentationRuntime,Ingestor,RingBuffer,TemporalBridge,TemporalStorage).lib/elixir_scope/storage/: Data storage mechanisms (DataAccess,EventStore).lib/elixir_scope/query/: Query engine for retrieving events.lib/elixir_scope/ai/: AI and rule-based analysis components (CodeAnalyzer,PatternRecognizer,ComplexityAnalyzer, LLM clients and providers).lib/elixir_scope/ast_repository/: Foundation for the future AST repository (Parser,ModuleData,FunctionData,Repository,RuntimeCorrelator).lib/elixir_scope/distributed/: (Likely for future use) Distributed tracing components.
test_apps/cinema_demo/: A full-fledged demo application that uses ElixirScope. Excellent for testing end-to-end functionality.
Mix.Tasks.Compile.ElixirScope(compile-time):- Reads
.exfile. - Calls
AI.CodeAnalyzer(which usesPatternRecognizer&ComplexityAnalyzer) to get a basic instrumentation plan. - Uses
AST.Transformer(withAST.InjectorHelpers) to modify the code's AST, injecting calls. - (Future:
AST.EnhancedTransformerandCompileTime.Orchestratorwill allow more granular, plan-driven instrumentation).
- Reads
- Instrumented Code (runtime):
- Calls functions in
Capture.InstrumentationRuntime.
- Calls functions in
Capture.InstrumentationRuntime(runtime):- Formats event data.
- Passes data to
Capture.Ingestor. - For AST-correlated events, forwards to
Capture.TemporalBridge.
Capture.Ingestor(runtime): Writes toCapture.RingBuffer.- Async Workers (e.g.,
Capture.AsyncWriterPoolconsuming from ring buffers - runtime): Process and store events, potentially inStorage.EventStoreorStorage.DataAccess. Capture.TemporalBridge(runtime): Works withCapture.TemporalStorageto store and query AST-correlated events for the "Cinema Debugger."
- Parsing: Primarily done via
Code.string_to_quoted/2in the compiler and analysis modules. - Transformation:
AST.TransformerandAST.EnhancedTransformeruseMacro.prewalk/3andquote do ... endto manipulate ASTs. - AST Node IDs:
ASTRepository.Parsercan assign unique:ast_node_idmetadata to AST nodes.ASTRepository.InstrumentationMapperalso generates these for its plans. These IDs are crucial for linking runtime events back to specific code constructs.
(As listed in the README)
- 🌐 Phoenix web interface for Cinema Debugger
- 🎨 Visual debugging tools and timeline UI
- 🔍 Enhanced AST analysis patterns (improving
PatternRecognizer,ComplexityAnalyzer) - 🧠 Deeper AI/LLM integration into instrumentation planning and debugging suggestions.
- 🌳 Implementing the persistent AST Repository and Code Property Graph generation.
- 🔗 Enhancing the
RuntimeCorrelatorandTemporalBridgefor more sophisticated AST-runtime linking. - 📚 Documentation improvements and tutorials.
- 🧪 Adding more property-based tests (using
StreamData) and chaos testing.
If you're working on features involving the LLM clients (lib/elixir_scope/ai/llm/):
- Mock Provider:
ElixirScope.AI.LLM.Providers.Mockis used by default and for most tests. It requires no setup. - Gemini:
- Set the
GOOGLE_API_KEYenvironment variable:export GOOGLE_API_KEY="your-actual-gemini-api-key"
- To run tests that make live calls to Gemini:
mix test.geminiormix test.llm.live.
- Set the
- Vertex AI:
- Set the
VERTEX_JSON_FILEenvironment variable to the path of your Google Cloud service account JSON key file:export VERTEX_JSON_FILE="/path/to/your-service-account-key.json"
- Ensure the service account has permissions for Vertex AI.
- To run tests that make live calls to Vertex AI:
mix test.vertexormix test.llm.live.
- Set the
Important: Never commit your API keys or service account files to the repository.
- GitHub Issues: For bug reports, feature requests, and discussions.
- Pull Requests: For submitting code changes.
- (Consider adding a Discord/Slack channel if the community grows).
We're excited to see your contributions and build an amazing tool together! If you have any questions, don't hesitate to open an issue.